aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-01-06 14:53:28 -0500
committerTakashi Iwai <tiwai@suse.de>2016-01-06 14:53:28 -0500
commit3f37b26f8d57756b591383a9d8ce1cd628bc773c (patch)
tree0311f4c48cfa7ace3940f3db203b930a2c2eaaa5
parentc7b60a89516beb20a352ec85c73a8fccd5becf26 (diff)
parentbc42f363da213b4bf7c15a2dc87b2b1a85cde867 (diff)
Merge tag 'asoc-fix-v4.4-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Last minute fixes for v4.4 A few final fixes for v4.4, the main one being the two patches to the new Sky Lake drivers which fix a previous incorrect fix that went in during an earlier -rc.
-rw-r--r--Documentation/devicetree/bindings/net/cpsw.txt6
-rw-r--r--Makefile2
-rw-r--r--arch/arc/Makefile2
-rw-r--r--arch/arc/include/asm/cache.h2
-rw-r--r--arch/arc/kernel/unwind.c28
-rw-r--r--arch/arc/mm/highmem.c4
-rw-r--r--arch/arm/boot/dts/imx6q-gw5400-a.dts2
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw51xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw52xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw53xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-gw54xx.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabreauto.dtsi6
-rw-r--r--arch/arm/boot/dts/omap4-duovero-parlor.dts4
-rw-r--r--arch/arm/boot/dts/sun6i-a31s-primo81.dts1
-rw-r--r--arch/arm/boot/dts/tegra124-nyan.dtsi2
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c73
-rw-r--r--arch/arm/mach-omap2/Kconfig2
-rw-r--r--arch/arm/mach-omap2/timer.c6
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/asm/io.h10
-rw-r--r--arch/mips/include/asm/uaccess.h52
-rw-r--r--arch/mips/kernel/cps-vec.S2
-rw-r--r--arch/mips/kernel/mips_ksyms.c2
-rw-r--r--arch/mips/lib/memset.S2
-rw-r--r--arch/mips/pci/pci-rt2880.c1
-rw-r--r--arch/mips/pmcs-msp71xx/msp_setup.c1
-rw-r--r--arch/mips/sni/reset.c2
-rw-r--r--arch/mips/vdso/Makefile4
-rw-r--r--arch/parisc/kernel/signal.c64
-rw-r--r--arch/powerpc/kvm/book3s_hv.c6
-rw-r--r--arch/s390/kernel/dis.c17
-rw-r--r--arch/sparc/include/asm/elf_64.h1
-rw-r--r--arch/sparc/include/uapi/asm/unistd.h7
-rw-r--r--arch/sparc/kernel/head_64.S13
-rw-r--r--arch/sparc/kernel/perf_event.c11
-rw-r--r--arch/sparc/kernel/rtrap_64.S8
-rw-r--r--arch/sparc/kernel/setup_64.c9
-rw-r--r--arch/sparc/kernel/systbls_32.S19
-rw-r--r--arch/sparc/kernel/systbls_64.S18
-rw-r--r--arch/sparc/lib/NG2copy_from_user.S8
-rw-r--r--arch/sparc/lib/NG2copy_to_user.S8
-rw-r--r--arch/sparc/lib/NG2memcpy.S118
-rw-r--r--arch/sparc/lib/NG4copy_from_user.S8
-rw-r--r--arch/sparc/lib/NG4copy_to_user.S8
-rw-r--r--arch/sparc/lib/NG4memcpy.S40
-rw-r--r--arch/sparc/lib/U1copy_from_user.S8
-rw-r--r--arch/sparc/lib/U1copy_to_user.S8
-rw-r--r--arch/sparc/lib/U1memcpy.S48
-rw-r--r--arch/sparc/lib/U3copy_from_user.S8
-rw-r--r--arch/sparc/lib/U3copy_to_user.S8
-rw-r--r--arch/sparc/lib/U3memcpy.S86
-rw-r--r--arch/x86/kvm/cpuid.h8
-rw-r--r--arch/x86/kvm/mtrr.c25
-rw-r--r--arch/x86/kvm/svm.c4
-rw-r--r--arch/x86/kvm/vmx.c7
-rw-r--r--arch/x86/kvm/x86.c12
-rw-r--r--arch/x86/um/signal.c2
-rw-r--r--arch/x86/xen/suspend.c1
-rw-r--r--block/blk-core.c20
-rw-r--r--block/blk-merge.c2
-rw-r--r--crypto/algif_skcipher.c61
-rw-r--r--drivers/acpi/processor_driver.c3
-rw-r--r--drivers/block/null_blk.c15
-rw-r--r--drivers/bus/sunxi-rsb.c8
-rw-r--r--drivers/cpufreq/scpi-cpufreq.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c63
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h28
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c111
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c1
-rw-r--r--drivers/gpu/drm/i915/i915_gem_stolen.c1
-rw-r--r--drivers/gpu/drm/i915/intel_display.c78
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c7
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c1
-rw-r--r--drivers/infiniband/core/cma.c16
-rw-r--r--drivers/infiniband/hw/mlx4/srq.c2
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma.h10
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_hw.c49
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_hw.h4
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_main.c57
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_sli.h49
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_verbs.c2
-rw-r--r--drivers/lightnvm/gennvm.c2
-rw-r--r--drivers/md/md.c11
-rw-r--r--drivers/memory/fsl_ifc.c1
-rw-r--r--drivers/mtd/ubi/debug.c2
-rw-r--r--drivers/mtd/ubi/io.c2
-rw-r--r--drivers/mtd/ubi/wl.c53
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c22
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c8
-rw-r--r--drivers/net/ethernet/emulex/benet/be_roce.c36
-rw-r--r--drivers/net/ethernet/emulex/benet/be_roce.h4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_clock.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_main.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c10
-rw-r--r--drivers/net/ethernet/natsemi/natsemi.c12
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c2
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c25
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.h33
-rw-r--r--drivers/net/ethernet/ti/cpsw.c63
-rw-r--r--drivers/net/geneve.c10
-rw-r--r--drivers/net/hamradio/6pack.c8
-rw-r--r--drivers/net/hamradio/mkiss.c4
-rw-r--r--drivers/net/usb/cdc_mbim.c2
-rw-r--r--drivers/net/usb/cdc_ncm.c49
-rw-r--r--drivers/net/veth.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-7000.c49
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c15
-rw-r--r--drivers/nvme/host/pci.c20
-rw-r--r--drivers/pci/host/pcie-hisi.c4
-rw-r--r--drivers/s390/crypto/ap_bus.c4
-rw-r--r--drivers/s390/virtio/virtio_ccw.c62
-rw-r--r--drivers/tty/serial/sunhv.c12
-rw-r--r--fs/nfsd/nfs4layouts.c2
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c2
-rw-r--r--fs/ocfs2/locks.c5
-rw-r--r--fs/ocfs2/resize.c15
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/vmstat.h6
-rw-r--r--include/sound/soc.h2
-rw-r--r--lib/rhashtable.c3
-rw-r--r--mm/memcontrol.c60
-rw-r--r--mm/memory_hotplug.c31
-rw-r--r--mm/vmstat.c10
-rw-r--r--net/bridge/br_stp_if.c2
-rw-r--r--net/ipv4/ipip.c3
-rw-r--r--net/ipv4/xfrm4_policy.c46
-rw-r--r--net/ipv6/addrconf.c11
-rw-r--r--net/ipv6/addrlabel.c2
-rw-r--r--net/ipv6/ndisc.c4
-rw-r--r--net/ipv6/xfrm6_policy.c53
-rw-r--r--net/netfilter/nf_tables_netdev.c2
-rw-r--r--net/netfilter/nft_ct.c1
-rw-r--r--net/openvswitch/conntrack.c6
-rw-r--r--net/openvswitch/flow_netlink.c5
-rw-r--r--net/sctp/sm_statefuns.c6
-rw-r--r--net/sctp/socket.c14
-rw-r--r--net/socket.c1
-rw-r--r--net/xfrm/xfrm_policy.c38
-rw-r--r--scripts/recordmcount.c137
-rw-r--r--security/keys/keyctl.c18
-rw-r--r--sound/soc/codecs/arizona.c2
-rw-r--r--sound/soc/codecs/rt5645.c4
-rw-r--r--sound/soc/codecs/rt5645.h4
-rw-r--r--sound/soc/intel/skylake/skl-topology.c3
-rw-r--r--sound/soc/intel/skylake/skl.c4
-rw-r--r--sound/soc/intel/skylake/skl.h2
-rw-r--r--virt/kvm/arm/vgic.c2
152 files changed, 1608 insertions, 857 deletions
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index 9853f8e70966..28a4781ab6d7 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -40,18 +40,18 @@ Optional properties:
40 40
41Slave Properties: 41Slave Properties:
42Required properties: 42Required properties:
43- phy_id : Specifies slave phy id
44- phy-mode : See ethernet.txt file in the same directory 43- phy-mode : See ethernet.txt file in the same directory
45 44
46Optional properties: 45Optional properties:
47- 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
48- 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
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 properties phy_id and phy-mode, 53 Either the property phy_id, or the sub-node
54 or the sub-node fixed-link can be specified 54 fixed-link can 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/Makefile b/Makefile
index 4e2b18d56091..9d94adeceab6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 4 2PATCHLEVEL = 4
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc8
5NAME = Blurry Fish Butt 5NAME = Blurry Fish Butt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index cf0cf34eeb24..aeb19021099e 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -81,7 +81,7 @@ endif
81LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name) 81LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
82 82
83# Modules with short calls might break for calls into builtin-kernel 83# Modules with short calls might break for calls into builtin-kernel
84KBUILD_CFLAGS_MODULE += -mlong-calls 84KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
85 85
86# Finally dump eveything into kernel build system 86# Finally dump eveything into kernel build system
87KBUILD_CFLAGS += $(cflags-y) 87KBUILD_CFLAGS += $(cflags-y)
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index abf06e81c929..210ef3e72332 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -62,9 +62,7 @@ extern int ioc_exists;
62#define ARC_REG_IC_IVIC 0x10 62#define ARC_REG_IC_IVIC 0x10
63#define ARC_REG_IC_CTRL 0x11 63#define ARC_REG_IC_CTRL 0x11
64#define ARC_REG_IC_IVIL 0x19 64#define ARC_REG_IC_IVIL 0x19
65#if defined(CONFIG_ARC_MMU_V3) || defined(CONFIG_ARC_MMU_V4)
66#define ARC_REG_IC_PTAG 0x1E 65#define ARC_REG_IC_PTAG 0x1E
67#endif
68#define ARC_REG_IC_PTAG_HI 0x1F 66#define ARC_REG_IC_PTAG_HI 0x1F
69 67
70/* Bit val in IC_CTRL */ 68/* Bit val in IC_CTRL */
diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index cf2828ab0905..5eb707640e9c 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -293,13 +293,13 @@ static void init_unwind_hdr(struct unwind_table *table,
293 const u32 *cie = cie_for_fde(fde, table); 293 const u32 *cie = cie_for_fde(fde, table);
294 signed ptrType; 294 signed ptrType;
295 295
296 if (cie == &not_fde) /* only process FDE here */ 296 if (cie == &not_fde)
297 continue; 297 continue;
298 if (cie == NULL || cie == &bad_cie) 298 if (cie == NULL || cie == &bad_cie)
299 continue; /* say FDE->CIE.version != 1 */ 299 goto ret_err;
300 ptrType = fde_pointer_type(cie); 300 ptrType = fde_pointer_type(cie);
301 if (ptrType < 0) 301 if (ptrType < 0)
302 continue; 302 goto ret_err;
303 303
304 ptr = (const u8 *)(fde + 2); 304 ptr = (const u8 *)(fde + 2);
305 if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde, 305 if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde,
@@ -315,14 +315,14 @@ static void init_unwind_hdr(struct unwind_table *table,
315 } 315 }
316 316
317 if (tableSize || !n) 317 if (tableSize || !n)
318 return; 318 goto ret_err;
319 319
320 hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int) 320 hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int)
321 + 2 * n * sizeof(unsigned long); 321 + 2 * n * sizeof(unsigned long);
322 322
323 header = alloc(hdrSize); 323 header = alloc(hdrSize);
324 if (!header) 324 if (!header)
325 return; 325 goto ret_err;
326 326
327 header->version = 1; 327 header->version = 1;
328 header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native; 328 header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native;
@@ -343,10 +343,6 @@ static void init_unwind_hdr(struct unwind_table *table,
343 343
344 if (fde[1] == 0xffffffff) 344 if (fde[1] == 0xffffffff)
345 continue; /* this is a CIE */ 345 continue; /* this is a CIE */
346
347 if (*(u8 *)(cie + 2) != 1)
348 continue; /* FDE->CIE.version not supported */
349
350 ptr = (const u8 *)(fde + 2); 346 ptr = (const u8 *)(fde + 2);
351 header->table[n].start = read_pointer(&ptr, 347 header->table[n].start = read_pointer(&ptr,
352 (const u8 *)(fde + 1) + 348 (const u8 *)(fde + 1) +
@@ -365,6 +361,10 @@ static void init_unwind_hdr(struct unwind_table *table,
365 table->hdrsz = hdrSize; 361 table->hdrsz = hdrSize;
366 smp_wmb(); 362 smp_wmb();
367 table->header = (const void *)header; 363 table->header = (const void *)header;
364 return;
365
366ret_err:
367 panic("Attention !!! Dwarf FDE parsing errors\n");;
368} 368}
369 369
370#ifdef CONFIG_MODULES 370#ifdef CONFIG_MODULES
@@ -523,8 +523,7 @@ static const u32 *cie_for_fde(const u32 *fde, const struct unwind_table *table)
523 523
524 if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde) 524 if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde)
525 || (*cie & (sizeof(*cie) - 1)) 525 || (*cie & (sizeof(*cie) - 1))
526 || (cie[1] != 0xffffffff) 526 || (cie[1] != 0xffffffff))
527 || ( *(u8 *)(cie + 2) != 1)) /* version 1 supported */
528 return NULL; /* this is not a (valid) CIE */ 527 return NULL; /* this is not a (valid) CIE */
529 return cie; 528 return cie;
530} 529}
@@ -605,9 +604,6 @@ static signed fde_pointer_type(const u32 *cie)
605 const u8 *ptr = (const u8 *)(cie + 2); 604 const u8 *ptr = (const u8 *)(cie + 2);
606 unsigned version = *ptr; 605 unsigned version = *ptr;
607 606
608 if (version != 1)
609 return -1; /* unsupported */
610
611 if (*++ptr) { 607 if (*++ptr) {
612 const char *aug; 608 const char *aug;
613 const u8 *end = (const u8 *)(cie + 1) + *cie; 609 const u8 *end = (const u8 *)(cie + 1) + *cie;
@@ -1019,9 +1015,7 @@ int arc_unwind(struct unwind_frame_info *frame)
1019 ptr = (const u8 *)(cie + 2); 1015 ptr = (const u8 *)(cie + 2);
1020 end = (const u8 *)(cie + 1) + *cie; 1016 end = (const u8 *)(cie + 1) + *cie;
1021 frame->call_frame = 1; 1017 frame->call_frame = 1;
1022 if ((state.version = *ptr) != 1) 1018 if (*++ptr) {
1023 cie = NULL; /* unsupported version */
1024 else if (*++ptr) {
1025 /* check if augmentation size is first (thus present) */ 1019 /* check if augmentation size is first (thus present) */
1026 if (*ptr == 'z') { 1020 if (*ptr == 'z') {
1027 while (++ptr < end && *ptr) { 1021 while (++ptr < end && *ptr) {
diff --git a/arch/arc/mm/highmem.c b/arch/arc/mm/highmem.c
index 065ee6bfa82a..92dd92cad7f9 100644
--- a/arch/arc/mm/highmem.c
+++ b/arch/arc/mm/highmem.c
@@ -111,7 +111,7 @@ void __kunmap_atomic(void *kv)
111} 111}
112EXPORT_SYMBOL(__kunmap_atomic); 112EXPORT_SYMBOL(__kunmap_atomic);
113 113
114noinline pte_t *alloc_kmap_pgtable(unsigned long kvaddr) 114static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr)
115{ 115{
116 pgd_t *pgd_k; 116 pgd_t *pgd_k;
117 pud_t *pud_k; 117 pud_t *pud_k;
@@ -127,7 +127,7 @@ noinline pte_t *alloc_kmap_pgtable(unsigned long kvaddr)
127 return pte_k; 127 return pte_k;
128} 128}
129 129
130void kmap_init(void) 130void __init kmap_init(void)
131{ 131{
132 /* Due to recursive include hell, we can't do this in processor.h */ 132 /* Due to recursive include hell, we can't do this in processor.h */
133 BUILD_BUG_ON(PAGE_OFFSET < (VMALLOC_END + FIXMAP_SIZE + PKMAP_SIZE)); 133 BUILD_BUG_ON(PAGE_OFFSET < (VMALLOC_END + FIXMAP_SIZE + PKMAP_SIZE));
diff --git a/arch/arm/boot/dts/imx6q-gw5400-a.dts b/arch/arm/boot/dts/imx6q-gw5400-a.dts
index 58adf176425a..a51834e1dd27 100644
--- a/arch/arm/boot/dts/imx6q-gw5400-a.dts
+++ b/arch/arm/boot/dts/imx6q-gw5400-a.dts
@@ -154,7 +154,7 @@
154&fec { 154&fec {
155 pinctrl-names = "default"; 155 pinctrl-names = "default";
156 pinctrl-0 = <&pinctrl_enet>; 156 pinctrl-0 = <&pinctrl_enet>;
157 phy-mode = "rgmii"; 157 phy-mode = "rgmii-id";
158 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; 158 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
159 status = "okay"; 159 status = "okay";
160}; 160};
diff --git a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
index 7b31fdb79ced..dc0cebfe22d7 100644
--- a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
@@ -94,7 +94,7 @@
94&fec { 94&fec {
95 pinctrl-names = "default"; 95 pinctrl-names = "default";
96 pinctrl-0 = <&pinctrl_enet>; 96 pinctrl-0 = <&pinctrl_enet>;
97 phy-mode = "rgmii"; 97 phy-mode = "rgmii-id";
98 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; 98 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
99 status = "okay"; 99 status = "okay";
100}; 100};
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
index 1b66328a8498..18cd4114a23e 100644
--- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
@@ -154,7 +154,7 @@
154&fec { 154&fec {
155 pinctrl-names = "default"; 155 pinctrl-names = "default";
156 pinctrl-0 = <&pinctrl_enet>; 156 pinctrl-0 = <&pinctrl_enet>;
157 phy-mode = "rgmii"; 157 phy-mode = "rgmii-id";
158 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; 158 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
159 status = "okay"; 159 status = "okay";
160}; 160};
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
index 7c51839ff934..eea90f37bbb8 100644
--- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
@@ -155,7 +155,7 @@
155&fec { 155&fec {
156 pinctrl-names = "default"; 156 pinctrl-names = "default";
157 pinctrl-0 = <&pinctrl_enet>; 157 pinctrl-0 = <&pinctrl_enet>;
158 phy-mode = "rgmii"; 158 phy-mode = "rgmii-id";
159 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; 159 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
160 status = "okay"; 160 status = "okay";
161}; 161};
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
index 929e0b37bd9e..6c11a2ae35ef 100644
--- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
@@ -145,7 +145,7 @@
145&fec { 145&fec {
146 pinctrl-names = "default"; 146 pinctrl-names = "default";
147 pinctrl-0 = <&pinctrl_enet>; 147 pinctrl-0 = <&pinctrl_enet>;
148 phy-mode = "rgmii"; 148 phy-mode = "rgmii-id";
149 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>; 149 phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
150 status = "okay"; 150 status = "okay";
151}; 151};
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 8263fc18a7d9..d354d406954d 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -113,14 +113,14 @@
113&clks { 113&clks {
114 assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>, 114 assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>,
115 <&clks IMX6QDL_PLL4_BYPASS>, 115 <&clks IMX6QDL_PLL4_BYPASS>,
116 <&clks IMX6QDL_CLK_PLL4_POST_DIV>,
117 <&clks IMX6QDL_CLK_LDB_DI0_SEL>, 116 <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
118 <&clks IMX6QDL_CLK_LDB_DI1_SEL>; 117 <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
118 <&clks IMX6QDL_CLK_PLL4_POST_DIV>;
119 assigned-clock-parents = <&clks IMX6QDL_CLK_LVDS2_IN>, 119 assigned-clock-parents = <&clks IMX6QDL_CLK_LVDS2_IN>,
120 <&clks IMX6QDL_PLL4_BYPASS_SRC>, 120 <&clks IMX6QDL_PLL4_BYPASS_SRC>,
121 <&clks IMX6QDL_CLK_PLL3_USB_OTG>, 121 <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
122 <&clks IMX6QDL_CLK_PLL3_USB_OTG>; 122 <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
123 assigned-clock-rates = <0>, <0>, <24576000>; 123 assigned-clock-rates = <0>, <0>, <0>, <0>, <24576000>;
124}; 124};
125 125
126&ecspi1 { 126&ecspi1 {
diff --git a/arch/arm/boot/dts/omap4-duovero-parlor.dts b/arch/arm/boot/dts/omap4-duovero-parlor.dts
index 1a78f013f37a..b75f7b2b7c4a 100644
--- a/arch/arm/boot/dts/omap4-duovero-parlor.dts
+++ b/arch/arm/boot/dts/omap4-duovero-parlor.dts
@@ -189,3 +189,7 @@
189 }; 189 };
190}; 190};
191 191
192&uart3 {
193 interrupts-extended = <&wakeupgen GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH
194 &omap4_pmx_core OMAP4_UART3_RX>;
195};
diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
index 2d4250b1faf8..68b479b8772c 100644
--- a/arch/arm/boot/dts/sun6i-a31s-primo81.dts
+++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts
@@ -83,6 +83,7 @@
83 reg = <0x5d>; 83 reg = <0x5d>;
84 interrupt-parent = <&pio>; 84 interrupt-parent = <&pio>;
85 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; /* PA3 */ 85 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; /* PA3 */
86 touchscreen-swapped-x-y;
86 }; 87 };
87}; 88};
88 89
diff --git a/arch/arm/boot/dts/tegra124-nyan.dtsi b/arch/arm/boot/dts/tegra124-nyan.dtsi
index 40c23a0b7cfc..ec1aa64ded68 100644
--- a/arch/arm/boot/dts/tegra124-nyan.dtsi
+++ b/arch/arm/boot/dts/tegra124-nyan.dtsi
@@ -399,7 +399,7 @@
399 399
400 /* CPU DFLL clock */ 400 /* CPU DFLL clock */
401 clock@0,70110000 { 401 clock@0,70110000 {
402 status = "okay"; 402 status = "disabled";
403 vdd-cpu-supply = <&vdd_cpu>; 403 vdd-cpu-supply = <&vdd_cpu>;
404 nvidia,i2c-fs-rate = <400000>; 404 nvidia,i2c-fs-rate = <400000>;
405 }; 405 };
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index b83f3b7737fb..087acb569b63 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -193,15 +193,44 @@ struct oabi_flock64 {
193 pid_t l_pid; 193 pid_t l_pid;
194} __attribute__ ((packed,aligned(4))); 194} __attribute__ ((packed,aligned(4)));
195 195
196asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd, 196static long do_locks(unsigned int fd, unsigned int cmd,
197 unsigned long arg) 197 unsigned long arg)
198{ 198{
199 struct oabi_flock64 user;
200 struct flock64 kernel; 199 struct flock64 kernel;
201 mm_segment_t fs = USER_DS; /* initialized to kill a warning */ 200 struct oabi_flock64 user;
202 unsigned long local_arg = arg; 201 mm_segment_t fs;
203 int ret; 202 long ret;
203
204 if (copy_from_user(&user, (struct oabi_flock64 __user *)arg,
205 sizeof(user)))
206 return -EFAULT;
207 kernel.l_type = user.l_type;
208 kernel.l_whence = user.l_whence;
209 kernel.l_start = user.l_start;
210 kernel.l_len = user.l_len;
211 kernel.l_pid = user.l_pid;
212
213 fs = get_fs();
214 set_fs(KERNEL_DS);
215 ret = sys_fcntl64(fd, cmd, (unsigned long)&kernel);
216 set_fs(fs);
217
218 if (!ret && (cmd == F_GETLK64 || cmd == F_OFD_GETLK)) {
219 user.l_type = kernel.l_type;
220 user.l_whence = kernel.l_whence;
221 user.l_start = kernel.l_start;
222 user.l_len = kernel.l_len;
223 user.l_pid = kernel.l_pid;
224 if (copy_to_user((struct oabi_flock64 __user *)arg,
225 &user, sizeof(user)))
226 ret = -EFAULT;
227 }
228 return ret;
229}
204 230
231asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,
232 unsigned long arg)
233{
205 switch (cmd) { 234 switch (cmd) {
206 case F_OFD_GETLK: 235 case F_OFD_GETLK:
207 case F_OFD_SETLK: 236 case F_OFD_SETLK:
@@ -209,39 +238,11 @@ asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,
209 case F_GETLK64: 238 case F_GETLK64:
210 case F_SETLK64: 239 case F_SETLK64:
211 case F_SETLKW64: 240 case F_SETLKW64:
212 if (copy_from_user(&user, (struct oabi_flock64 __user *)arg, 241 return do_locks(fd, cmd, arg);
213 sizeof(user)))
214 return -EFAULT;
215 kernel.l_type = user.l_type;
216 kernel.l_whence = user.l_whence;
217 kernel.l_start = user.l_start;
218 kernel.l_len = user.l_len;
219 kernel.l_pid = user.l_pid;
220 local_arg = (unsigned long)&kernel;
221 fs = get_fs();
222 set_fs(KERNEL_DS);
223 }
224
225 ret = sys_fcntl64(fd, cmd, local_arg);
226 242
227 switch (cmd) { 243 default:
228 case F_GETLK64: 244 return sys_fcntl64(fd, cmd, arg);
229 if (!ret) {
230 user.l_type = kernel.l_type;
231 user.l_whence = kernel.l_whence;
232 user.l_start = kernel.l_start;
233 user.l_len = kernel.l_len;
234 user.l_pid = kernel.l_pid;
235 if (copy_to_user((struct oabi_flock64 __user *)arg,
236 &user, sizeof(user)))
237 ret = -EFAULT;
238 }
239 case F_SETLK64:
240 case F_SETLKW64:
241 set_fs(fs);
242 } 245 }
243
244 return ret;
245} 246}
246 247
247struct oabi_epoll_event { 248struct oabi_epoll_event {
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4b4371db5799..0517f0c1581a 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -65,6 +65,8 @@ config SOC_AM43XX
65 select MACH_OMAP_GENERIC 65 select MACH_OMAP_GENERIC
66 select MIGHT_HAVE_CACHE_L2X0 66 select MIGHT_HAVE_CACHE_L2X0
67 select HAVE_ARM_SCU 67 select HAVE_ARM_SCU
68 select GENERIC_CLOCKEVENTS_BROADCAST
69 select HAVE_ARM_TWD
68 70
69config SOC_DRA7XX 71config SOC_DRA7XX
70 bool "TI DRA7XX" 72 bool "TI DRA7XX"
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index b18ebbefae09..f86692dbcfd5 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -320,6 +320,12 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
320 return r; 320 return r;
321} 321}
322 322
323#if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
324void tick_broadcast(const struct cpumask *mask)
325{
326}
327#endif
328
323static void __init omap2_gp_clockevent_init(int gptimer_id, 329static void __init omap2_gp_clockevent_init(int gptimer_id,
324 const char *fck_source, 330 const char *fck_source,
325 const char *property) 331 const char *property)
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index fd104bd221ce..860e440611c9 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -3,6 +3,7 @@ generic-y += clkdev.h
3generic-y += cputime.h 3generic-y += cputime.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += irq_work.h 5generic-y += irq_work.h
6generic-y += kvm_para.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
7generic-y += mm-arch-hooks.h 8generic-y += mm-arch-hooks.h
8generic-y += module.h 9generic-y += module.h
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 61b8931bc192..4b0f5e001d4d 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -168,13 +168,21 @@ static inline void _writel(unsigned long l, unsigned long addr)
168#define writew_relaxed writew 168#define writew_relaxed writew
169#define writel_relaxed writel 169#define writel_relaxed writel
170 170
171#define ioread8 read 171#define ioread8 readb
172#define ioread16 readw 172#define ioread16 readw
173#define ioread32 readl 173#define ioread32 readl
174#define iowrite8 writeb 174#define iowrite8 writeb
175#define iowrite16 writew 175#define iowrite16 writew
176#define iowrite32 writel 176#define iowrite32 writel
177 177
178#define ioread8_rep(p, dst, count) insb((unsigned long)(p), (dst), (count))
179#define ioread16_rep(p, dst, count) insw((unsigned long)(p), (dst), (count))
180#define ioread32_rep(p, dst, count) insl((unsigned long)(p), (dst), (count))
181
182#define iowrite8_rep(p, src, count) outsb((unsigned long)(p), (src), (count))
183#define iowrite16_rep(p, src, count) outsw((unsigned long)(p), (src), (count))
184#define iowrite32_rep(p, src, count) outsl((unsigned long)(p), (src), (count))
185
178#define ioread16be(addr) be16_to_cpu(readw(addr)) 186#define ioread16be(addr) be16_to_cpu(readw(addr))
179#define ioread32be(addr) be32_to_cpu(readl(addr)) 187#define ioread32be(addr) be32_to_cpu(readl(addr))
180#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr)) 188#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr))
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index 5305d694ffe5..095ecafe6bd3 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -599,7 +599,7 @@ extern void __put_user_unknown(void);
599 * On error, the variable @x is set to zero. 599 * On error, the variable @x is set to zero.
600 */ 600 */
601#define __get_user_unaligned(x,ptr) \ 601#define __get_user_unaligned(x,ptr) \
602 __get_user__unalignednocheck((x),(ptr),sizeof(*(ptr))) 602 __get_user_unaligned_nocheck((x),(ptr),sizeof(*(ptr)))
603 603
604/* 604/*
605 * Yuck. We need two variants, one for 64bit operation and one 605 * Yuck. We need two variants, one for 64bit operation and one
@@ -620,8 +620,8 @@ extern void __get_user_unaligned_unknown(void);
620do { \ 620do { \
621 switch (size) { \ 621 switch (size) { \
622 case 1: __get_data_asm(val, "lb", ptr); break; \ 622 case 1: __get_data_asm(val, "lb", ptr); break; \
623 case 2: __get_user_unaligned_asm(val, "ulh", ptr); break; \ 623 case 2: __get_data_unaligned_asm(val, "ulh", ptr); break; \
624 case 4: __get_user_unaligned_asm(val, "ulw", ptr); break; \ 624 case 4: __get_data_unaligned_asm(val, "ulw", ptr); break; \
625 case 8: __GET_USER_UNALIGNED_DW(val, ptr); break; \ 625 case 8: __GET_USER_UNALIGNED_DW(val, ptr); break; \
626 default: __get_user_unaligned_unknown(); break; \ 626 default: __get_user_unaligned_unknown(); break; \
627 } \ 627 } \
@@ -1122,9 +1122,15 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
1122 __cu_to = (to); \ 1122 __cu_to = (to); \
1123 __cu_from = (from); \ 1123 __cu_from = (from); \
1124 __cu_len = (n); \ 1124 __cu_len = (n); \
1125 might_fault(); \ 1125 if (eva_kernel_access()) { \
1126 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \ 1126 __cu_len = __invoke_copy_from_kernel(__cu_to, \
1127 __cu_len); \ 1127 __cu_from, \
1128 __cu_len); \
1129 } else { \
1130 might_fault(); \
1131 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
1132 __cu_len); \
1133 } \
1128 __cu_len; \ 1134 __cu_len; \
1129}) 1135})
1130 1136
@@ -1229,16 +1235,28 @@ __clear_user(void __user *addr, __kernel_size_t size)
1229{ 1235{
1230 __kernel_size_t res; 1236 __kernel_size_t res;
1231 1237
1232 might_fault(); 1238 if (eva_kernel_access()) {
1233 __asm__ __volatile__( 1239 __asm__ __volatile__(
1234 "move\t$4, %1\n\t" 1240 "move\t$4, %1\n\t"
1235 "move\t$5, $0\n\t" 1241 "move\t$5, $0\n\t"
1236 "move\t$6, %2\n\t" 1242 "move\t$6, %2\n\t"
1237 __MODULE_JAL(__bzero) 1243 __MODULE_JAL(__bzero_kernel)
1238 "move\t%0, $6" 1244 "move\t%0, $6"
1239 : "=r" (res) 1245 : "=r" (res)
1240 : "r" (addr), "r" (size) 1246 : "r" (addr), "r" (size)
1241 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"); 1247 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
1248 } else {
1249 might_fault();
1250 __asm__ __volatile__(
1251 "move\t$4, %1\n\t"
1252 "move\t$5, $0\n\t"
1253 "move\t$6, %2\n\t"
1254 __MODULE_JAL(__bzero)
1255 "move\t%0, $6"
1256 : "=r" (res)
1257 : "r" (addr), "r" (size)
1258 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
1259 }
1242 1260
1243 return res; 1261 return res;
1244} 1262}
@@ -1384,7 +1402,7 @@ static inline long strlen_user(const char __user *s)
1384 might_fault(); 1402 might_fault();
1385 __asm__ __volatile__( 1403 __asm__ __volatile__(
1386 "move\t$4, %1\n\t" 1404 "move\t$4, %1\n\t"
1387 __MODULE_JAL(__strlen_kernel_asm) 1405 __MODULE_JAL(__strlen_user_asm)
1388 "move\t%0, $2" 1406 "move\t%0, $2"
1389 : "=r" (res) 1407 : "=r" (res)
1390 : "r" (s) 1408 : "r" (s)
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index 8fd5a276cad2..ac81edd44563 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -257,7 +257,6 @@ LEAF(mips_cps_core_init)
257 has_mt t0, 3f 257 has_mt t0, 3f
258 258
259 .set push 259 .set push
260 .set mips64r2
261 .set mt 260 .set mt
262 261
263 /* Only allow 1 TC per VPE to execute... */ 262 /* Only allow 1 TC per VPE to execute... */
@@ -376,7 +375,6 @@ LEAF(mips_cps_boot_vpes)
376 nop 375 nop
377 376
378 .set push 377 .set push
379 .set mips64r2
380 .set mt 378 .set mt
381 379
3821: /* Enter VPE configuration state */ 3801: /* Enter VPE configuration state */
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 291af0b5c482..e2b6ab74643d 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -17,6 +17,7 @@
17#include <asm/fpu.h> 17#include <asm/fpu.h>
18#include <asm/msa.h> 18#include <asm/msa.h>
19 19
20extern void *__bzero_kernel(void *__s, size_t __count);
20extern void *__bzero(void *__s, size_t __count); 21extern void *__bzero(void *__s, size_t __count);
21extern long __strncpy_from_kernel_nocheck_asm(char *__to, 22extern long __strncpy_from_kernel_nocheck_asm(char *__to,
22 const char *__from, long __len); 23 const char *__from, long __len);
@@ -64,6 +65,7 @@ EXPORT_SYMBOL(__copy_from_user_eva);
64EXPORT_SYMBOL(__copy_in_user_eva); 65EXPORT_SYMBOL(__copy_in_user_eva);
65EXPORT_SYMBOL(__copy_to_user_eva); 66EXPORT_SYMBOL(__copy_to_user_eva);
66EXPORT_SYMBOL(__copy_user_inatomic_eva); 67EXPORT_SYMBOL(__copy_user_inatomic_eva);
68EXPORT_SYMBOL(__bzero_kernel);
67#endif 69#endif
68EXPORT_SYMBOL(__bzero); 70EXPORT_SYMBOL(__bzero);
69EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm); 71EXPORT_SYMBOL(__strncpy_from_kernel_nocheck_asm);
diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S
index b8e63fd00375..8f0019a2e5c8 100644
--- a/arch/mips/lib/memset.S
+++ b/arch/mips/lib/memset.S
@@ -283,6 +283,8 @@ LEAF(memset)
2831: 2831:
284#ifndef CONFIG_EVA 284#ifndef CONFIG_EVA
285FEXPORT(__bzero) 285FEXPORT(__bzero)
286#else
287FEXPORT(__bzero_kernel)
286#endif 288#endif
287 __BUILD_BZERO LEGACY_MODE 289 __BUILD_BZERO LEGACY_MODE
288 290
diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c
index dbbeccc3d714..a245cad4372a 100644
--- a/arch/mips/pci/pci-rt2880.c
+++ b/arch/mips/pci/pci-rt2880.c
@@ -221,7 +221,6 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
221static int rt288x_pci_probe(struct platform_device *pdev) 221static int rt288x_pci_probe(struct platform_device *pdev)
222{ 222{
223 void __iomem *io_map_base; 223 void __iomem *io_map_base;
224 int i;
225 224
226 rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE); 225 rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE);
227 226
diff --git a/arch/mips/pmcs-msp71xx/msp_setup.c b/arch/mips/pmcs-msp71xx/msp_setup.c
index 78b2ef49dbc7..9d293b3e9130 100644
--- a/arch/mips/pmcs-msp71xx/msp_setup.c
+++ b/arch/mips/pmcs-msp71xx/msp_setup.c
@@ -39,7 +39,6 @@ extern void msp_serial_setup(void);
39void msp7120_reset(void) 39void msp7120_reset(void)
40{ 40{
41 void *start, *end, *iptr; 41 void *start, *end, *iptr;
42 register int i;
43 42
44 /* Diasble all interrupts */ 43 /* Diasble all interrupts */
45 local_irq_disable(); 44 local_irq_disable();
diff --git a/arch/mips/sni/reset.c b/arch/mips/sni/reset.c
index db8f88b6a3af..6afa34346b81 100644
--- a/arch/mips/sni/reset.c
+++ b/arch/mips/sni/reset.c
@@ -26,7 +26,7 @@ static inline void kb_wait(void)
26/* XXX This ends up at the ARC firmware prompt ... */ 26/* XXX This ends up at the ARC firmware prompt ... */
27void sni_machine_restart(char *command) 27void sni_machine_restart(char *command)
28{ 28{
29 int i, j; 29 int i;
30 30
31 /* This does a normal via the keyboard controller like a PC. 31 /* This does a normal via the keyboard controller like a PC.
32 We can do that easier ... */ 32 We can do that easier ... */
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index ef5f348f386a..14568900fc1d 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -26,8 +26,8 @@ aflags-vdso := $(ccflags-vdso) \
26# the comments on that file. 26# the comments on that file.
27# 27#
28ifndef CONFIG_CPU_MIPSR6 28ifndef CONFIG_CPU_MIPSR6
29 ifeq ($(call ld-ifversion, -gt, 22400000, y),) 29 ifeq ($(call ld-ifversion, -lt, 22500000, y),y)
30 $(warning MIPS VDSO requires binutils > 2.24) 30 $(warning MIPS VDSO requires binutils >= 2.25)
31 obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) 31 obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y))
32 ccflags-vdso += -DDISABLE_MIPS_VDSO 32 ccflags-vdso += -DDISABLE_MIPS_VDSO
33 endif 33 endif
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index dc1ea796fd60..2264f68f3c2f 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -435,6 +435,55 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs, int in_syscall)
435 regs->gr[28]); 435 regs->gr[28]);
436} 436}
437 437
438/*
439 * Check how the syscall number gets loaded into %r20 within
440 * the delay branch in userspace and adjust as needed.
441 */
442
443static void check_syscallno_in_delay_branch(struct pt_regs *regs)
444{
445 u32 opcode, source_reg;
446 u32 __user *uaddr;
447 int err;
448
449 /* Usually we don't have to restore %r20 (the system call number)
450 * because it gets loaded in the delay slot of the branch external
451 * instruction via the ldi instruction.
452 * In some cases a register-to-register copy instruction might have
453 * been used instead, in which case we need to copy the syscall
454 * number into the source register before returning to userspace.
455 */
456
457 /* A syscall is just a branch, so all we have to do is fiddle the
458 * return pointer so that the ble instruction gets executed again.
459 */
460 regs->gr[31] -= 8; /* delayed branching */
461
462 /* Get assembler opcode of code in delay branch */
463 uaddr = (unsigned int *) ((regs->gr[31] & ~3) + 4);
464 err = get_user(opcode, uaddr);
465 if (err)
466 return;
467
468 /* Check if delay branch uses "ldi int,%r20" */
469 if ((opcode & 0xffff0000) == 0x34140000)
470 return; /* everything ok, just return */
471
472 /* Check if delay branch uses "nop" */
473 if (opcode == INSN_NOP)
474 return;
475
476 /* Check if delay branch uses "copy %rX,%r20" */
477 if ((opcode & 0xffe0ffff) == 0x08000254) {
478 source_reg = (opcode >> 16) & 31;
479 regs->gr[source_reg] = regs->gr[20];
480 return;
481 }
482
483 pr_warn("syscall restart: %s (pid %d): unexpected opcode 0x%08x\n",
484 current->comm, task_pid_nr(current), opcode);
485}
486
438static inline void 487static inline void
439syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) 488syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
440{ 489{
@@ -457,10 +506,7 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
457 } 506 }
458 /* fallthrough */ 507 /* fallthrough */
459 case -ERESTARTNOINTR: 508 case -ERESTARTNOINTR:
460 /* A syscall is just a branch, so all 509 check_syscallno_in_delay_branch(regs);
461 * we have to do is fiddle the return pointer.
462 */
463 regs->gr[31] -= 8; /* delayed branching */
464 break; 510 break;
465 } 511 }
466} 512}
@@ -510,15 +556,9 @@ insert_restart_trampoline(struct pt_regs *regs)
510 } 556 }
511 case -ERESTARTNOHAND: 557 case -ERESTARTNOHAND:
512 case -ERESTARTSYS: 558 case -ERESTARTSYS:
513 case -ERESTARTNOINTR: { 559 case -ERESTARTNOINTR:
514 /* Hooray for delayed branching. We don't 560 check_syscallno_in_delay_branch(regs);
515 * have to restore %r20 (the system call
516 * number) because it gets loaded in the delay
517 * slot of the branch external instruction.
518 */
519 regs->gr[31] -= 8;
520 return; 561 return;
521 }
522 default: 562 default:
523 break; 563 break;
524 } 564 }
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 54b45b73195f..a7352b59e6f9 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -224,6 +224,12 @@ static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu)
224 224
225static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) 225static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr)
226{ 226{
227 /*
228 * Check for illegal transactional state bit combination
229 * and if we find it, force the TS field to a safe state.
230 */
231 if ((msr & MSR_TS_MASK) == MSR_TS_MASK)
232 msr &= ~MSR_TS_MASK;
227 vcpu->arch.shregs.msr = msr; 233 vcpu->arch.shregs.msr = msr;
228 kvmppc_end_cede(vcpu); 234 kvmppc_end_cede(vcpu);
229} 235}
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 8140d10c6785..6e72961608f0 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -1920,16 +1920,23 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
1920 } 1920 }
1921 if (separator) 1921 if (separator)
1922 ptr += sprintf(ptr, "%c", separator); 1922 ptr += sprintf(ptr, "%c", separator);
1923 /*
1924 * Use four '%' characters below because of the
1925 * following two conversions:
1926 *
1927 * 1) sprintf: %%%%r -> %%r
1928 * 2) printk : %%r -> %r
1929 */
1923 if (operand->flags & OPERAND_GPR) 1930 if (operand->flags & OPERAND_GPR)
1924 ptr += sprintf(ptr, "%%r%i", value); 1931 ptr += sprintf(ptr, "%%%%r%i", value);
1925 else if (operand->flags & OPERAND_FPR) 1932 else if (operand->flags & OPERAND_FPR)
1926 ptr += sprintf(ptr, "%%f%i", value); 1933 ptr += sprintf(ptr, "%%%%f%i", value);
1927 else if (operand->flags & OPERAND_AR) 1934 else if (operand->flags & OPERAND_AR)
1928 ptr += sprintf(ptr, "%%a%i", value); 1935 ptr += sprintf(ptr, "%%%%a%i", value);
1929 else if (operand->flags & OPERAND_CR) 1936 else if (operand->flags & OPERAND_CR)
1930 ptr += sprintf(ptr, "%%c%i", value); 1937 ptr += sprintf(ptr, "%%%%c%i", value);
1931 else if (operand->flags & OPERAND_VR) 1938 else if (operand->flags & OPERAND_VR)
1932 ptr += sprintf(ptr, "%%v%i", value); 1939 ptr += sprintf(ptr, "%%%%v%i", value);
1933 else if (operand->flags & OPERAND_PCREL) 1940 else if (operand->flags & OPERAND_PCREL)
1934 ptr += sprintf(ptr, "%lx", (signed int) value 1941 ptr += sprintf(ptr, "%lx", (signed int) value
1935 + addr); 1942 + addr);
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 370ca1e71ffb..93310837c2df 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -95,6 +95,7 @@
95 * really available. So we simply advertise only "crypto" support. 95 * really available. So we simply advertise only "crypto" support.
96 */ 96 */
97#define HWCAP_SPARC_CRYPTO 0x04000000 /* CRYPTO insns available */ 97#define HWCAP_SPARC_CRYPTO 0x04000000 /* CRYPTO insns available */
98#define HWCAP_SPARC_ADI 0x08000000 /* ADI available */
98 99
99#define CORE_DUMP_USE_REGSET 100#define CORE_DUMP_USE_REGSET
100 101
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index efe9479f837b..1c26d440d288 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -417,8 +417,13 @@
417#define __NR_bpf 349 417#define __NR_bpf 349
418#define __NR_execveat 350 418#define __NR_execveat 350
419#define __NR_membarrier 351 419#define __NR_membarrier 351
420#define __NR_userfaultfd 352
421#define __NR_bind 353
422#define __NR_listen 354
423#define __NR_setsockopt 355
424#define __NR_mlock2 356
420 425
421#define NR_syscalls 352 426#define NR_syscalls 357
422 427
423/* Bitmask values returned from kern_features system call. */ 428/* Bitmask values returned from kern_features system call. */
424#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 429#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 3d61fcae7ee3..f2d30cab5b3f 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -946,6 +946,12 @@ ENTRY(__retl_one)
946 mov 1, %o0 946 mov 1, %o0
947ENDPROC(__retl_one) 947ENDPROC(__retl_one)
948 948
949ENTRY(__retl_one_fp)
950 VISExitHalf
951 retl
952 mov 1, %o0
953ENDPROC(__retl_one_fp)
954
949ENTRY(__ret_one_asi) 955ENTRY(__ret_one_asi)
950 wr %g0, ASI_AIUS, %asi 956 wr %g0, ASI_AIUS, %asi
951 ret 957 ret
@@ -958,6 +964,13 @@ ENTRY(__retl_one_asi)
958 mov 1, %o0 964 mov 1, %o0
959ENDPROC(__retl_one_asi) 965ENDPROC(__retl_one_asi)
960 966
967ENTRY(__retl_one_asi_fp)
968 wr %g0, ASI_AIUS, %asi
969 VISExitHalf
970 retl
971 mov 1, %o0
972ENDPROC(__retl_one_asi_fp)
973
961ENTRY(__retl_o1) 974ENTRY(__retl_o1)
962 retl 975 retl
963 mov %o1, %o0 976 mov %o1, %o0
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 3091267c5cc3..6596f66ce112 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1828,11 +1828,18 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1828void 1828void
1829perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) 1829perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1830{ 1830{
1831 u64 saved_fault_address = current_thread_info()->fault_address;
1832 u8 saved_fault_code = get_thread_fault_code();
1833 mm_segment_t old_fs;
1834
1831 perf_callchain_store(entry, regs->tpc); 1835 perf_callchain_store(entry, regs->tpc);
1832 1836
1833 if (!current->mm) 1837 if (!current->mm)
1834 return; 1838 return;
1835 1839
1840 old_fs = get_fs();
1841 set_fs(USER_DS);
1842
1836 flushw_user(); 1843 flushw_user();
1837 1844
1838 pagefault_disable(); 1845 pagefault_disable();
@@ -1843,4 +1850,8 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1843 perf_callchain_user_64(entry, regs); 1850 perf_callchain_user_64(entry, regs);
1844 1851
1845 pagefault_enable(); 1852 pagefault_enable();
1853
1854 set_fs(old_fs);
1855 set_thread_fault_code(saved_fault_code);
1856 current_thread_info()->fault_address = saved_fault_address;
1846} 1857}
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 39f0c662f4c8..d08bdaffdbfc 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -73,7 +73,13 @@ rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
73 andn %l1, %l4, %l1 73 andn %l1, %l4, %l1
74 srl %l4, 20, %l4 74 srl %l4, 20, %l4
75 ba,pt %xcc, rtrap_no_irq_enable 75 ba,pt %xcc, rtrap_no_irq_enable
76 wrpr %l4, %pil 76 nop
77 /* Do not actually set the %pil here. We will do that
78 * below after we clear PSTATE_IE in the %pstate register.
79 * If we re-enable interrupts here, we can recurse down
80 * the hardirq stack potentially endlessly, causing a
81 * stack overflow.
82 */
77 83
78 .align 64 84 .align 64
79 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall 85 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index f7b261749383..f3185e2b028b 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -380,7 +380,8 @@ static const char *hwcaps[] = {
380 */ 380 */
381 "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2", 381 "mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
382 "ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau", 382 "ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
383 "ima", "cspare", "pause", "cbcond", 383 "ima", "cspare", "pause", "cbcond", NULL /*reserved for crypto */,
384 "adp",
384}; 385};
385 386
386static const char *crypto_hwcaps[] = { 387static const char *crypto_hwcaps[] = {
@@ -396,7 +397,7 @@ void cpucap_info(struct seq_file *m)
396 seq_puts(m, "cpucaps\t\t: "); 397 seq_puts(m, "cpucaps\t\t: ");
397 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) { 398 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
398 unsigned long bit = 1UL << i; 399 unsigned long bit = 1UL << i;
399 if (caps & bit) { 400 if (hwcaps[i] && (caps & bit)) {
400 seq_printf(m, "%s%s", 401 seq_printf(m, "%s%s",
401 printed ? "," : "", hwcaps[i]); 402 printed ? "," : "", hwcaps[i]);
402 printed++; 403 printed++;
@@ -450,7 +451,7 @@ static void __init report_hwcaps(unsigned long caps)
450 451
451 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) { 452 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
452 unsigned long bit = 1UL << i; 453 unsigned long bit = 1UL << i;
453 if (caps & bit) 454 if (hwcaps[i] && (caps & bit))
454 report_one_hwcap(&printed, hwcaps[i]); 455 report_one_hwcap(&printed, hwcaps[i]);
455 } 456 }
456 if (caps & HWCAP_SPARC_CRYPTO) 457 if (caps & HWCAP_SPARC_CRYPTO)
@@ -485,7 +486,7 @@ static unsigned long __init mdesc_cpu_hwcap_list(void)
485 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) { 486 for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
486 unsigned long bit = 1UL << i; 487 unsigned long bit = 1UL << i;
487 488
488 if (!strcmp(prop, hwcaps[i])) { 489 if (hwcaps[i] && !strcmp(prop, hwcaps[i])) {
489 caps |= bit; 490 caps |= bit;
490 break; 491 break;
491 } 492 }
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index cc23b62b6e38..e663b6c78de2 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -35,18 +35,18 @@ sys_call_table:
35/*80*/ .long sys_setgroups16, sys_getpgrp, sys_setgroups, sys_setitimer, sys_ftruncate64 35/*80*/ .long sys_setgroups16, sys_getpgrp, sys_setgroups, sys_setitimer, sys_ftruncate64
36/*85*/ .long sys_swapon, sys_getitimer, sys_setuid, sys_sethostname, sys_setgid 36/*85*/ .long sys_swapon, sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
37/*90*/ .long sys_dup2, sys_setfsuid, sys_fcntl, sys_select, sys_setfsgid 37/*90*/ .long sys_dup2, sys_setfsuid, sys_fcntl, sys_select, sys_setfsgid
38/*95*/ .long sys_fsync, sys_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall 38/*95*/ .long sys_fsync, sys_setpriority, sys_socket, sys_connect, sys_accept
39/*100*/ .long sys_getpriority, sys_rt_sigreturn, sys_rt_sigaction, sys_rt_sigprocmask, sys_rt_sigpending 39/*100*/ .long sys_getpriority, sys_rt_sigreturn, sys_rt_sigaction, sys_rt_sigprocmask, sys_rt_sigpending
40/*105*/ .long sys_rt_sigtimedwait, sys_rt_sigqueueinfo, sys_rt_sigsuspend, sys_setresuid, sys_getresuid 40/*105*/ .long sys_rt_sigtimedwait, sys_rt_sigqueueinfo, sys_rt_sigsuspend, sys_setresuid, sys_getresuid
41/*110*/ .long sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall 41/*110*/ .long sys_setresgid, sys_getresgid, sys_setregid, sys_recvmsg, sys_sendmsg
42/*115*/ .long sys_getgroups, sys_gettimeofday, sys_getrusage, sys_nis_syscall, sys_getcwd 42/*115*/ .long sys_getgroups, sys_gettimeofday, sys_getrusage, sys_getsockopt, sys_getcwd
43/*120*/ .long sys_readv, sys_writev, sys_settimeofday, sys_fchown16, sys_fchmod 43/*120*/ .long sys_readv, sys_writev, sys_settimeofday, sys_fchown16, sys_fchmod
44/*125*/ .long sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate 44/*125*/ .long sys_recvfrom, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate
45/*130*/ .long sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall 45/*130*/ .long sys_ftruncate, sys_flock, sys_lstat64, sys_sendto, sys_shutdown
46/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64 46/*135*/ .long sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
47/*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit 47/*140*/ .long sys_sendfile64, sys_getpeername, sys_futex, sys_gettid, sys_getrlimit
48/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write 48/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
49/*150*/ .long sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64 49/*150*/ .long sys_getsockname, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
50/*155*/ .long sys_fcntl64, sys_inotify_rm_watch, sys_statfs, sys_fstatfs, sys_oldumount 50/*155*/ .long sys_fcntl64, sys_inotify_rm_watch, sys_statfs, sys_fstatfs, sys_oldumount
51/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall 51/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
52/*165*/ .long sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr 52/*165*/ .long sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr
@@ -87,4 +87,5 @@ sys_call_table:
87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
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 90/*350*/ .long sys_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
91/*355*/ .long sys_setsockopt, sys_mlock2
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index f229468a7479..1557121f4cdc 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -37,15 +37,15 @@ sys_call_table32:
37/*80*/ .word sys_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64 37/*80*/ .word sys_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64
38 .word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid 38 .word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
39/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid 39/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid
40 .word sys_fsync, sys_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall 40 .word sys_fsync, sys_setpriority, sys_socket, sys_connect, sys_accept
41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending 41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending
42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid 42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid
43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall 43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, compat_sys_recvmsg, compat_sys_sendmsg
44 .word sys_getgroups, compat_sys_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd 44 .word sys_getgroups, compat_sys_gettimeofday, compat_sys_getrusage, compat_sys_getsockopt, sys_getcwd
45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod 45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod
46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate 46 .word sys_recvfrom, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate
47/*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall 47/*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_sendto, sys_shutdown
48 .word sys_nis_syscall, sys_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 48 .word sys_socketpair, sys_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64
49/*140*/ .word sys_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit 49/*140*/ .word sys_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
50 .word compat_sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write 50 .word compat_sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
51/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64 51/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
@@ -88,7 +88,8 @@ sys_call_table32:
88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev 88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
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 91/*350*/ .word sys32_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
92 .word compat_sys_setsockopt, sys_mlock2
92 93
93#endif /* CONFIG_COMPAT */ 94#endif /* CONFIG_COMPAT */
94 95
@@ -168,4 +169,5 @@ sys_call_table:
168 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 169 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
169/*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
170 .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
171/*350*/ .word sys64_execveat, sys_membarrier 172/*350*/ .word sys64_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
173 .word sys_setsockopt, sys_mlock2
diff --git a/arch/sparc/lib/NG2copy_from_user.S b/arch/sparc/lib/NG2copy_from_user.S
index 119ccb9a54f4..d5242b8c4f94 100644
--- a/arch/sparc/lib/NG2copy_from_user.S
+++ b/arch/sparc/lib/NG2copy_from_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_LD_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\
19 .text; \
20 .align 4;
21
14#ifndef ASI_AIUS 22#ifndef ASI_AIUS
15#define ASI_AIUS 0x11 23#define ASI_AIUS 0x11
16#endif 24#endif
diff --git a/arch/sparc/lib/NG2copy_to_user.S b/arch/sparc/lib/NG2copy_to_user.S
index 7fe1ccefd9d0..4e962d993b10 100644
--- a/arch/sparc/lib/NG2copy_to_user.S
+++ b/arch/sparc/lib/NG2copy_to_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_ST_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\
19 .text; \
20 .align 4;
21
14#ifndef ASI_AIUS 22#ifndef ASI_AIUS
15#define ASI_AIUS 0x11 23#define ASI_AIUS 0x11
16#endif 24#endif
diff --git a/arch/sparc/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S
index 30eee6e8a81b..d5f585df2f3f 100644
--- a/arch/sparc/lib/NG2memcpy.S
+++ b/arch/sparc/lib/NG2memcpy.S
@@ -34,10 +34,16 @@
34#ifndef EX_LD 34#ifndef EX_LD
35#define EX_LD(x) x 35#define EX_LD(x) x
36#endif 36#endif
37#ifndef EX_LD_FP
38#define EX_LD_FP(x) x
39#endif
37 40
38#ifndef EX_ST 41#ifndef EX_ST
39#define EX_ST(x) x 42#define EX_ST(x) x
40#endif 43#endif
44#ifndef EX_ST_FP
45#define EX_ST_FP(x) x
46#endif
41 47
42#ifndef EX_RETVAL 48#ifndef EX_RETVAL
43#define EX_RETVAL(x) x 49#define EX_RETVAL(x) x
@@ -134,40 +140,40 @@
134 fsrc2 %x6, %f12; \ 140 fsrc2 %x6, %f12; \
135 fsrc2 %x7, %f14; 141 fsrc2 %x7, %f14;
136#define FREG_LOAD_1(base, x0) \ 142#define FREG_LOAD_1(base, x0) \
137 EX_LD(LOAD(ldd, base + 0x00, %x0)) 143 EX_LD_FP(LOAD(ldd, base + 0x00, %x0))
138#define FREG_LOAD_2(base, x0, x1) \ 144#define FREG_LOAD_2(base, x0, x1) \
139 EX_LD(LOAD(ldd, base + 0x00, %x0)); \ 145 EX_LD_FP(LOAD(ldd, base + 0x00, %x0)); \
140 EX_LD(LOAD(ldd, base + 0x08, %x1)); 146 EX_LD_FP(LOAD(ldd, base + 0x08, %x1));
141#define FREG_LOAD_3(base, x0, x1, x2) \ 147#define FREG_LOAD_3(base, x0, x1, x2) \
142 EX_LD(LOAD(ldd, base + 0x00, %x0)); \ 148 EX_LD_FP(LOAD(ldd, base + 0x00, %x0)); \
143 EX_LD(LOAD(ldd, base + 0x08, %x1)); \ 149 EX_LD_FP(LOAD(ldd, base + 0x08, %x1)); \
144 EX_LD(LOAD(ldd, base + 0x10, %x2)); 150 EX_LD_FP(LOAD(ldd, base + 0x10, %x2));
145#define FREG_LOAD_4(base, x0, x1, x2, x3) \ 151#define FREG_LOAD_4(base, x0, x1, x2, x3) \
146 EX_LD(LOAD(ldd, base + 0x00, %x0)); \ 152 EX_LD_FP(LOAD(ldd, base + 0x00, %x0)); \
147 EX_LD(LOAD(ldd, base + 0x08, %x1)); \ 153 EX_LD_FP(LOAD(ldd, base + 0x08, %x1)); \
148 EX_LD(LOAD(ldd, base + 0x10, %x2)); \ 154 EX_LD_FP(LOAD(ldd, base + 0x10, %x2)); \
149 EX_LD(LOAD(ldd, base + 0x18, %x3)); 155 EX_LD_FP(LOAD(ldd, base + 0x18, %x3));
150#define FREG_LOAD_5(base, x0, x1, x2, x3, x4) \ 156#define FREG_LOAD_5(base, x0, x1, x2, x3, x4) \
151 EX_LD(LOAD(ldd, base + 0x00, %x0)); \ 157 EX_LD_FP(LOAD(ldd, base + 0x00, %x0)); \
152 EX_LD(LOAD(ldd, base + 0x08, %x1)); \ 158 EX_LD_FP(LOAD(ldd, base + 0x08, %x1)); \
153 EX_LD(LOAD(ldd, base + 0x10, %x2)); \ 159 EX_LD_FP(LOAD(ldd, base + 0x10, %x2)); \
154 EX_LD(LOAD(ldd, base + 0x18, %x3)); \ 160 EX_LD_FP(LOAD(ldd, base + 0x18, %x3)); \
155 EX_LD(LOAD(ldd, base + 0x20, %x4)); 161 EX_LD_FP(LOAD(ldd, base + 0x20, %x4));
156#define FREG_LOAD_6(base, x0, x1, x2, x3, x4, x5) \ 162#define FREG_LOAD_6(base, x0, x1, x2, x3, x4, x5) \
157 EX_LD(LOAD(ldd, base + 0x00, %x0)); \ 163 EX_LD_FP(LOAD(ldd, base + 0x00, %x0)); \
158 EX_LD(LOAD(ldd, base + 0x08, %x1)); \ 164 EX_LD_FP(LOAD(ldd, base + 0x08, %x1)); \
159 EX_LD(LOAD(ldd, base + 0x10, %x2)); \ 165 EX_LD_FP(LOAD(ldd, base + 0x10, %x2)); \
160 EX_LD(LOAD(ldd, base + 0x18, %x3)); \ 166 EX_LD_FP(LOAD(ldd, base + 0x18, %x3)); \
161 EX_LD(LOAD(ldd, base + 0x20, %x4)); \ 167 EX_LD_FP(LOAD(ldd, base + 0x20, %x4)); \
162 EX_LD(LOAD(ldd, base + 0x28, %x5)); 168 EX_LD_FP(LOAD(ldd, base + 0x28, %x5));
163#define FREG_LOAD_7(base, x0, x1, x2, x3, x4, x5, x6) \ 169#define FREG_LOAD_7(base, x0, x1, x2, x3, x4, x5, x6) \
164 EX_LD(LOAD(ldd, base + 0x00, %x0)); \ 170 EX_LD_FP(LOAD(ldd, base + 0x00, %x0)); \
165 EX_LD(LOAD(ldd, base + 0x08, %x1)); \ 171 EX_LD_FP(LOAD(ldd, base + 0x08, %x1)); \
166 EX_LD(LOAD(ldd, base + 0x10, %x2)); \ 172 EX_LD_FP(LOAD(ldd, base + 0x10, %x2)); \
167 EX_LD(LOAD(ldd, base + 0x18, %x3)); \ 173 EX_LD_FP(LOAD(ldd, base + 0x18, %x3)); \
168 EX_LD(LOAD(ldd, base + 0x20, %x4)); \ 174 EX_LD_FP(LOAD(ldd, base + 0x20, %x4)); \
169 EX_LD(LOAD(ldd, base + 0x28, %x5)); \ 175 EX_LD_FP(LOAD(ldd, base + 0x28, %x5)); \
170 EX_LD(LOAD(ldd, base + 0x30, %x6)); 176 EX_LD_FP(LOAD(ldd, base + 0x30, %x6));
171 177
172 .register %g2,#scratch 178 .register %g2,#scratch
173 .register %g3,#scratch 179 .register %g3,#scratch
@@ -275,11 +281,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
275 nop 281 nop
276 /* fall through for 0 < low bits < 8 */ 282 /* fall through for 0 < low bits < 8 */
277110: sub %o4, 64, %g2 283110: sub %o4, 64, %g2
278 EX_LD(LOAD_BLK(%g2, %f0)) 284 EX_LD_FP(LOAD_BLK(%g2, %f0))
2791: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 2851: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
280 EX_LD(LOAD_BLK(%o4, %f16)) 286 EX_LD_FP(LOAD_BLK(%o4, %f16))
281 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f14, f16) 287 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f14, f16)
282 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 288 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
283 FREG_MOVE_8(f16, f18, f20, f22, f24, f26, f28, f30) 289 FREG_MOVE_8(f16, f18, f20, f22, f24, f26, f28, f30)
284 subcc %g1, 64, %g1 290 subcc %g1, 64, %g1
285 add %o4, 64, %o4 291 add %o4, 64, %o4
@@ -290,10 +296,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
290 296
291120: sub %o4, 56, %g2 297120: sub %o4, 56, %g2
292 FREG_LOAD_7(%g2, f0, f2, f4, f6, f8, f10, f12) 298 FREG_LOAD_7(%g2, f0, f2, f4, f6, f8, f10, f12)
2931: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 2991: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
294 EX_LD(LOAD_BLK(%o4, %f16)) 300 EX_LD_FP(LOAD_BLK(%o4, %f16))
295 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f16, f18) 301 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f16, f18)
296 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 302 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
297 FREG_MOVE_7(f18, f20, f22, f24, f26, f28, f30) 303 FREG_MOVE_7(f18, f20, f22, f24, f26, f28, f30)
298 subcc %g1, 64, %g1 304 subcc %g1, 64, %g1
299 add %o4, 64, %o4 305 add %o4, 64, %o4
@@ -304,10 +310,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
304 310
305130: sub %o4, 48, %g2 311130: sub %o4, 48, %g2
306 FREG_LOAD_6(%g2, f0, f2, f4, f6, f8, f10) 312 FREG_LOAD_6(%g2, f0, f2, f4, f6, f8, f10)
3071: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3131: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
308 EX_LD(LOAD_BLK(%o4, %f16)) 314 EX_LD_FP(LOAD_BLK(%o4, %f16))
309 FREG_FROB(f0, f2, f4, f6, f8, f10, f16, f18, f20) 315 FREG_FROB(f0, f2, f4, f6, f8, f10, f16, f18, f20)
310 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 316 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
311 FREG_MOVE_6(f20, f22, f24, f26, f28, f30) 317 FREG_MOVE_6(f20, f22, f24, f26, f28, f30)
312 subcc %g1, 64, %g1 318 subcc %g1, 64, %g1
313 add %o4, 64, %o4 319 add %o4, 64, %o4
@@ -318,10 +324,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
318 324
319140: sub %o4, 40, %g2 325140: sub %o4, 40, %g2
320 FREG_LOAD_5(%g2, f0, f2, f4, f6, f8) 326 FREG_LOAD_5(%g2, f0, f2, f4, f6, f8)
3211: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3271: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
322 EX_LD(LOAD_BLK(%o4, %f16)) 328 EX_LD_FP(LOAD_BLK(%o4, %f16))
323 FREG_FROB(f0, f2, f4, f6, f8, f16, f18, f20, f22) 329 FREG_FROB(f0, f2, f4, f6, f8, f16, f18, f20, f22)
324 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 330 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
325 FREG_MOVE_5(f22, f24, f26, f28, f30) 331 FREG_MOVE_5(f22, f24, f26, f28, f30)
326 subcc %g1, 64, %g1 332 subcc %g1, 64, %g1
327 add %o4, 64, %o4 333 add %o4, 64, %o4
@@ -332,10 +338,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
332 338
333150: sub %o4, 32, %g2 339150: sub %o4, 32, %g2
334 FREG_LOAD_4(%g2, f0, f2, f4, f6) 340 FREG_LOAD_4(%g2, f0, f2, f4, f6)
3351: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3411: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
336 EX_LD(LOAD_BLK(%o4, %f16)) 342 EX_LD_FP(LOAD_BLK(%o4, %f16))
337 FREG_FROB(f0, f2, f4, f6, f16, f18, f20, f22, f24) 343 FREG_FROB(f0, f2, f4, f6, f16, f18, f20, f22, f24)
338 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 344 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
339 FREG_MOVE_4(f24, f26, f28, f30) 345 FREG_MOVE_4(f24, f26, f28, f30)
340 subcc %g1, 64, %g1 346 subcc %g1, 64, %g1
341 add %o4, 64, %o4 347 add %o4, 64, %o4
@@ -346,10 +352,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
346 352
347160: sub %o4, 24, %g2 353160: sub %o4, 24, %g2
348 FREG_LOAD_3(%g2, f0, f2, f4) 354 FREG_LOAD_3(%g2, f0, f2, f4)
3491: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3551: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
350 EX_LD(LOAD_BLK(%o4, %f16)) 356 EX_LD_FP(LOAD_BLK(%o4, %f16))
351 FREG_FROB(f0, f2, f4, f16, f18, f20, f22, f24, f26) 357 FREG_FROB(f0, f2, f4, f16, f18, f20, f22, f24, f26)
352 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 358 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
353 FREG_MOVE_3(f26, f28, f30) 359 FREG_MOVE_3(f26, f28, f30)
354 subcc %g1, 64, %g1 360 subcc %g1, 64, %g1
355 add %o4, 64, %o4 361 add %o4, 64, %o4
@@ -360,10 +366,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
360 366
361170: sub %o4, 16, %g2 367170: sub %o4, 16, %g2
362 FREG_LOAD_2(%g2, f0, f2) 368 FREG_LOAD_2(%g2, f0, f2)
3631: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3691: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
364 EX_LD(LOAD_BLK(%o4, %f16)) 370 EX_LD_FP(LOAD_BLK(%o4, %f16))
365 FREG_FROB(f0, f2, f16, f18, f20, f22, f24, f26, f28) 371 FREG_FROB(f0, f2, f16, f18, f20, f22, f24, f26, f28)
366 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 372 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
367 FREG_MOVE_2(f28, f30) 373 FREG_MOVE_2(f28, f30)
368 subcc %g1, 64, %g1 374 subcc %g1, 64, %g1
369 add %o4, 64, %o4 375 add %o4, 64, %o4
@@ -374,10 +380,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
374 380
375180: sub %o4, 8, %g2 381180: sub %o4, 8, %g2
376 FREG_LOAD_1(%g2, f0) 382 FREG_LOAD_1(%g2, f0)
3771: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3831: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
378 EX_LD(LOAD_BLK(%o4, %f16)) 384 EX_LD_FP(LOAD_BLK(%o4, %f16))
379 FREG_FROB(f0, f16, f18, f20, f22, f24, f26, f28, f30) 385 FREG_FROB(f0, f16, f18, f20, f22, f24, f26, f28, f30)
380 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 386 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
381 FREG_MOVE_1(f30) 387 FREG_MOVE_1(f30)
382 subcc %g1, 64, %g1 388 subcc %g1, 64, %g1
383 add %o4, 64, %o4 389 add %o4, 64, %o4
@@ -387,10 +393,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
387 nop 393 nop
388 394
389190: 395190:
3901: EX_ST(STORE_INIT(%g0, %o4 + %g3)) 3961: EX_ST_FP(STORE_INIT(%g0, %o4 + %g3))
391 subcc %g1, 64, %g1 397 subcc %g1, 64, %g1
392 EX_LD(LOAD_BLK(%o4, %f0)) 398 EX_LD_FP(LOAD_BLK(%o4, %f0))
393 EX_ST(STORE_BLK(%f0, %o4 + %g3)) 399 EX_ST_FP(STORE_BLK(%f0, %o4 + %g3))
394 add %o4, 64, %o4 400 add %o4, 64, %o4
395 bne,pt %xcc, 1b 401 bne,pt %xcc, 1b
396 LOAD(prefetch, %o4 + 64, #one_read) 402 LOAD(prefetch, %o4 + 64, #one_read)
diff --git a/arch/sparc/lib/NG4copy_from_user.S b/arch/sparc/lib/NG4copy_from_user.S
index fd9f903ffa32..2e8ee7ad07a9 100644
--- a/arch/sparc/lib/NG4copy_from_user.S
+++ b/arch/sparc/lib/NG4copy_from_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_LD_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\
19 .text; \
20 .align 4;
21
14#ifndef ASI_AIUS 22#ifndef ASI_AIUS
15#define ASI_AIUS 0x11 23#define ASI_AIUS 0x11
16#endif 24#endif
diff --git a/arch/sparc/lib/NG4copy_to_user.S b/arch/sparc/lib/NG4copy_to_user.S
index 9744c4540a8d..be0bf4590df8 100644
--- a/arch/sparc/lib/NG4copy_to_user.S
+++ b/arch/sparc/lib/NG4copy_to_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_ST_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\
19 .text; \
20 .align 4;
21
14#ifndef ASI_AIUS 22#ifndef ASI_AIUS
15#define ASI_AIUS 0x11 23#define ASI_AIUS 0x11
16#endif 24#endif
diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S
index 83aeeb1dffdb..8e13ee1f4454 100644
--- a/arch/sparc/lib/NG4memcpy.S
+++ b/arch/sparc/lib/NG4memcpy.S
@@ -48,10 +48,16 @@
48#ifndef EX_LD 48#ifndef EX_LD
49#define EX_LD(x) x 49#define EX_LD(x) x
50#endif 50#endif
51#ifndef EX_LD_FP
52#define EX_LD_FP(x) x
53#endif
51 54
52#ifndef EX_ST 55#ifndef EX_ST
53#define EX_ST(x) x 56#define EX_ST(x) x
54#endif 57#endif
58#ifndef EX_ST_FP
59#define EX_ST_FP(x) x
60#endif
55 61
56#ifndef EX_RETVAL 62#ifndef EX_RETVAL
57#define EX_RETVAL(x) x 63#define EX_RETVAL(x) x
@@ -210,17 +216,17 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
210 sub %o2, %o4, %o2 216 sub %o2, %o4, %o2
211 alignaddr %o1, %g0, %g1 217 alignaddr %o1, %g0, %g1
212 add %o1, %o4, %o1 218 add %o1, %o4, %o1
213 EX_LD(LOAD(ldd, %g1 + 0x00, %f0)) 219 EX_LD_FP(LOAD(ldd, %g1 + 0x00, %f0))
2141: EX_LD(LOAD(ldd, %g1 + 0x08, %f2)) 2201: EX_LD_FP(LOAD(ldd, %g1 + 0x08, %f2))
215 subcc %o4, 0x40, %o4 221 subcc %o4, 0x40, %o4
216 EX_LD(LOAD(ldd, %g1 + 0x10, %f4)) 222 EX_LD_FP(LOAD(ldd, %g1 + 0x10, %f4))
217 EX_LD(LOAD(ldd, %g1 + 0x18, %f6)) 223 EX_LD_FP(LOAD(ldd, %g1 + 0x18, %f6))
218 EX_LD(LOAD(ldd, %g1 + 0x20, %f8)) 224 EX_LD_FP(LOAD(ldd, %g1 + 0x20, %f8))
219 EX_LD(LOAD(ldd, %g1 + 0x28, %f10)) 225 EX_LD_FP(LOAD(ldd, %g1 + 0x28, %f10))
220 EX_LD(LOAD(ldd, %g1 + 0x30, %f12)) 226 EX_LD_FP(LOAD(ldd, %g1 + 0x30, %f12))
221 EX_LD(LOAD(ldd, %g1 + 0x38, %f14)) 227 EX_LD_FP(LOAD(ldd, %g1 + 0x38, %f14))
222 faligndata %f0, %f2, %f16 228 faligndata %f0, %f2, %f16
223 EX_LD(LOAD(ldd, %g1 + 0x40, %f0)) 229 EX_LD_FP(LOAD(ldd, %g1 + 0x40, %f0))
224 faligndata %f2, %f4, %f18 230 faligndata %f2, %f4, %f18
225 add %g1, 0x40, %g1 231 add %g1, 0x40, %g1
226 faligndata %f4, %f6, %f20 232 faligndata %f4, %f6, %f20
@@ -229,14 +235,14 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
229 faligndata %f10, %f12, %f26 235 faligndata %f10, %f12, %f26
230 faligndata %f12, %f14, %f28 236 faligndata %f12, %f14, %f28
231 faligndata %f14, %f0, %f30 237 faligndata %f14, %f0, %f30
232 EX_ST(STORE(std, %f16, %o0 + 0x00)) 238 EX_ST_FP(STORE(std, %f16, %o0 + 0x00))
233 EX_ST(STORE(std, %f18, %o0 + 0x08)) 239 EX_ST_FP(STORE(std, %f18, %o0 + 0x08))
234 EX_ST(STORE(std, %f20, %o0 + 0x10)) 240 EX_ST_FP(STORE(std, %f20, %o0 + 0x10))
235 EX_ST(STORE(std, %f22, %o0 + 0x18)) 241 EX_ST_FP(STORE(std, %f22, %o0 + 0x18))
236 EX_ST(STORE(std, %f24, %o0 + 0x20)) 242 EX_ST_FP(STORE(std, %f24, %o0 + 0x20))
237 EX_ST(STORE(std, %f26, %o0 + 0x28)) 243 EX_ST_FP(STORE(std, %f26, %o0 + 0x28))
238 EX_ST(STORE(std, %f28, %o0 + 0x30)) 244 EX_ST_FP(STORE(std, %f28, %o0 + 0x30))
239 EX_ST(STORE(std, %f30, %o0 + 0x38)) 245 EX_ST_FP(STORE(std, %f30, %o0 + 0x38))
240 add %o0, 0x40, %o0 246 add %o0, 0x40, %o0
241 bne,pt %icc, 1b 247 bne,pt %icc, 1b
242 LOAD(prefetch, %g1 + 0x200, #n_reads_strong) 248 LOAD(prefetch, %g1 + 0x200, #n_reads_strong)
diff --git a/arch/sparc/lib/U1copy_from_user.S b/arch/sparc/lib/U1copy_from_user.S
index a6ae2ea04bf5..ecc5692fa2b4 100644
--- a/arch/sparc/lib/U1copy_from_user.S
+++ b/arch/sparc/lib/U1copy_from_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_LD_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_fp;\
19 .text; \
20 .align 4;
21
14#define FUNC_NAME ___copy_from_user 22#define FUNC_NAME ___copy_from_user
15#define LOAD(type,addr,dest) type##a [addr] %asi, dest 23#define LOAD(type,addr,dest) type##a [addr] %asi, dest
16#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS, dest 24#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS, dest
diff --git a/arch/sparc/lib/U1copy_to_user.S b/arch/sparc/lib/U1copy_to_user.S
index f4b970eeb485..9eea392e44d4 100644
--- a/arch/sparc/lib/U1copy_to_user.S
+++ b/arch/sparc/lib/U1copy_to_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_ST_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_fp;\
19 .text; \
20 .align 4;
21
14#define FUNC_NAME ___copy_to_user 22#define FUNC_NAME ___copy_to_user
15#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS 23#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
16#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS 24#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS
diff --git a/arch/sparc/lib/U1memcpy.S b/arch/sparc/lib/U1memcpy.S
index b67142b7768e..3e6209ebb7d7 100644
--- a/arch/sparc/lib/U1memcpy.S
+++ b/arch/sparc/lib/U1memcpy.S
@@ -25,10 +25,16 @@
25#ifndef EX_LD 25#ifndef EX_LD
26#define EX_LD(x) x 26#define EX_LD(x) x
27#endif 27#endif
28#ifndef EX_LD_FP
29#define EX_LD_FP(x) x
30#endif
28 31
29#ifndef EX_ST 32#ifndef EX_ST
30#define EX_ST(x) x 33#define EX_ST(x) x
31#endif 34#endif
35#ifndef EX_ST_FP
36#define EX_ST_FP(x) x
37#endif
32 38
33#ifndef EX_RETVAL 39#ifndef EX_RETVAL
34#define EX_RETVAL(x) x 40#define EX_RETVAL(x) x
@@ -73,8 +79,8 @@
73 faligndata %f8, %f9, %f62; 79 faligndata %f8, %f9, %f62;
74 80
75#define MAIN_LOOP_CHUNK(src, dest, fdest, fsrc, len, jmptgt) \ 81#define MAIN_LOOP_CHUNK(src, dest, fdest, fsrc, len, jmptgt) \
76 EX_LD(LOAD_BLK(%src, %fdest)); \ 82 EX_LD_FP(LOAD_BLK(%src, %fdest)); \
77 EX_ST(STORE_BLK(%fsrc, %dest)); \ 83 EX_ST_FP(STORE_BLK(%fsrc, %dest)); \
78 add %src, 0x40, %src; \ 84 add %src, 0x40, %src; \
79 subcc %len, 0x40, %len; \ 85 subcc %len, 0x40, %len; \
80 be,pn %xcc, jmptgt; \ 86 be,pn %xcc, jmptgt; \
@@ -89,12 +95,12 @@
89 95
90#define DO_SYNC membar #Sync; 96#define DO_SYNC membar #Sync;
91#define STORE_SYNC(dest, fsrc) \ 97#define STORE_SYNC(dest, fsrc) \
92 EX_ST(STORE_BLK(%fsrc, %dest)); \ 98 EX_ST_FP(STORE_BLK(%fsrc, %dest)); \
93 add %dest, 0x40, %dest; \ 99 add %dest, 0x40, %dest; \
94 DO_SYNC 100 DO_SYNC
95 101
96#define STORE_JUMP(dest, fsrc, target) \ 102#define STORE_JUMP(dest, fsrc, target) \
97 EX_ST(STORE_BLK(%fsrc, %dest)); \ 103 EX_ST_FP(STORE_BLK(%fsrc, %dest)); \
98 add %dest, 0x40, %dest; \ 104 add %dest, 0x40, %dest; \
99 ba,pt %xcc, target; \ 105 ba,pt %xcc, target; \
100 nop; 106 nop;
@@ -103,7 +109,7 @@
103 subcc %left, 8, %left;\ 109 subcc %left, 8, %left;\
104 bl,pn %xcc, 95f; \ 110 bl,pn %xcc, 95f; \
105 faligndata %f0, %f1, %f48; \ 111 faligndata %f0, %f1, %f48; \
106 EX_ST(STORE(std, %f48, %dest)); \ 112 EX_ST_FP(STORE(std, %f48, %dest)); \
107 add %dest, 8, %dest; 113 add %dest, 8, %dest;
108 114
109#define UNEVEN_VISCHUNK_LAST(dest, f0, f1, left) \ 115#define UNEVEN_VISCHUNK_LAST(dest, f0, f1, left) \
@@ -160,8 +166,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
160 and %g2, 0x38, %g2 166 and %g2, 0x38, %g2
161 167
1621: subcc %g1, 0x1, %g1 1681: subcc %g1, 0x1, %g1
163 EX_LD(LOAD(ldub, %o1 + 0x00, %o3)) 169 EX_LD_FP(LOAD(ldub, %o1 + 0x00, %o3))
164 EX_ST(STORE(stb, %o3, %o1 + %GLOBAL_SPARE)) 170 EX_ST_FP(STORE(stb, %o3, %o1 + %GLOBAL_SPARE))
165 bgu,pt %XCC, 1b 171 bgu,pt %XCC, 1b
166 add %o1, 0x1, %o1 172 add %o1, 0x1, %o1
167 173
@@ -172,20 +178,20 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
172 be,pt %icc, 3f 178 be,pt %icc, 3f
173 alignaddr %o1, %g0, %o1 179 alignaddr %o1, %g0, %o1
174 180
175 EX_LD(LOAD(ldd, %o1, %f4)) 181 EX_LD_FP(LOAD(ldd, %o1, %f4))
1761: EX_LD(LOAD(ldd, %o1 + 0x8, %f6)) 1821: EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f6))
177 add %o1, 0x8, %o1 183 add %o1, 0x8, %o1
178 subcc %g2, 0x8, %g2 184 subcc %g2, 0x8, %g2
179 faligndata %f4, %f6, %f0 185 faligndata %f4, %f6, %f0
180 EX_ST(STORE(std, %f0, %o0)) 186 EX_ST_FP(STORE(std, %f0, %o0))
181 be,pn %icc, 3f 187 be,pn %icc, 3f
182 add %o0, 0x8, %o0 188 add %o0, 0x8, %o0
183 189
184 EX_LD(LOAD(ldd, %o1 + 0x8, %f4)) 190 EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f4))
185 add %o1, 0x8, %o1 191 add %o1, 0x8, %o1
186 subcc %g2, 0x8, %g2 192 subcc %g2, 0x8, %g2
187 faligndata %f6, %f4, %f0 193 faligndata %f6, %f4, %f0
188 EX_ST(STORE(std, %f0, %o0)) 194 EX_ST_FP(STORE(std, %f0, %o0))
189 bne,pt %icc, 1b 195 bne,pt %icc, 1b
190 add %o0, 0x8, %o0 196 add %o0, 0x8, %o0
191 197
@@ -208,13 +214,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
208 add %g1, %GLOBAL_SPARE, %g1 214 add %g1, %GLOBAL_SPARE, %g1
209 subcc %o2, %g3, %o2 215 subcc %o2, %g3, %o2
210 216
211 EX_LD(LOAD_BLK(%o1, %f0)) 217 EX_LD_FP(LOAD_BLK(%o1, %f0))
212 add %o1, 0x40, %o1 218 add %o1, 0x40, %o1
213 add %g1, %g3, %g1 219 add %g1, %g3, %g1
214 EX_LD(LOAD_BLK(%o1, %f16)) 220 EX_LD_FP(LOAD_BLK(%o1, %f16))
215 add %o1, 0x40, %o1 221 add %o1, 0x40, %o1
216 sub %GLOBAL_SPARE, 0x80, %GLOBAL_SPARE 222 sub %GLOBAL_SPARE, 0x80, %GLOBAL_SPARE
217 EX_LD(LOAD_BLK(%o1, %f32)) 223 EX_LD_FP(LOAD_BLK(%o1, %f32))
218 add %o1, 0x40, %o1 224 add %o1, 0x40, %o1
219 225
220 /* There are 8 instances of the unrolled loop, 226 /* There are 8 instances of the unrolled loop,
@@ -426,28 +432,28 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
42662: FINISH_VISCHUNK(o0, f44, f46, g3) 43262: FINISH_VISCHUNK(o0, f44, f46, g3)
42763: UNEVEN_VISCHUNK_LAST(o0, f46, f0, g3) 43363: UNEVEN_VISCHUNK_LAST(o0, f46, f0, g3)
428 434
42993: EX_LD(LOAD(ldd, %o1, %f2)) 43593: EX_LD_FP(LOAD(ldd, %o1, %f2))
430 add %o1, 8, %o1 436 add %o1, 8, %o1
431 subcc %g3, 8, %g3 437 subcc %g3, 8, %g3
432 faligndata %f0, %f2, %f8 438 faligndata %f0, %f2, %f8
433 EX_ST(STORE(std, %f8, %o0)) 439 EX_ST_FP(STORE(std, %f8, %o0))
434 bl,pn %xcc, 95f 440 bl,pn %xcc, 95f
435 add %o0, 8, %o0 441 add %o0, 8, %o0
436 EX_LD(LOAD(ldd, %o1, %f0)) 442 EX_LD_FP(LOAD(ldd, %o1, %f0))
437 add %o1, 8, %o1 443 add %o1, 8, %o1
438 subcc %g3, 8, %g3 444 subcc %g3, 8, %g3
439 faligndata %f2, %f0, %f8 445 faligndata %f2, %f0, %f8
440 EX_ST(STORE(std, %f8, %o0)) 446 EX_ST_FP(STORE(std, %f8, %o0))
441 bge,pt %xcc, 93b 447 bge,pt %xcc, 93b
442 add %o0, 8, %o0 448 add %o0, 8, %o0
443 449
44495: brz,pt %o2, 2f 45095: brz,pt %o2, 2f
445 mov %g1, %o1 451 mov %g1, %o1
446 452
4471: EX_LD(LOAD(ldub, %o1, %o3)) 4531: EX_LD_FP(LOAD(ldub, %o1, %o3))
448 add %o1, 1, %o1 454 add %o1, 1, %o1
449 subcc %o2, 1, %o2 455 subcc %o2, 1, %o2
450 EX_ST(STORE(stb, %o3, %o0)) 456 EX_ST_FP(STORE(stb, %o3, %o0))
451 bne,pt %xcc, 1b 457 bne,pt %xcc, 1b
452 add %o0, 1, %o0 458 add %o0, 1, %o0
453 459
diff --git a/arch/sparc/lib/U3copy_from_user.S b/arch/sparc/lib/U3copy_from_user.S
index b1acd1331c33..88ad73d86fe4 100644
--- a/arch/sparc/lib/U3copy_from_user.S
+++ b/arch/sparc/lib/U3copy_from_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_LD_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_fp;\
19 .text; \
20 .align 4;
21
14#define FUNC_NAME U3copy_from_user 22#define FUNC_NAME U3copy_from_user
15#define LOAD(type,addr,dest) type##a [addr] %asi, dest 23#define LOAD(type,addr,dest) type##a [addr] %asi, dest
16#define EX_RETVAL(x) 0 24#define EX_RETVAL(x) 0
diff --git a/arch/sparc/lib/U3copy_to_user.S b/arch/sparc/lib/U3copy_to_user.S
index ef1e493afdfa..845139d75537 100644
--- a/arch/sparc/lib/U3copy_to_user.S
+++ b/arch/sparc/lib/U3copy_to_user.S
@@ -11,6 +11,14 @@
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
14#define EX_ST_FP(x) \
1598: x; \
16 .section __ex_table,"a";\
17 .align 4; \
18 .word 98b, __retl_one_fp;\
19 .text; \
20 .align 4;
21
14#define FUNC_NAME U3copy_to_user 22#define FUNC_NAME U3copy_to_user
15#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS 23#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
16#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS 24#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS
diff --git a/arch/sparc/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S
index 7cae9cc6a204..491ee69e4995 100644
--- a/arch/sparc/lib/U3memcpy.S
+++ b/arch/sparc/lib/U3memcpy.S
@@ -24,10 +24,16 @@
24#ifndef EX_LD 24#ifndef EX_LD
25#define EX_LD(x) x 25#define EX_LD(x) x
26#endif 26#endif
27#ifndef EX_LD_FP
28#define EX_LD_FP(x) x
29#endif
27 30
28#ifndef EX_ST 31#ifndef EX_ST
29#define EX_ST(x) x 32#define EX_ST(x) x
30#endif 33#endif
34#ifndef EX_ST_FP
35#define EX_ST_FP(x) x
36#endif
31 37
32#ifndef EX_RETVAL 38#ifndef EX_RETVAL
33#define EX_RETVAL(x) x 39#define EX_RETVAL(x) x
@@ -120,8 +126,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
120 and %g2, 0x38, %g2 126 and %g2, 0x38, %g2
121 127
1221: subcc %g1, 0x1, %g1 1281: subcc %g1, 0x1, %g1
123 EX_LD(LOAD(ldub, %o1 + 0x00, %o3)) 129 EX_LD_FP(LOAD(ldub, %o1 + 0x00, %o3))
124 EX_ST(STORE(stb, %o3, %o1 + GLOBAL_SPARE)) 130 EX_ST_FP(STORE(stb, %o3, %o1 + GLOBAL_SPARE))
125 bgu,pt %XCC, 1b 131 bgu,pt %XCC, 1b
126 add %o1, 0x1, %o1 132 add %o1, 0x1, %o1
127 133
@@ -132,20 +138,20 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
132 be,pt %icc, 3f 138 be,pt %icc, 3f
133 alignaddr %o1, %g0, %o1 139 alignaddr %o1, %g0, %o1
134 140
135 EX_LD(LOAD(ldd, %o1, %f4)) 141 EX_LD_FP(LOAD(ldd, %o1, %f4))
1361: EX_LD(LOAD(ldd, %o1 + 0x8, %f6)) 1421: EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f6))
137 add %o1, 0x8, %o1 143 add %o1, 0x8, %o1
138 subcc %g2, 0x8, %g2 144 subcc %g2, 0x8, %g2
139 faligndata %f4, %f6, %f0 145 faligndata %f4, %f6, %f0
140 EX_ST(STORE(std, %f0, %o0)) 146 EX_ST_FP(STORE(std, %f0, %o0))
141 be,pn %icc, 3f 147 be,pn %icc, 3f
142 add %o0, 0x8, %o0 148 add %o0, 0x8, %o0
143 149
144 EX_LD(LOAD(ldd, %o1 + 0x8, %f4)) 150 EX_LD_FP(LOAD(ldd, %o1 + 0x8, %f4))
145 add %o1, 0x8, %o1 151 add %o1, 0x8, %o1
146 subcc %g2, 0x8, %g2 152 subcc %g2, 0x8, %g2
147 faligndata %f6, %f4, %f2 153 faligndata %f6, %f4, %f2
148 EX_ST(STORE(std, %f2, %o0)) 154 EX_ST_FP(STORE(std, %f2, %o0))
149 bne,pt %icc, 1b 155 bne,pt %icc, 1b
150 add %o0, 0x8, %o0 156 add %o0, 0x8, %o0
151 157
@@ -155,25 +161,25 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
155 LOAD(prefetch, %o1 + 0x080, #one_read) 161 LOAD(prefetch, %o1 + 0x080, #one_read)
156 LOAD(prefetch, %o1 + 0x0c0, #one_read) 162 LOAD(prefetch, %o1 + 0x0c0, #one_read)
157 LOAD(prefetch, %o1 + 0x100, #one_read) 163 LOAD(prefetch, %o1 + 0x100, #one_read)
158 EX_LD(LOAD(ldd, %o1 + 0x000, %f0)) 164 EX_LD_FP(LOAD(ldd, %o1 + 0x000, %f0))
159 LOAD(prefetch, %o1 + 0x140, #one_read) 165 LOAD(prefetch, %o1 + 0x140, #one_read)
160 EX_LD(LOAD(ldd, %o1 + 0x008, %f2)) 166 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2))
161 LOAD(prefetch, %o1 + 0x180, #one_read) 167 LOAD(prefetch, %o1 + 0x180, #one_read)
162 EX_LD(LOAD(ldd, %o1 + 0x010, %f4)) 168 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4))
163 LOAD(prefetch, %o1 + 0x1c0, #one_read) 169 LOAD(prefetch, %o1 + 0x1c0, #one_read)
164 faligndata %f0, %f2, %f16 170 faligndata %f0, %f2, %f16
165 EX_LD(LOAD(ldd, %o1 + 0x018, %f6)) 171 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6))
166 faligndata %f2, %f4, %f18 172 faligndata %f2, %f4, %f18
167 EX_LD(LOAD(ldd, %o1 + 0x020, %f8)) 173 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8))
168 faligndata %f4, %f6, %f20 174 faligndata %f4, %f6, %f20
169 EX_LD(LOAD(ldd, %o1 + 0x028, %f10)) 175 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10))
170 faligndata %f6, %f8, %f22 176 faligndata %f6, %f8, %f22
171 177
172 EX_LD(LOAD(ldd, %o1 + 0x030, %f12)) 178 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12))
173 faligndata %f8, %f10, %f24 179 faligndata %f8, %f10, %f24
174 EX_LD(LOAD(ldd, %o1 + 0x038, %f14)) 180 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14))
175 faligndata %f10, %f12, %f26 181 faligndata %f10, %f12, %f26
176 EX_LD(LOAD(ldd, %o1 + 0x040, %f0)) 182 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0))
177 183
178 subcc GLOBAL_SPARE, 0x80, GLOBAL_SPARE 184 subcc GLOBAL_SPARE, 0x80, GLOBAL_SPARE
179 add %o1, 0x40, %o1 185 add %o1, 0x40, %o1
@@ -184,26 +190,26 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
184 190
185 .align 64 191 .align 64
1861: 1921:
187 EX_LD(LOAD(ldd, %o1 + 0x008, %f2)) 193 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2))
188 faligndata %f12, %f14, %f28 194 faligndata %f12, %f14, %f28
189 EX_LD(LOAD(ldd, %o1 + 0x010, %f4)) 195 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4))
190 faligndata %f14, %f0, %f30 196 faligndata %f14, %f0, %f30
191 EX_ST(STORE_BLK(%f16, %o0)) 197 EX_ST_FP(STORE_BLK(%f16, %o0))
192 EX_LD(LOAD(ldd, %o1 + 0x018, %f6)) 198 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6))
193 faligndata %f0, %f2, %f16 199 faligndata %f0, %f2, %f16
194 add %o0, 0x40, %o0 200 add %o0, 0x40, %o0
195 201
196 EX_LD(LOAD(ldd, %o1 + 0x020, %f8)) 202 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8))
197 faligndata %f2, %f4, %f18 203 faligndata %f2, %f4, %f18
198 EX_LD(LOAD(ldd, %o1 + 0x028, %f10)) 204 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10))
199 faligndata %f4, %f6, %f20 205 faligndata %f4, %f6, %f20
200 EX_LD(LOAD(ldd, %o1 + 0x030, %f12)) 206 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12))
201 subcc %o3, 0x01, %o3 207 subcc %o3, 0x01, %o3
202 faligndata %f6, %f8, %f22 208 faligndata %f6, %f8, %f22
203 EX_LD(LOAD(ldd, %o1 + 0x038, %f14)) 209 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14))
204 210
205 faligndata %f8, %f10, %f24 211 faligndata %f8, %f10, %f24
206 EX_LD(LOAD(ldd, %o1 + 0x040, %f0)) 212 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0))
207 LOAD(prefetch, %o1 + 0x1c0, #one_read) 213 LOAD(prefetch, %o1 + 0x1c0, #one_read)
208 faligndata %f10, %f12, %f26 214 faligndata %f10, %f12, %f26
209 bg,pt %XCC, 1b 215 bg,pt %XCC, 1b
@@ -211,29 +217,29 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
211 217
212 /* Finally we copy the last full 64-byte block. */ 218 /* Finally we copy the last full 64-byte block. */
2132: 2192:
214 EX_LD(LOAD(ldd, %o1 + 0x008, %f2)) 220 EX_LD_FP(LOAD(ldd, %o1 + 0x008, %f2))
215 faligndata %f12, %f14, %f28 221 faligndata %f12, %f14, %f28
216 EX_LD(LOAD(ldd, %o1 + 0x010, %f4)) 222 EX_LD_FP(LOAD(ldd, %o1 + 0x010, %f4))
217 faligndata %f14, %f0, %f30 223 faligndata %f14, %f0, %f30
218 EX_ST(STORE_BLK(%f16, %o0)) 224 EX_ST_FP(STORE_BLK(%f16, %o0))
219 EX_LD(LOAD(ldd, %o1 + 0x018, %f6)) 225 EX_LD_FP(LOAD(ldd, %o1 + 0x018, %f6))
220 faligndata %f0, %f2, %f16 226 faligndata %f0, %f2, %f16
221 EX_LD(LOAD(ldd, %o1 + 0x020, %f8)) 227 EX_LD_FP(LOAD(ldd, %o1 + 0x020, %f8))
222 faligndata %f2, %f4, %f18 228 faligndata %f2, %f4, %f18
223 EX_LD(LOAD(ldd, %o1 + 0x028, %f10)) 229 EX_LD_FP(LOAD(ldd, %o1 + 0x028, %f10))
224 faligndata %f4, %f6, %f20 230 faligndata %f4, %f6, %f20
225 EX_LD(LOAD(ldd, %o1 + 0x030, %f12)) 231 EX_LD_FP(LOAD(ldd, %o1 + 0x030, %f12))
226 faligndata %f6, %f8, %f22 232 faligndata %f6, %f8, %f22
227 EX_LD(LOAD(ldd, %o1 + 0x038, %f14)) 233 EX_LD_FP(LOAD(ldd, %o1 + 0x038, %f14))
228 faligndata %f8, %f10, %f24 234 faligndata %f8, %f10, %f24
229 cmp %g1, 0 235 cmp %g1, 0
230 be,pt %XCC, 1f 236 be,pt %XCC, 1f
231 add %o0, 0x40, %o0 237 add %o0, 0x40, %o0
232 EX_LD(LOAD(ldd, %o1 + 0x040, %f0)) 238 EX_LD_FP(LOAD(ldd, %o1 + 0x040, %f0))
2331: faligndata %f10, %f12, %f26 2391: faligndata %f10, %f12, %f26
234 faligndata %f12, %f14, %f28 240 faligndata %f12, %f14, %f28
235 faligndata %f14, %f0, %f30 241 faligndata %f14, %f0, %f30
236 EX_ST(STORE_BLK(%f16, %o0)) 242 EX_ST_FP(STORE_BLK(%f16, %o0))
237 add %o0, 0x40, %o0 243 add %o0, 0x40, %o0
238 add %o1, 0x40, %o1 244 add %o1, 0x40, %o1
239 membar #Sync 245 membar #Sync
@@ -253,20 +259,20 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
253 259
254 sub %o2, %g2, %o2 260 sub %o2, %g2, %o2
255 be,a,pt %XCC, 1f 261 be,a,pt %XCC, 1f
256 EX_LD(LOAD(ldd, %o1 + 0x00, %f0)) 262 EX_LD_FP(LOAD(ldd, %o1 + 0x00, %f0))
257 263
2581: EX_LD(LOAD(ldd, %o1 + 0x08, %f2)) 2641: EX_LD_FP(LOAD(ldd, %o1 + 0x08, %f2))
259 add %o1, 0x8, %o1 265 add %o1, 0x8, %o1
260 subcc %g2, 0x8, %g2 266 subcc %g2, 0x8, %g2
261 faligndata %f0, %f2, %f8 267 faligndata %f0, %f2, %f8
262 EX_ST(STORE(std, %f8, %o0)) 268 EX_ST_FP(STORE(std, %f8, %o0))
263 be,pn %XCC, 2f 269 be,pn %XCC, 2f
264 add %o0, 0x8, %o0 270 add %o0, 0x8, %o0
265 EX_LD(LOAD(ldd, %o1 + 0x08, %f0)) 271 EX_LD_FP(LOAD(ldd, %o1 + 0x08, %f0))
266 add %o1, 0x8, %o1 272 add %o1, 0x8, %o1
267 subcc %g2, 0x8, %g2 273 subcc %g2, 0x8, %g2
268 faligndata %f2, %f0, %f8 274 faligndata %f2, %f0, %f8
269 EX_ST(STORE(std, %f8, %o0)) 275 EX_ST_FP(STORE(std, %f8, %o0))
270 bne,pn %XCC, 1b 276 bne,pn %XCC, 1b
271 add %o0, 0x8, %o0 277 add %o0, 0x8, %o0
272 278
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 06332cb7e7d1..3f5c48ddba45 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -38,6 +38,14 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
38 return best && (best->ecx & bit(X86_FEATURE_XSAVE)); 38 return best && (best->ecx & bit(X86_FEATURE_XSAVE));
39} 39}
40 40
41static inline bool guest_cpuid_has_mtrr(struct kvm_vcpu *vcpu)
42{
43 struct kvm_cpuid_entry2 *best;
44
45 best = kvm_find_cpuid_entry(vcpu, 1, 0);
46 return best && (best->edx & bit(X86_FEATURE_MTRR));
47}
48
41static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu) 49static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu)
42{ 50{
43 struct kvm_cpuid_entry2 *best; 51 struct kvm_cpuid_entry2 *best;
diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c
index 9e8bf13572e6..3f8c732117ec 100644
--- a/arch/x86/kvm/mtrr.c
+++ b/arch/x86/kvm/mtrr.c
@@ -120,14 +120,22 @@ static u8 mtrr_default_type(struct kvm_mtrr *mtrr_state)
120 return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK; 120 return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK;
121} 121}
122 122
123static u8 mtrr_disabled_type(void) 123static u8 mtrr_disabled_type(struct kvm_vcpu *vcpu)
124{ 124{
125 /* 125 /*
126 * Intel SDM 11.11.2.2: all MTRRs are disabled when 126 * Intel SDM 11.11.2.2: all MTRRs are disabled when
127 * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC 127 * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC
128 * memory type is applied to all of physical memory. 128 * memory type is applied to all of physical memory.
129 *
130 * However, virtual machines can be run with CPUID such that
131 * there are no MTRRs. In that case, the firmware will never
132 * enable MTRRs and it is obviously undesirable to run the
133 * guest entirely with UC memory and we use WB.
129 */ 134 */
130 return MTRR_TYPE_UNCACHABLE; 135 if (guest_cpuid_has_mtrr(vcpu))
136 return MTRR_TYPE_UNCACHABLE;
137 else
138 return MTRR_TYPE_WRBACK;
131} 139}
132 140
133/* 141/*
@@ -267,7 +275,7 @@ static int fixed_mtrr_addr_to_seg(u64 addr)
267 275
268 for (seg = 0; seg < seg_num; seg++) { 276 for (seg = 0; seg < seg_num; seg++) {
269 mtrr_seg = &fixed_seg_table[seg]; 277 mtrr_seg = &fixed_seg_table[seg];
270 if (mtrr_seg->start >= addr && addr < mtrr_seg->end) 278 if (mtrr_seg->start <= addr && addr < mtrr_seg->end)
271 return seg; 279 return seg;
272 } 280 }
273 281
@@ -300,7 +308,6 @@ static void var_mtrr_range(struct kvm_mtrr_range *range, u64 *start, u64 *end)
300 *start = range->base & PAGE_MASK; 308 *start = range->base & PAGE_MASK;
301 309
302 mask = range->mask & PAGE_MASK; 310 mask = range->mask & PAGE_MASK;
303 mask |= ~0ULL << boot_cpu_data.x86_phys_bits;
304 311
305 /* This cannot overflow because writing to the reserved bits of 312 /* This cannot overflow because writing to the reserved bits of
306 * variable MTRRs causes a #GP. 313 * variable MTRRs causes a #GP.
@@ -356,10 +363,14 @@ static void set_var_mtrr_msr(struct kvm_vcpu *vcpu, u32 msr, u64 data)
356 if (var_mtrr_range_is_valid(cur)) 363 if (var_mtrr_range_is_valid(cur))
357 list_del(&mtrr_state->var_ranges[index].node); 364 list_del(&mtrr_state->var_ranges[index].node);
358 365
366 /* Extend the mask with all 1 bits to the left, since those
367 * bits must implicitly be 0. The bits are then cleared
368 * when reading them.
369 */
359 if (!is_mtrr_mask) 370 if (!is_mtrr_mask)
360 cur->base = data; 371 cur->base = data;
361 else 372 else
362 cur->mask = data; 373 cur->mask = data | (-1LL << cpuid_maxphyaddr(vcpu));
363 374
364 /* add it to the list if it's enabled. */ 375 /* add it to the list if it's enabled. */
365 if (var_mtrr_range_is_valid(cur)) { 376 if (var_mtrr_range_is_valid(cur)) {
@@ -426,6 +437,8 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
426 *pdata = vcpu->arch.mtrr_state.var_ranges[index].base; 437 *pdata = vcpu->arch.mtrr_state.var_ranges[index].base;
427 else 438 else
428 *pdata = vcpu->arch.mtrr_state.var_ranges[index].mask; 439 *pdata = vcpu->arch.mtrr_state.var_ranges[index].mask;
440
441 *pdata &= (1ULL << cpuid_maxphyaddr(vcpu)) - 1;
429 } 442 }
430 443
431 return 0; 444 return 0;
@@ -670,7 +683,7 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn)
670 } 683 }
671 684
672 if (iter.mtrr_disabled) 685 if (iter.mtrr_disabled)
673 return mtrr_disabled_type(); 686 return mtrr_disabled_type(vcpu);
674 687
675 /* not contained in any MTRRs. */ 688 /* not contained in any MTRRs. */
676 if (type == -1) 689 if (type == -1)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 83a1c643f9a5..899c40f826dd 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3422,6 +3422,8 @@ static int handle_exit(struct kvm_vcpu *vcpu)
3422 struct kvm_run *kvm_run = vcpu->run; 3422 struct kvm_run *kvm_run = vcpu->run;
3423 u32 exit_code = svm->vmcb->control.exit_code; 3423 u32 exit_code = svm->vmcb->control.exit_code;
3424 3424
3425 trace_kvm_exit(exit_code, vcpu, KVM_ISA_SVM);
3426
3425 if (!is_cr_intercept(svm, INTERCEPT_CR0_WRITE)) 3427 if (!is_cr_intercept(svm, INTERCEPT_CR0_WRITE))
3426 vcpu->arch.cr0 = svm->vmcb->save.cr0; 3428 vcpu->arch.cr0 = svm->vmcb->save.cr0;
3427 if (npt_enabled) 3429 if (npt_enabled)
@@ -3892,8 +3894,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
3892 vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; 3894 vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp;
3893 vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; 3895 vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip;
3894 3896
3895 trace_kvm_exit(svm->vmcb->control.exit_code, vcpu, KVM_ISA_SVM);
3896
3897 if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) 3897 if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
3898 kvm_before_handle_nmi(&svm->vcpu); 3898 kvm_before_handle_nmi(&svm->vcpu);
3899 3899
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index af823a388c19..44976a596fa6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2803,7 +2803,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2803 msr_info->data = vcpu->arch.ia32_xss; 2803 msr_info->data = vcpu->arch.ia32_xss;
2804 break; 2804 break;
2805 case MSR_TSC_AUX: 2805 case MSR_TSC_AUX:
2806 if (!guest_cpuid_has_rdtscp(vcpu)) 2806 if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated)
2807 return 1; 2807 return 1;
2808 /* Otherwise falls through */ 2808 /* Otherwise falls through */
2809 default: 2809 default:
@@ -2909,7 +2909,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2909 clear_atomic_switch_msr(vmx, MSR_IA32_XSS); 2909 clear_atomic_switch_msr(vmx, MSR_IA32_XSS);
2910 break; 2910 break;
2911 case MSR_TSC_AUX: 2911 case MSR_TSC_AUX:
2912 if (!guest_cpuid_has_rdtscp(vcpu)) 2912 if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated)
2913 return 1; 2913 return 1;
2914 /* Check reserved bit, higher 32 bits should be zero */ 2914 /* Check reserved bit, higher 32 bits should be zero */
2915 if ((data >> 32) != 0) 2915 if ((data >> 32) != 0)
@@ -8042,6 +8042,8 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
8042 u32 exit_reason = vmx->exit_reason; 8042 u32 exit_reason = vmx->exit_reason;
8043 u32 vectoring_info = vmx->idt_vectoring_info; 8043 u32 vectoring_info = vmx->idt_vectoring_info;
8044 8044
8045 trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX);
8046
8045 /* 8047 /*
8046 * Flush logged GPAs PML buffer, this will make dirty_bitmap more 8048 * Flush logged GPAs PML buffer, this will make dirty_bitmap more
8047 * updated. Another good is, in kvm_vm_ioctl_get_dirty_log, before 8049 * updated. Another good is, in kvm_vm_ioctl_get_dirty_log, before
@@ -8668,7 +8670,6 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8668 vmx->loaded_vmcs->launched = 1; 8670 vmx->loaded_vmcs->launched = 1;
8669 8671
8670 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); 8672 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
8671 trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX);
8672 8673
8673 /* 8674 /*
8674 * the KVM_REQ_EVENT optimization bit is only on for one entry, and if 8675 * the KVM_REQ_EVENT optimization bit is only on for one entry, and if
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index eed32283d22c..7ffc224bbe41 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3572,9 +3572,11 @@ static int kvm_vm_ioctl_get_pit(struct kvm *kvm, struct kvm_pit_state *ps)
3572 3572
3573static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps) 3573static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps)
3574{ 3574{
3575 int i;
3575 mutex_lock(&kvm->arch.vpit->pit_state.lock); 3576 mutex_lock(&kvm->arch.vpit->pit_state.lock);
3576 memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state)); 3577 memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state));
3577 kvm_pit_load_count(kvm, 0, ps->channels[0].count, 0); 3578 for (i = 0; i < 3; i++)
3579 kvm_pit_load_count(kvm, i, ps->channels[i].count, 0);
3578 mutex_unlock(&kvm->arch.vpit->pit_state.lock); 3580 mutex_unlock(&kvm->arch.vpit->pit_state.lock);
3579 return 0; 3581 return 0;
3580} 3582}
@@ -3593,6 +3595,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
3593static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) 3595static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
3594{ 3596{
3595 int start = 0; 3597 int start = 0;
3598 int i;
3596 u32 prev_legacy, cur_legacy; 3599 u32 prev_legacy, cur_legacy;
3597 mutex_lock(&kvm->arch.vpit->pit_state.lock); 3600 mutex_lock(&kvm->arch.vpit->pit_state.lock);
3598 prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY; 3601 prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;
@@ -3602,7 +3605,8 @@ static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
3602 memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels, 3605 memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,
3603 sizeof(kvm->arch.vpit->pit_state.channels)); 3606 sizeof(kvm->arch.vpit->pit_state.channels));
3604 kvm->arch.vpit->pit_state.flags = ps->flags; 3607 kvm->arch.vpit->pit_state.flags = ps->flags;
3605 kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start); 3608 for (i = 0; i < 3; i++)
3609 kvm_pit_load_count(kvm, i, kvm->arch.vpit->pit_state.channels[i].count, start);
3606 mutex_unlock(&kvm->arch.vpit->pit_state.lock); 3610 mutex_unlock(&kvm->arch.vpit->pit_state.lock);
3607 return 0; 3611 return 0;
3608} 3612}
@@ -6515,6 +6519,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6515 if (req_immediate_exit) 6519 if (req_immediate_exit)
6516 smp_send_reschedule(vcpu->cpu); 6520 smp_send_reschedule(vcpu->cpu);
6517 6521
6522 trace_kvm_entry(vcpu->vcpu_id);
6523 wait_lapic_expire(vcpu);
6518 __kvm_guest_enter(); 6524 __kvm_guest_enter();
6519 6525
6520 if (unlikely(vcpu->arch.switch_db_regs)) { 6526 if (unlikely(vcpu->arch.switch_db_regs)) {
@@ -6527,8 +6533,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6527 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD; 6533 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;
6528 } 6534 }
6529 6535
6530 trace_kvm_entry(vcpu->vcpu_id);
6531 wait_lapic_expire(vcpu);
6532 kvm_x86_ops->run(vcpu); 6536 kvm_x86_ops->run(vcpu);
6533 6537
6534 /* 6538 /*
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index e5f854ce2d72..14fcd01ed992 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -470,7 +470,7 @@ long sys_sigreturn(void)
470 struct sigcontext __user *sc = &frame->sc; 470 struct sigcontext __user *sc = &frame->sc;
471 int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long); 471 int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long);
472 472
473 if (copy_from_user(&set.sig[0], (void *)sc->oldmask, sizeof(set.sig[0])) || 473 if (copy_from_user(&set.sig[0], &sc->oldmask, sizeof(set.sig[0])) ||
474 copy_from_user(&set.sig[1], frame->extramask, sig_size)) 474 copy_from_user(&set.sig[1], frame->extramask, sig_size))
475 goto segfault; 475 goto segfault;
476 476
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 3705eabd7e22..df0c40559583 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -1,6 +1,7 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/tick.h> 2#include <linux/tick.h>
3 3
4#include <xen/xen.h>
4#include <xen/interface/xen.h> 5#include <xen/interface/xen.h>
5#include <xen/grant_table.h> 6#include <xen/grant_table.h>
6#include <xen/events.h> 7#include <xen/events.h>
diff --git a/block/blk-core.c b/block/blk-core.c
index 3636be469fa2..33e2f62d5062 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -207,6 +207,22 @@ void blk_delay_queue(struct request_queue *q, unsigned long msecs)
207EXPORT_SYMBOL(blk_delay_queue); 207EXPORT_SYMBOL(blk_delay_queue);
208 208
209/** 209/**
210 * blk_start_queue_async - asynchronously restart a previously stopped queue
211 * @q: The &struct request_queue in question
212 *
213 * Description:
214 * blk_start_queue_async() will clear the stop flag on the queue, and
215 * ensure that the request_fn for the queue is run from an async
216 * context.
217 **/
218void blk_start_queue_async(struct request_queue *q)
219{
220 queue_flag_clear(QUEUE_FLAG_STOPPED, q);
221 blk_run_queue_async(q);
222}
223EXPORT_SYMBOL(blk_start_queue_async);
224
225/**
210 * blk_start_queue - restart a previously stopped queue 226 * blk_start_queue - restart a previously stopped queue
211 * @q: The &struct request_queue in question 227 * @q: The &struct request_queue in question
212 * 228 *
@@ -1689,8 +1705,6 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
1689 struct request *req; 1705 struct request *req;
1690 unsigned int request_count = 0; 1706 unsigned int request_count = 0;
1691 1707
1692 blk_queue_split(q, &bio, q->bio_split);
1693
1694 /* 1708 /*
1695 * low level driver can indicate that it wants pages above a 1709 * low level driver can indicate that it wants pages above a
1696 * certain limit bounced to low memory (ie for highmem, or even 1710 * certain limit bounced to low memory (ie for highmem, or even
@@ -1698,6 +1712,8 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
1698 */ 1712 */
1699 blk_queue_bounce(q, &bio); 1713 blk_queue_bounce(q, &bio);
1700 1714
1715 blk_queue_split(q, &bio, q->bio_split);
1716
1701 if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) { 1717 if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) {
1702 bio->bi_error = -EIO; 1718 bio->bi_error = -EIO;
1703 bio_endio(bio); 1719 bio_endio(bio);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index e01405a3e8b3..e73846a3d08a 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -81,7 +81,7 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
81 struct bio *new = NULL; 81 struct bio *new = NULL;
82 82
83 bio_for_each_segment(bv, bio, iter) { 83 bio_for_each_segment(bv, bio, iter) {
84 if (sectors + (bv.bv_len >> 9) > queue_max_sectors(q)) 84 if (sectors + (bv.bv_len >> 9) > blk_max_size_offset(q, bio->bi_iter.bi_sector))
85 goto split; 85 goto split;
86 86
87 /* 87 /*
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index ca9efe17db1a..634b4d1ab681 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -47,7 +47,7 @@ struct skcipher_ctx {
47 bool merge; 47 bool merge;
48 bool enc; 48 bool enc;
49 49
50 struct ablkcipher_request req; 50 struct skcipher_request req;
51}; 51};
52 52
53struct skcipher_async_rsgl { 53struct skcipher_async_rsgl {
@@ -64,13 +64,13 @@ struct skcipher_async_req {
64}; 64};
65 65
66#define GET_SREQ(areq, ctx) (struct skcipher_async_req *)((char *)areq + \ 66#define GET_SREQ(areq, ctx) (struct skcipher_async_req *)((char *)areq + \
67 crypto_ablkcipher_reqsize(crypto_ablkcipher_reqtfm(&ctx->req))) 67 crypto_skcipher_reqsize(crypto_skcipher_reqtfm(&ctx->req)))
68 68
69#define GET_REQ_SIZE(ctx) \ 69#define GET_REQ_SIZE(ctx) \
70 crypto_ablkcipher_reqsize(crypto_ablkcipher_reqtfm(&ctx->req)) 70 crypto_skcipher_reqsize(crypto_skcipher_reqtfm(&ctx->req))
71 71
72#define GET_IV_SIZE(ctx) \ 72#define GET_IV_SIZE(ctx) \
73 crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(&ctx->req)) 73 crypto_skcipher_ivsize(crypto_skcipher_reqtfm(&ctx->req))
74 74
75#define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \ 75#define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \
76 sizeof(struct scatterlist) - 1) 76 sizeof(struct scatterlist) - 1)
@@ -302,8 +302,8 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
302 struct sock *sk = sock->sk; 302 struct sock *sk = sock->sk;
303 struct alg_sock *ask = alg_sk(sk); 303 struct alg_sock *ask = alg_sk(sk);
304 struct skcipher_ctx *ctx = ask->private; 304 struct skcipher_ctx *ctx = ask->private;
305 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(&ctx->req); 305 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(&ctx->req);
306 unsigned ivsize = crypto_ablkcipher_ivsize(tfm); 306 unsigned ivsize = crypto_skcipher_ivsize(tfm);
307 struct skcipher_sg_list *sgl; 307 struct skcipher_sg_list *sgl;
308 struct af_alg_control con = {}; 308 struct af_alg_control con = {};
309 long copied = 0; 309 long copied = 0;
@@ -507,7 +507,7 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
507 struct skcipher_sg_list *sgl; 507 struct skcipher_sg_list *sgl;
508 struct scatterlist *sg; 508 struct scatterlist *sg;
509 struct skcipher_async_req *sreq; 509 struct skcipher_async_req *sreq;
510 struct ablkcipher_request *req; 510 struct skcipher_request *req;
511 struct skcipher_async_rsgl *last_rsgl = NULL; 511 struct skcipher_async_rsgl *last_rsgl = NULL;
512 unsigned int txbufs = 0, len = 0, tx_nents = skcipher_all_sg_nents(ctx); 512 unsigned int txbufs = 0, len = 0, tx_nents = skcipher_all_sg_nents(ctx);
513 unsigned int reqlen = sizeof(struct skcipher_async_req) + 513 unsigned int reqlen = sizeof(struct skcipher_async_req) +
@@ -531,9 +531,9 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
531 } 531 }
532 sg_init_table(sreq->tsg, tx_nents); 532 sg_init_table(sreq->tsg, tx_nents);
533 memcpy(sreq->iv, ctx->iv, GET_IV_SIZE(ctx)); 533 memcpy(sreq->iv, ctx->iv, GET_IV_SIZE(ctx));
534 ablkcipher_request_set_tfm(req, crypto_ablkcipher_reqtfm(&ctx->req)); 534 skcipher_request_set_tfm(req, crypto_skcipher_reqtfm(&ctx->req));
535 ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, 535 skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
536 skcipher_async_cb, sk); 536 skcipher_async_cb, sk);
537 537
538 while (iov_iter_count(&msg->msg_iter)) { 538 while (iov_iter_count(&msg->msg_iter)) {
539 struct skcipher_async_rsgl *rsgl; 539 struct skcipher_async_rsgl *rsgl;
@@ -608,10 +608,10 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
608 if (mark) 608 if (mark)
609 sg_mark_end(sreq->tsg + txbufs - 1); 609 sg_mark_end(sreq->tsg + txbufs - 1);
610 610
611 ablkcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg, 611 skcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg,
612 len, sreq->iv); 612 len, sreq->iv);
613 err = ctx->enc ? crypto_ablkcipher_encrypt(req) : 613 err = ctx->enc ? crypto_skcipher_encrypt(req) :
614 crypto_ablkcipher_decrypt(req); 614 crypto_skcipher_decrypt(req);
615 if (err == -EINPROGRESS) { 615 if (err == -EINPROGRESS) {
616 atomic_inc(&ctx->inflight); 616 atomic_inc(&ctx->inflight);
617 err = -EIOCBQUEUED; 617 err = -EIOCBQUEUED;
@@ -632,7 +632,7 @@ static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg,
632 struct sock *sk = sock->sk; 632 struct sock *sk = sock->sk;
633 struct alg_sock *ask = alg_sk(sk); 633 struct alg_sock *ask = alg_sk(sk);
634 struct skcipher_ctx *ctx = ask->private; 634 struct skcipher_ctx *ctx = ask->private;
635 unsigned bs = crypto_ablkcipher_blocksize(crypto_ablkcipher_reqtfm( 635 unsigned bs = crypto_skcipher_blocksize(crypto_skcipher_reqtfm(
636 &ctx->req)); 636 &ctx->req));
637 struct skcipher_sg_list *sgl; 637 struct skcipher_sg_list *sgl;
638 struct scatterlist *sg; 638 struct scatterlist *sg;
@@ -669,14 +669,13 @@ static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg,
669 if (!used) 669 if (!used)
670 goto free; 670 goto free;
671 671
672 ablkcipher_request_set_crypt(&ctx->req, sg, 672 skcipher_request_set_crypt(&ctx->req, sg, ctx->rsgl.sg, used,
673 ctx->rsgl.sg, used, 673 ctx->iv);
674 ctx->iv);
675 674
676 err = af_alg_wait_for_completion( 675 err = af_alg_wait_for_completion(
677 ctx->enc ? 676 ctx->enc ?
678 crypto_ablkcipher_encrypt(&ctx->req) : 677 crypto_skcipher_encrypt(&ctx->req) :
679 crypto_ablkcipher_decrypt(&ctx->req), 678 crypto_skcipher_decrypt(&ctx->req),
680 &ctx->completion); 679 &ctx->completion);
681 680
682free: 681free:
@@ -751,17 +750,17 @@ static struct proto_ops algif_skcipher_ops = {
751 750
752static void *skcipher_bind(const char *name, u32 type, u32 mask) 751static void *skcipher_bind(const char *name, u32 type, u32 mask)
753{ 752{
754 return crypto_alloc_ablkcipher(name, type, mask); 753 return crypto_alloc_skcipher(name, type, mask);
755} 754}
756 755
757static void skcipher_release(void *private) 756static void skcipher_release(void *private)
758{ 757{
759 crypto_free_ablkcipher(private); 758 crypto_free_skcipher(private);
760} 759}
761 760
762static int skcipher_setkey(void *private, const u8 *key, unsigned int keylen) 761static int skcipher_setkey(void *private, const u8 *key, unsigned int keylen)
763{ 762{
764 return crypto_ablkcipher_setkey(private, key, keylen); 763 return crypto_skcipher_setkey(private, key, keylen);
765} 764}
766 765
767static void skcipher_wait(struct sock *sk) 766static void skcipher_wait(struct sock *sk)
@@ -778,13 +777,13 @@ static void skcipher_sock_destruct(struct sock *sk)
778{ 777{
779 struct alg_sock *ask = alg_sk(sk); 778 struct alg_sock *ask = alg_sk(sk);
780 struct skcipher_ctx *ctx = ask->private; 779 struct skcipher_ctx *ctx = ask->private;
781 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(&ctx->req); 780 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(&ctx->req);
782 781
783 if (atomic_read(&ctx->inflight)) 782 if (atomic_read(&ctx->inflight))
784 skcipher_wait(sk); 783 skcipher_wait(sk);
785 784
786 skcipher_free_sgl(sk); 785 skcipher_free_sgl(sk);
787 sock_kzfree_s(sk, ctx->iv, crypto_ablkcipher_ivsize(tfm)); 786 sock_kzfree_s(sk, ctx->iv, crypto_skcipher_ivsize(tfm));
788 sock_kfree_s(sk, ctx, ctx->len); 787 sock_kfree_s(sk, ctx, ctx->len);
789 af_alg_release_parent(sk); 788 af_alg_release_parent(sk);
790} 789}
@@ -793,20 +792,20 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
793{ 792{
794 struct skcipher_ctx *ctx; 793 struct skcipher_ctx *ctx;
795 struct alg_sock *ask = alg_sk(sk); 794 struct alg_sock *ask = alg_sk(sk);
796 unsigned int len = sizeof(*ctx) + crypto_ablkcipher_reqsize(private); 795 unsigned int len = sizeof(*ctx) + crypto_skcipher_reqsize(private);
797 796
798 ctx = sock_kmalloc(sk, len, GFP_KERNEL); 797 ctx = sock_kmalloc(sk, len, GFP_KERNEL);
799 if (!ctx) 798 if (!ctx)
800 return -ENOMEM; 799 return -ENOMEM;
801 800
802 ctx->iv = sock_kmalloc(sk, crypto_ablkcipher_ivsize(private), 801 ctx->iv = sock_kmalloc(sk, crypto_skcipher_ivsize(private),
803 GFP_KERNEL); 802 GFP_KERNEL);
804 if (!ctx->iv) { 803 if (!ctx->iv) {
805 sock_kfree_s(sk, ctx, len); 804 sock_kfree_s(sk, ctx, len);
806 return -ENOMEM; 805 return -ENOMEM;
807 } 806 }
808 807
809 memset(ctx->iv, 0, crypto_ablkcipher_ivsize(private)); 808 memset(ctx->iv, 0, crypto_skcipher_ivsize(private));
810 809
811 INIT_LIST_HEAD(&ctx->tsgl); 810 INIT_LIST_HEAD(&ctx->tsgl);
812 ctx->len = len; 811 ctx->len = len;
@@ -819,9 +818,9 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
819 818
820 ask->private = ctx; 819 ask->private = ctx;
821 820
822 ablkcipher_request_set_tfm(&ctx->req, private); 821 skcipher_request_set_tfm(&ctx->req, private);
823 ablkcipher_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG, 822 skcipher_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
824 af_alg_complete, &ctx->completion); 823 af_alg_complete, &ctx->completion);
825 824
826 sk->sk_destruct = skcipher_sock_destruct; 825 sk->sk_destruct = skcipher_sock_destruct;
827 826
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index f4e02ae93f58..11154a330f07 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -200,7 +200,8 @@ static int acpi_pss_perf_init(struct acpi_processor *pr,
200 goto err_remove_sysfs_thermal; 200 goto err_remove_sysfs_thermal;
201 } 201 }
202 202
203 sysfs_remove_link(&pr->cdev->device.kobj, "device"); 203 return 0;
204
204 err_remove_sysfs_thermal: 205 err_remove_sysfs_thermal:
205 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 206 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
206 err_thermal_unregister: 207 err_thermal_unregister:
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 8162475d96b5..09e3c0d87ecc 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -219,6 +219,9 @@ static void end_cmd(struct nullb_cmd *cmd)
219{ 219{
220 struct request_queue *q = NULL; 220 struct request_queue *q = NULL;
221 221
222 if (cmd->rq)
223 q = cmd->rq->q;
224
222 switch (queue_mode) { 225 switch (queue_mode) {
223 case NULL_Q_MQ: 226 case NULL_Q_MQ:
224 blk_mq_end_request(cmd->rq, 0); 227 blk_mq_end_request(cmd->rq, 0);
@@ -229,23 +232,19 @@ static void end_cmd(struct nullb_cmd *cmd)
229 break; 232 break;
230 case NULL_Q_BIO: 233 case NULL_Q_BIO:
231 bio_endio(cmd->bio); 234 bio_endio(cmd->bio);
232 goto free_cmd; 235 break;
233 } 236 }
234 237
235 if (cmd->rq) 238 free_cmd(cmd);
236 q = cmd->rq->q;
237 239
238 /* Restart queue if needed, as we are freeing a tag */ 240 /* Restart queue if needed, as we are freeing a tag */
239 if (q && !q->mq_ops && blk_queue_stopped(q)) { 241 if (queue_mode == NULL_Q_RQ && blk_queue_stopped(q)) {
240 unsigned long flags; 242 unsigned long flags;
241 243
242 spin_lock_irqsave(q->queue_lock, flags); 244 spin_lock_irqsave(q->queue_lock, flags);
243 if (blk_queue_stopped(q)) 245 blk_start_queue_async(q);
244 blk_start_queue(q);
245 spin_unlock_irqrestore(q->queue_lock, flags); 246 spin_unlock_irqrestore(q->queue_lock, flags);
246 } 247 }
247free_cmd:
248 free_cmd(cmd);
249} 248}
250 249
251static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) 250static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)
diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 846bc29c157d..25996e256110 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -342,13 +342,13 @@ static int sunxi_rsb_read(struct sunxi_rsb *rsb, u8 rtaddr, u8 addr,
342 342
343 ret = _sunxi_rsb_run_xfer(rsb); 343 ret = _sunxi_rsb_run_xfer(rsb);
344 if (ret) 344 if (ret)
345 goto out; 345 goto unlock;
346 346
347 *buf = readl(rsb->regs + RSB_DATA); 347 *buf = readl(rsb->regs + RSB_DATA);
348 348
349unlock:
349 mutex_unlock(&rsb->lock); 350 mutex_unlock(&rsb->lock);
350 351
351out:
352 return ret; 352 return ret;
353} 353}
354 354
@@ -527,9 +527,9 @@ static int sunxi_rsb_init_device_mode(struct sunxi_rsb *rsb)
527 */ 527 */
528 528
529static const struct sunxi_rsb_addr_map sunxi_rsb_addr_maps[] = { 529static const struct sunxi_rsb_addr_map sunxi_rsb_addr_maps[] = {
530 { 0x3e3, 0x2d }, /* Primary PMIC: AXP223, AXP809, AXP81X, ... */ 530 { 0x3a3, 0x2d }, /* Primary PMIC: AXP223, AXP809, AXP81X, ... */
531 { 0x745, 0x3a }, /* Secondary PMIC: AXP806, ... */ 531 { 0x745, 0x3a }, /* Secondary PMIC: AXP806, ... */
532 { 0xe89, 0x45 }, /* Peripheral IC: AC100, ... */ 532 { 0xe89, 0x4e }, /* Peripheral IC: AC100, ... */
533}; 533};
534 534
535static u8 sunxi_rsb_get_rtaddr(u16 hwaddr) 535static u8 sunxi_rsb_get_rtaddr(u16 hwaddr)
diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
index 2c3b16fd3a01..de5e89b2eaaa 100644
--- a/drivers/cpufreq/scpi-cpufreq.c
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -31,7 +31,7 @@ static struct scpi_ops *scpi_ops;
31 31
32static struct scpi_dvfs_info *scpi_get_dvfs_info(struct device *cpu_dev) 32static struct scpi_dvfs_info *scpi_get_dvfs_info(struct device *cpu_dev)
33{ 33{
34 u8 domain = topology_physical_package_id(cpu_dev->id); 34 int domain = topology_physical_package_id(cpu_dev->id);
35 35
36 if (domain < 0) 36 if (domain < 0)
37 return ERR_PTR(-EINVAL); 37 return ERR_PTR(-EINVAL);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 5a5f04d0902d..048cfe073dae 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1264,7 +1264,8 @@ struct amdgpu_cs_parser {
1264 struct ww_acquire_ctx ticket; 1264 struct ww_acquire_ctx ticket;
1265 1265
1266 /* user fence */ 1266 /* user fence */
1267 struct amdgpu_user_fence uf; 1267 struct amdgpu_user_fence uf;
1268 struct amdgpu_bo_list_entry uf_entry;
1268}; 1269};
1269 1270
1270struct amdgpu_job { 1271struct amdgpu_job {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 4f352ec9dec4..25a3e2485cc2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -127,6 +127,37 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
127 return 0; 127 return 0;
128} 128}
129 129
130static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
131 struct drm_amdgpu_cs_chunk_fence *fence_data)
132{
133 struct drm_gem_object *gobj;
134 uint32_t handle;
135
136 handle = fence_data->handle;
137 gobj = drm_gem_object_lookup(p->adev->ddev, p->filp,
138 fence_data->handle);
139 if (gobj == NULL)
140 return -EINVAL;
141
142 p->uf.bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
143 p->uf.offset = fence_data->offset;
144
145 if (amdgpu_ttm_tt_has_userptr(p->uf.bo->tbo.ttm)) {
146 drm_gem_object_unreference_unlocked(gobj);
147 return -EINVAL;
148 }
149
150 p->uf_entry.robj = amdgpu_bo_ref(p->uf.bo);
151 p->uf_entry.prefered_domains = AMDGPU_GEM_DOMAIN_GTT;
152 p->uf_entry.allowed_domains = AMDGPU_GEM_DOMAIN_GTT;
153 p->uf_entry.priority = 0;
154 p->uf_entry.tv.bo = &p->uf_entry.robj->tbo;
155 p->uf_entry.tv.shared = true;
156
157 drm_gem_object_unreference_unlocked(gobj);
158 return 0;
159}
160
130int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) 161int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
131{ 162{
132 union drm_amdgpu_cs *cs = data; 163 union drm_amdgpu_cs *cs = data;
@@ -207,28 +238,15 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
207 238
208 case AMDGPU_CHUNK_ID_FENCE: 239 case AMDGPU_CHUNK_ID_FENCE:
209 size = sizeof(struct drm_amdgpu_cs_chunk_fence); 240 size = sizeof(struct drm_amdgpu_cs_chunk_fence);
210 if (p->chunks[i].length_dw * sizeof(uint32_t) >= size) { 241 if (p->chunks[i].length_dw * sizeof(uint32_t) < size) {
211 uint32_t handle;
212 struct drm_gem_object *gobj;
213 struct drm_amdgpu_cs_chunk_fence *fence_data;
214
215 fence_data = (void *)p->chunks[i].kdata;
216 handle = fence_data->handle;
217 gobj = drm_gem_object_lookup(p->adev->ddev,
218 p->filp, handle);
219 if (gobj == NULL) {
220 ret = -EINVAL;
221 goto free_partial_kdata;
222 }
223
224 p->uf.bo = gem_to_amdgpu_bo(gobj);
225 amdgpu_bo_ref(p->uf.bo);
226 drm_gem_object_unreference_unlocked(gobj);
227 p->uf.offset = fence_data->offset;
228 } else {
229 ret = -EINVAL; 242 ret = -EINVAL;
230 goto free_partial_kdata; 243 goto free_partial_kdata;
231 } 244 }
245
246 ret = amdgpu_cs_user_fence_chunk(p, (void *)p->chunks[i].kdata);
247 if (ret)
248 goto free_partial_kdata;
249
232 break; 250 break;
233 251
234 case AMDGPU_CHUNK_ID_DEPENDENCIES: 252 case AMDGPU_CHUNK_ID_DEPENDENCIES:
@@ -391,6 +409,9 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p)
391 p->vm_bos = amdgpu_vm_get_bos(p->adev, &fpriv->vm, 409 p->vm_bos = amdgpu_vm_get_bos(p->adev, &fpriv->vm,
392 &p->validated); 410 &p->validated);
393 411
412 if (p->uf.bo)
413 list_add(&p->uf_entry.tv.head, &p->validated);
414
394 if (need_mmap_lock) 415 if (need_mmap_lock)
395 down_read(&current->mm->mmap_sem); 416 down_read(&current->mm->mmap_sem);
396 417
@@ -488,8 +509,8 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bo
488 for (i = 0; i < parser->num_ibs; i++) 509 for (i = 0; i < parser->num_ibs; i++)
489 amdgpu_ib_free(parser->adev, &parser->ibs[i]); 510 amdgpu_ib_free(parser->adev, &parser->ibs[i]);
490 kfree(parser->ibs); 511 kfree(parser->ibs);
491 if (parser->uf.bo) 512 amdgpu_bo_unref(&parser->uf.bo);
492 amdgpu_bo_unref(&parser->uf.bo); 513 amdgpu_bo_unref(&parser->uf_entry.robj);
493} 514}
494 515
495static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p, 516static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b3ba27fd9a6b..e69357172ffb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
55{ 55{
56 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); 56 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
57 57
58 if (!state->enable)
59 return 0;
60
58 if (exynos_crtc->ops->atomic_check) 61 if (exynos_crtc->ops->atomic_check)
59 return exynos_crtc->ops->atomic_check(exynos_crtc, state); 62 return exynos_crtc->ops->atomic_check(exynos_crtc, state);
60 63
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index a01e51581c4c..f4af19a0d569 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2193,8 +2193,17 @@ struct drm_i915_gem_request {
2193 struct drm_i915_private *i915; 2193 struct drm_i915_private *i915;
2194 struct intel_engine_cs *ring; 2194 struct intel_engine_cs *ring;
2195 2195
2196 /** GEM sequence number associated with this request. */ 2196 /** GEM sequence number associated with the previous request,
2197 uint32_t seqno; 2197 * when the HWS breadcrumb is equal to this the GPU is processing
2198 * this request.
2199 */
2200 u32 previous_seqno;
2201
2202 /** GEM sequence number associated with this request,
2203 * when the HWS breadcrumb is equal or greater than this the GPU
2204 * has finished processing this request.
2205 */
2206 u32 seqno;
2198 2207
2199 /** Position in the ringbuffer of the start of the request */ 2208 /** Position in the ringbuffer of the start of the request */
2200 u32 head; 2209 u32 head;
@@ -2839,6 +2848,7 @@ i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
2839 2848
2840int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level, 2849int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
2841 u32 flags); 2850 u32 flags);
2851void __i915_vma_set_map_and_fenceable(struct i915_vma *vma);
2842int __must_check i915_vma_unbind(struct i915_vma *vma); 2852int __must_check i915_vma_unbind(struct i915_vma *vma);
2843/* 2853/*
2844 * BEWARE: Do not use the function below unless you can _absolutely_ 2854 * BEWARE: Do not use the function below unless you can _absolutely_
@@ -2910,15 +2920,17 @@ i915_seqno_passed(uint32_t seq1, uint32_t seq2)
2910 return (int32_t)(seq1 - seq2) >= 0; 2920 return (int32_t)(seq1 - seq2) >= 0;
2911} 2921}
2912 2922
2923static inline bool i915_gem_request_started(struct drm_i915_gem_request *req,
2924 bool lazy_coherency)
2925{
2926 u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency);
2927 return i915_seqno_passed(seqno, req->previous_seqno);
2928}
2929
2913static inline bool i915_gem_request_completed(struct drm_i915_gem_request *req, 2930static inline bool i915_gem_request_completed(struct drm_i915_gem_request *req,
2914 bool lazy_coherency) 2931 bool lazy_coherency)
2915{ 2932{
2916 u32 seqno; 2933 u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency);
2917
2918 BUG_ON(req == NULL);
2919
2920 seqno = req->ring->get_seqno(req->ring, lazy_coherency);
2921
2922 return i915_seqno_passed(seqno, req->seqno); 2934 return i915_seqno_passed(seqno, req->seqno);
2923} 2935}
2924 2936
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 32e6aade6223..f56af0aaafde 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1146,23 +1146,74 @@ static bool missed_irq(struct drm_i915_private *dev_priv,
1146 return test_bit(ring->id, &dev_priv->gpu_error.missed_irq_rings); 1146 return test_bit(ring->id, &dev_priv->gpu_error.missed_irq_rings);
1147} 1147}
1148 1148
1149static int __i915_spin_request(struct drm_i915_gem_request *req) 1149static unsigned long local_clock_us(unsigned *cpu)
1150{
1151 unsigned long t;
1152
1153 /* Cheaply and approximately convert from nanoseconds to microseconds.
1154 * The result and subsequent calculations are also defined in the same
1155 * approximate microseconds units. The principal source of timing
1156 * error here is from the simple truncation.
1157 *
1158 * Note that local_clock() is only defined wrt to the current CPU;
1159 * the comparisons are no longer valid if we switch CPUs. Instead of
1160 * blocking preemption for the entire busywait, we can detect the CPU
1161 * switch and use that as indicator of system load and a reason to
1162 * stop busywaiting, see busywait_stop().
1163 */
1164 *cpu = get_cpu();
1165 t = local_clock() >> 10;
1166 put_cpu();
1167
1168 return t;
1169}
1170
1171static bool busywait_stop(unsigned long timeout, unsigned cpu)
1172{
1173 unsigned this_cpu;
1174
1175 if (time_after(local_clock_us(&this_cpu), timeout))
1176 return true;
1177
1178 return this_cpu != cpu;
1179}
1180
1181static int __i915_spin_request(struct drm_i915_gem_request *req, int state)
1150{ 1182{
1151 unsigned long timeout; 1183 unsigned long timeout;
1184 unsigned cpu;
1185
1186 /* When waiting for high frequency requests, e.g. during synchronous
1187 * rendering split between the CPU and GPU, the finite amount of time
1188 * required to set up the irq and wait upon it limits the response
1189 * rate. By busywaiting on the request completion for a short while we
1190 * can service the high frequency waits as quick as possible. However,
1191 * if it is a slow request, we want to sleep as quickly as possible.
1192 * The tradeoff between waiting and sleeping is roughly the time it
1193 * takes to sleep on a request, on the order of a microsecond.
1194 */
1152 1195
1153 if (i915_gem_request_get_ring(req)->irq_refcount) 1196 if (req->ring->irq_refcount)
1154 return -EBUSY; 1197 return -EBUSY;
1155 1198
1156 timeout = jiffies + 1; 1199 /* Only spin if we know the GPU is processing this request */
1200 if (!i915_gem_request_started(req, true))
1201 return -EAGAIN;
1202
1203 timeout = local_clock_us(&cpu) + 5;
1157 while (!need_resched()) { 1204 while (!need_resched()) {
1158 if (i915_gem_request_completed(req, true)) 1205 if (i915_gem_request_completed(req, true))
1159 return 0; 1206 return 0;
1160 1207
1161 if (time_after_eq(jiffies, timeout)) 1208 if (signal_pending_state(state, current))
1209 break;
1210
1211 if (busywait_stop(timeout, cpu))
1162 break; 1212 break;
1163 1213
1164 cpu_relax_lowlatency(); 1214 cpu_relax_lowlatency();
1165 } 1215 }
1216
1166 if (i915_gem_request_completed(req, false)) 1217 if (i915_gem_request_completed(req, false))
1167 return 0; 1218 return 0;
1168 1219
@@ -1197,6 +1248,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
1197 struct drm_i915_private *dev_priv = dev->dev_private; 1248 struct drm_i915_private *dev_priv = dev->dev_private;
1198 const bool irq_test_in_progress = 1249 const bool irq_test_in_progress =
1199 ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring); 1250 ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);
1251 int state = interruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;
1200 DEFINE_WAIT(wait); 1252 DEFINE_WAIT(wait);
1201 unsigned long timeout_expire; 1253 unsigned long timeout_expire;
1202 s64 before, now; 1254 s64 before, now;
@@ -1229,7 +1281,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
1229 before = ktime_get_raw_ns(); 1281 before = ktime_get_raw_ns();
1230 1282
1231 /* Optimistic spin for the next jiffie before touching IRQs */ 1283 /* Optimistic spin for the next jiffie before touching IRQs */
1232 ret = __i915_spin_request(req); 1284 ret = __i915_spin_request(req, state);
1233 if (ret == 0) 1285 if (ret == 0)
1234 goto out; 1286 goto out;
1235 1287
@@ -1241,8 +1293,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
1241 for (;;) { 1293 for (;;) {
1242 struct timer_list timer; 1294 struct timer_list timer;
1243 1295
1244 prepare_to_wait(&ring->irq_queue, &wait, 1296 prepare_to_wait(&ring->irq_queue, &wait, state);
1245 interruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
1246 1297
1247 /* We need to check whether any gpu reset happened in between 1298 /* We need to check whether any gpu reset happened in between
1248 * the caller grabbing the seqno and now ... */ 1299 * the caller grabbing the seqno and now ... */
@@ -1260,7 +1311,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
1260 break; 1311 break;
1261 } 1312 }
1262 1313
1263 if (interruptible && signal_pending(current)) { 1314 if (signal_pending_state(state, current)) {
1264 ret = -ERESTARTSYS; 1315 ret = -ERESTARTSYS;
1265 break; 1316 break;
1266 } 1317 }
@@ -2554,6 +2605,7 @@ void __i915_add_request(struct drm_i915_gem_request *request,
2554 request->batch_obj = obj; 2605 request->batch_obj = obj;
2555 2606
2556 request->emitted_jiffies = jiffies; 2607 request->emitted_jiffies = jiffies;
2608 request->previous_seqno = ring->last_submitted_seqno;
2557 ring->last_submitted_seqno = request->seqno; 2609 ring->last_submitted_seqno = request->seqno;
2558 list_add_tail(&request->list, &ring->request_list); 2610 list_add_tail(&request->list, &ring->request_list);
2559 2611
@@ -4080,6 +4132,29 @@ i915_vma_misplaced(struct i915_vma *vma, uint32_t alignment, uint64_t flags)
4080 return false; 4132 return false;
4081} 4133}
4082 4134
4135void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
4136{
4137 struct drm_i915_gem_object *obj = vma->obj;
4138 bool mappable, fenceable;
4139 u32 fence_size, fence_alignment;
4140
4141 fence_size = i915_gem_get_gtt_size(obj->base.dev,
4142 obj->base.size,
4143 obj->tiling_mode);
4144 fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev,
4145 obj->base.size,
4146 obj->tiling_mode,
4147 true);
4148
4149 fenceable = (vma->node.size == fence_size &&
4150 (vma->node.start & (fence_alignment - 1)) == 0);
4151
4152 mappable = (vma->node.start + fence_size <=
4153 to_i915(obj->base.dev)->gtt.mappable_end);
4154
4155 obj->map_and_fenceable = mappable && fenceable;
4156}
4157
4083static int 4158static int
4084i915_gem_object_do_pin(struct drm_i915_gem_object *obj, 4159i915_gem_object_do_pin(struct drm_i915_gem_object *obj,
4085 struct i915_address_space *vm, 4160 struct i915_address_space *vm,
@@ -4147,25 +4222,7 @@ i915_gem_object_do_pin(struct drm_i915_gem_object *obj,
4147 4222
4148 if (ggtt_view && ggtt_view->type == I915_GGTT_VIEW_NORMAL && 4223 if (ggtt_view && ggtt_view->type == I915_GGTT_VIEW_NORMAL &&
4149 (bound ^ vma->bound) & GLOBAL_BIND) { 4224 (bound ^ vma->bound) & GLOBAL_BIND) {
4150 bool mappable, fenceable; 4225 __i915_vma_set_map_and_fenceable(vma);
4151 u32 fence_size, fence_alignment;
4152
4153 fence_size = i915_gem_get_gtt_size(obj->base.dev,
4154 obj->base.size,
4155 obj->tiling_mode);
4156 fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev,
4157 obj->base.size,
4158 obj->tiling_mode,
4159 true);
4160
4161 fenceable = (vma->node.size == fence_size &&
4162 (vma->node.start & (fence_alignment - 1)) == 0);
4163
4164 mappable = (vma->node.start + fence_size <=
4165 dev_priv->gtt.mappable_end);
4166
4167 obj->map_and_fenceable = mappable && fenceable;
4168
4169 WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); 4226 WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable);
4170 } 4227 }
4171 4228
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 43f35d12b677..86c7500454b4 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2676,6 +2676,7 @@ static int i915_gem_setup_global_gtt(struct drm_device *dev,
2676 return ret; 2676 return ret;
2677 } 2677 }
2678 vma->bound |= GLOBAL_BIND; 2678 vma->bound |= GLOBAL_BIND;
2679 __i915_vma_set_map_and_fenceable(vma);
2679 list_add_tail(&vma->mm_list, &ggtt_vm->inactive_list); 2680 list_add_tail(&vma->mm_list, &ggtt_vm->inactive_list);
2680 } 2681 }
2681 2682
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index cdacf3f5b77a..87e919a06b27 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -687,6 +687,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
687 } 687 }
688 688
689 vma->bound |= GLOBAL_BIND; 689 vma->bound |= GLOBAL_BIND;
690 __i915_vma_set_map_and_fenceable(vma);
690 list_add_tail(&vma->mm_list, &ggtt->inactive_list); 691 list_add_tail(&vma->mm_list, &ggtt->inactive_list);
691 } 692 }
692 693
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 62211abe4922..32cf97346978 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -116,6 +116,7 @@ static void skylake_pfit_enable(struct intel_crtc *crtc);
116static void ironlake_pfit_disable(struct intel_crtc *crtc, bool force); 116static void ironlake_pfit_disable(struct intel_crtc *crtc, bool force);
117static void ironlake_pfit_enable(struct intel_crtc *crtc); 117static void ironlake_pfit_enable(struct intel_crtc *crtc);
118static void intel_modeset_setup_hw_state(struct drm_device *dev); 118static void intel_modeset_setup_hw_state(struct drm_device *dev);
119static void intel_pre_disable_primary(struct drm_crtc *crtc);
119 120
120typedef struct { 121typedef struct {
121 int min, max; 122 int min, max;
@@ -2607,6 +2608,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
2607 struct drm_i915_gem_object *obj; 2608 struct drm_i915_gem_object *obj;
2608 struct drm_plane *primary = intel_crtc->base.primary; 2609 struct drm_plane *primary = intel_crtc->base.primary;
2609 struct drm_plane_state *plane_state = primary->state; 2610 struct drm_plane_state *plane_state = primary->state;
2611 struct drm_crtc_state *crtc_state = intel_crtc->base.state;
2612 struct intel_plane *intel_plane = to_intel_plane(primary);
2610 struct drm_framebuffer *fb; 2613 struct drm_framebuffer *fb;
2611 2614
2612 if (!plane_config->fb) 2615 if (!plane_config->fb)
@@ -2643,6 +2646,18 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
2643 } 2646 }
2644 } 2647 }
2645 2648
2649 /*
2650 * We've failed to reconstruct the BIOS FB. Current display state
2651 * indicates that the primary plane is visible, but has a NULL FB,
2652 * which will lead to problems later if we don't fix it up. The
2653 * simplest solution is to just disable the primary plane now and
2654 * pretend the BIOS never had it enabled.
2655 */
2656 to_intel_plane_state(plane_state)->visible = false;
2657 crtc_state->plane_mask &= ~(1 << drm_plane_index(primary));
2658 intel_pre_disable_primary(&intel_crtc->base);
2659 intel_plane->disable_plane(primary, &intel_crtc->base);
2660
2646 return; 2661 return;
2647 2662
2648valid_fb: 2663valid_fb:
@@ -9910,14 +9925,14 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
9910 return true; 9925 return true;
9911} 9926}
9912 9927
9913static void i845_update_cursor(struct drm_crtc *crtc, u32 base) 9928static void i845_update_cursor(struct drm_crtc *crtc, u32 base, bool on)
9914{ 9929{
9915 struct drm_device *dev = crtc->dev; 9930 struct drm_device *dev = crtc->dev;
9916 struct drm_i915_private *dev_priv = dev->dev_private; 9931 struct drm_i915_private *dev_priv = dev->dev_private;
9917 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 9932 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
9918 uint32_t cntl = 0, size = 0; 9933 uint32_t cntl = 0, size = 0;
9919 9934
9920 if (base) { 9935 if (on) {
9921 unsigned int width = intel_crtc->base.cursor->state->crtc_w; 9936 unsigned int width = intel_crtc->base.cursor->state->crtc_w;
9922 unsigned int height = intel_crtc->base.cursor->state->crtc_h; 9937 unsigned int height = intel_crtc->base.cursor->state->crtc_h;
9923 unsigned int stride = roundup_pow_of_two(width) * 4; 9938 unsigned int stride = roundup_pow_of_two(width) * 4;
@@ -9972,16 +9987,15 @@ static void i845_update_cursor(struct drm_crtc *crtc, u32 base)
9972 } 9987 }
9973} 9988}
9974 9989
9975static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base) 9990static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base, bool on)
9976{ 9991{
9977 struct drm_device *dev = crtc->dev; 9992 struct drm_device *dev = crtc->dev;
9978 struct drm_i915_private *dev_priv = dev->dev_private; 9993 struct drm_i915_private *dev_priv = dev->dev_private;
9979 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 9994 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
9980 int pipe = intel_crtc->pipe; 9995 int pipe = intel_crtc->pipe;
9981 uint32_t cntl; 9996 uint32_t cntl = 0;
9982 9997
9983 cntl = 0; 9998 if (on) {
9984 if (base) {
9985 cntl = MCURSOR_GAMMA_ENABLE; 9999 cntl = MCURSOR_GAMMA_ENABLE;
9986 switch (intel_crtc->base.cursor->state->crtc_w) { 10000 switch (intel_crtc->base.cursor->state->crtc_w) {
9987 case 64: 10001 case 64:
@@ -10032,18 +10046,17 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
10032 int y = cursor_state->crtc_y; 10046 int y = cursor_state->crtc_y;
10033 u32 base = 0, pos = 0; 10047 u32 base = 0, pos = 0;
10034 10048
10035 if (on) 10049 base = intel_crtc->cursor_addr;
10036 base = intel_crtc->cursor_addr;
10037 10050
10038 if (x >= intel_crtc->config->pipe_src_w) 10051 if (x >= intel_crtc->config->pipe_src_w)
10039 base = 0; 10052 on = false;
10040 10053
10041 if (y >= intel_crtc->config->pipe_src_h) 10054 if (y >= intel_crtc->config->pipe_src_h)
10042 base = 0; 10055 on = false;
10043 10056
10044 if (x < 0) { 10057 if (x < 0) {
10045 if (x + cursor_state->crtc_w <= 0) 10058 if (x + cursor_state->crtc_w <= 0)
10046 base = 0; 10059 on = false;
10047 10060
10048 pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT; 10061 pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;
10049 x = -x; 10062 x = -x;
@@ -10052,16 +10065,13 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
10052 10065
10053 if (y < 0) { 10066 if (y < 0) {
10054 if (y + cursor_state->crtc_h <= 0) 10067 if (y + cursor_state->crtc_h <= 0)
10055 base = 0; 10068 on = false;
10056 10069
10057 pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT; 10070 pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;
10058 y = -y; 10071 y = -y;
10059 } 10072 }
10060 pos |= y << CURSOR_Y_SHIFT; 10073 pos |= y << CURSOR_Y_SHIFT;
10061 10074
10062 if (base == 0 && intel_crtc->cursor_base == 0)
10063 return;
10064
10065 I915_WRITE(CURPOS(pipe), pos); 10075 I915_WRITE(CURPOS(pipe), pos);
10066 10076
10067 /* ILK+ do this automagically */ 10077 /* ILK+ do this automagically */
@@ -10072,9 +10082,9 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
10072 } 10082 }
10073 10083
10074 if (IS_845G(dev) || IS_I865G(dev)) 10084 if (IS_845G(dev) || IS_I865G(dev))
10075 i845_update_cursor(crtc, base); 10085 i845_update_cursor(crtc, base, on);
10076 else 10086 else
10077 i9xx_update_cursor(crtc, base); 10087 i9xx_update_cursor(crtc, base, on);
10078} 10088}
10079 10089
10080static bool cursor_size_ok(struct drm_device *dev, 10090static bool cursor_size_ok(struct drm_device *dev,
@@ -12113,18 +12123,22 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
12113static bool check_digital_port_conflicts(struct drm_atomic_state *state) 12123static bool check_digital_port_conflicts(struct drm_atomic_state *state)
12114{ 12124{
12115 struct drm_device *dev = state->dev; 12125 struct drm_device *dev = state->dev;
12116 struct intel_encoder *encoder;
12117 struct drm_connector *connector; 12126 struct drm_connector *connector;
12118 struct drm_connector_state *connector_state;
12119 unsigned int used_ports = 0; 12127 unsigned int used_ports = 0;
12120 int i;
12121 12128
12122 /* 12129 /*
12123 * Walk the connector list instead of the encoder 12130 * Walk the connector list instead of the encoder
12124 * list to detect the problem on ddi platforms 12131 * list to detect the problem on ddi platforms
12125 * where there's just one encoder per digital port. 12132 * where there's just one encoder per digital port.
12126 */ 12133 */
12127 for_each_connector_in_state(state, connector, connector_state, i) { 12134 drm_for_each_connector(connector, dev) {
12135 struct drm_connector_state *connector_state;
12136 struct intel_encoder *encoder;
12137
12138 connector_state = drm_atomic_get_existing_connector_state(state, connector);
12139 if (!connector_state)
12140 connector_state = connector->state;
12141
12128 if (!connector_state->best_encoder) 12142 if (!connector_state->best_encoder)
12129 continue; 12143 continue;
12130 12144
@@ -13718,6 +13732,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
13718 struct drm_crtc *crtc = crtc_state->base.crtc; 13732 struct drm_crtc *crtc = crtc_state->base.crtc;
13719 struct drm_framebuffer *fb = state->base.fb; 13733 struct drm_framebuffer *fb = state->base.fb;
13720 struct drm_i915_gem_object *obj = intel_fb_obj(fb); 13734 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
13735 enum pipe pipe = to_intel_plane(plane)->pipe;
13721 unsigned stride; 13736 unsigned stride;
13722 int ret; 13737 int ret;
13723 13738
@@ -13751,6 +13766,22 @@ intel_check_cursor_plane(struct drm_plane *plane,
13751 return -EINVAL; 13766 return -EINVAL;
13752 } 13767 }
13753 13768
13769 /*
13770 * There's something wrong with the cursor on CHV pipe C.
13771 * If it straddles the left edge of the screen then
13772 * moving it away from the edge or disabling it often
13773 * results in a pipe underrun, and often that can lead to
13774 * dead pipe (constant underrun reported, and it scans
13775 * out just a solid color). To recover from that, the
13776 * display power well must be turned off and on again.
13777 * Refuse the put the cursor into that compromised position.
13778 */
13779 if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&
13780 state->visible && state->base.crtc_x < 0) {
13781 DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
13782 return -EINVAL;
13783 }
13784
13754 return 0; 13785 return 0;
13755} 13786}
13756 13787
@@ -13774,9 +13805,6 @@ intel_commit_cursor_plane(struct drm_plane *plane,
13774 crtc = crtc ? crtc : plane->crtc; 13805 crtc = crtc ? crtc : plane->crtc;
13775 intel_crtc = to_intel_crtc(crtc); 13806 intel_crtc = to_intel_crtc(crtc);
13776 13807
13777 if (intel_crtc->cursor_bo == obj)
13778 goto update;
13779
13780 if (!obj) 13808 if (!obj)
13781 addr = 0; 13809 addr = 0;
13782 else if (!INTEL_INFO(dev)->cursor_needs_physical) 13810 else if (!INTEL_INFO(dev)->cursor_needs_physical)
@@ -13785,9 +13813,7 @@ intel_commit_cursor_plane(struct drm_plane *plane,
13785 addr = obj->phys_handle->busaddr; 13813 addr = obj->phys_handle->busaddr;
13786 13814
13787 intel_crtc->cursor_addr = addr; 13815 intel_crtc->cursor_addr = addr;
13788 intel_crtc->cursor_bo = obj;
13789 13816
13790update:
13791 if (crtc->state->active) 13817 if (crtc->state->active)
13792 intel_crtc_update_cursor(crtc, state->visible); 13818 intel_crtc_update_cursor(crtc, state->visible);
13793} 13819}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f2a1142bff34..0d00f07b7163 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -550,7 +550,6 @@ struct intel_crtc {
550 int adjusted_x; 550 int adjusted_x;
551 int adjusted_y; 551 int adjusted_y;
552 552
553 struct drm_i915_gem_object *cursor_bo;
554 uint32_t cursor_addr; 553 uint32_t cursor_addr;
555 uint32_t cursor_cntl; 554 uint32_t cursor_cntl;
556 uint32_t cursor_size; 555 uint32_t cursor_size;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 81cdd9ff3892..e6c035b0fc1c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1374,17 +1374,18 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
1374 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); 1374 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1375 struct drm_i915_private *dev_priv = to_i915(connector->dev); 1375 struct drm_i915_private *dev_priv = to_i915(connector->dev);
1376 bool live_status = false; 1376 bool live_status = false;
1377 unsigned int retry = 3; 1377 unsigned int try;
1378 1378
1379 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", 1379 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1380 connector->base.id, connector->name); 1380 connector->base.id, connector->name);
1381 1381
1382 intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); 1382 intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1383 1383
1384 while (!live_status && --retry) { 1384 for (try = 0; !live_status && try < 9; try++) {
1385 if (try)
1386 msleep(10);
1385 live_status = intel_digital_port_connected(dev_priv, 1387 live_status = intel_digital_port_connected(dev_priv,
1386 hdmi_to_dig_port(intel_hdmi)); 1388 hdmi_to_dig_port(intel_hdmi));
1387 mdelay(10);
1388 } 1389 }
1389 1390
1390 if (!live_status) 1391 if (!live_status)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
index 43006db6fd58..80fed7e78dcb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
@@ -83,6 +83,7 @@ nvbios_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan)
83 fan->type = NVBIOS_THERM_FAN_UNK; 83 fan->type = NVBIOS_THERM_FAN_UNK;
84 } 84 }
85 85
86 fan->fan_mode = NVBIOS_THERM_FAN_LINEAR;
86 fan->min_duty = nvbios_rd08(bios, data + 0x02); 87 fan->min_duty = nvbios_rd08(bios, data + 0x02);
87 fan->max_duty = nvbios_rd08(bios, data + 0x03); 88 fan->max_duty = nvbios_rd08(bios, data + 0x03);
88 89
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d2d5d004f16d..2d762a2ecd81 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1265,15 +1265,17 @@ static bool cma_protocol_roce(const struct rdma_cm_id *id)
1265 return cma_protocol_roce_dev_port(device, port_num); 1265 return cma_protocol_roce_dev_port(device, port_num);
1266} 1266}
1267 1267
1268static bool cma_match_net_dev(const struct rdma_id_private *id_priv, 1268static bool cma_match_net_dev(const struct rdma_cm_id *id,
1269 const struct net_device *net_dev) 1269 const struct net_device *net_dev,
1270 u8 port_num)
1270{ 1271{
1271 const struct rdma_addr *addr = &id_priv->id.route.addr; 1272 const struct rdma_addr *addr = &id->route.addr;
1272 1273
1273 if (!net_dev) 1274 if (!net_dev)
1274 /* This request is an AF_IB request or a RoCE request */ 1275 /* This request is an AF_IB request or a RoCE request */
1275 return addr->src_addr.ss_family == AF_IB || 1276 return (!id->port_num || id->port_num == port_num) &&
1276 cma_protocol_roce(&id_priv->id); 1277 (addr->src_addr.ss_family == AF_IB ||
1278 cma_protocol_roce_dev_port(id->device, port_num));
1277 1279
1278 return !addr->dev_addr.bound_dev_if || 1280 return !addr->dev_addr.bound_dev_if ||
1279 (net_eq(dev_net(net_dev), addr->dev_addr.net) && 1281 (net_eq(dev_net(net_dev), addr->dev_addr.net) &&
@@ -1295,13 +1297,13 @@ static struct rdma_id_private *cma_find_listener(
1295 hlist_for_each_entry(id_priv, &bind_list->owners, node) { 1297 hlist_for_each_entry(id_priv, &bind_list->owners, node) {
1296 if (cma_match_private_data(id_priv, ib_event->private_data)) { 1298 if (cma_match_private_data(id_priv, ib_event->private_data)) {
1297 if (id_priv->id.device == cm_id->device && 1299 if (id_priv->id.device == cm_id->device &&
1298 cma_match_net_dev(id_priv, net_dev)) 1300 cma_match_net_dev(&id_priv->id, net_dev, req->port))
1299 return id_priv; 1301 return id_priv;
1300 list_for_each_entry(id_priv_dev, 1302 list_for_each_entry(id_priv_dev,
1301 &id_priv->listen_list, 1303 &id_priv->listen_list,
1302 listen_list) { 1304 listen_list) {
1303 if (id_priv_dev->id.device == cm_id->device && 1305 if (id_priv_dev->id.device == cm_id->device &&
1304 cma_match_net_dev(id_priv_dev, net_dev)) 1306 cma_match_net_dev(&id_priv_dev->id, net_dev, req->port))
1305 return id_priv_dev; 1307 return id_priv_dev;
1306 } 1308 }
1307 } 1309 }
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index 8d133c40fa0e..c394376ebe06 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -286,7 +286,7 @@ int mlx4_ib_destroy_srq(struct ib_srq *srq)
286 mlx4_ib_db_unmap_user(to_mucontext(srq->uobject->context), &msrq->db); 286 mlx4_ib_db_unmap_user(to_mucontext(srq->uobject->context), &msrq->db);
287 ib_umem_release(msrq->umem); 287 ib_umem_release(msrq->umem);
288 } else { 288 } else {
289 kfree(msrq->wrid); 289 kvfree(msrq->wrid);
290 mlx4_buf_free(dev->dev, msrq->msrq.max << msrq->msrq.wqe_shift, 290 mlx4_buf_free(dev->dev, msrq->msrq.max << msrq->msrq.wqe_shift,
291 &msrq->buf); 291 &msrq->buf);
292 mlx4_db_free(dev->dev, &msrq->db); 292 mlx4_db_free(dev->dev, &msrq->db);
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h
index ae80590aabdf..040bb8b5cb15 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma.h
@@ -232,6 +232,10 @@ struct phy_info {
232 u16 interface_type; 232 u16 interface_type;
233}; 233};
234 234
235enum ocrdma_flags {
236 OCRDMA_FLAGS_LINK_STATUS_INIT = 0x01
237};
238
235struct ocrdma_dev { 239struct ocrdma_dev {
236 struct ib_device ibdev; 240 struct ib_device ibdev;
237 struct ocrdma_dev_attr attr; 241 struct ocrdma_dev_attr attr;
@@ -287,6 +291,7 @@ struct ocrdma_dev {
287 atomic_t update_sl; 291 atomic_t update_sl;
288 u16 pvid; 292 u16 pvid;
289 u32 asic_id; 293 u32 asic_id;
294 u32 flags;
290 295
291 ulong last_stats_time; 296 ulong last_stats_time;
292 struct mutex stats_lock; /* provide synch for debugfs operations */ 297 struct mutex stats_lock; /* provide synch for debugfs operations */
@@ -591,4 +596,9 @@ static inline u8 ocrdma_is_enabled_and_synced(u32 state)
591 (state & OCRDMA_STATE_FLAG_SYNC); 596 (state & OCRDMA_STATE_FLAG_SYNC);
592} 597}
593 598
599static inline u8 ocrdma_get_ae_link_state(u32 ae_state)
600{
601 return ((ae_state & OCRDMA_AE_LSC_LS_MASK) >> OCRDMA_AE_LSC_LS_SHIFT);
602}
603
594#endif 604#endif
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 30f67bebffa3..283ca842ff74 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -579,6 +579,8 @@ static int ocrdma_mbx_create_mq(struct ocrdma_dev *dev,
579 579
580 cmd->async_event_bitmap = BIT(OCRDMA_ASYNC_GRP5_EVE_CODE); 580 cmd->async_event_bitmap = BIT(OCRDMA_ASYNC_GRP5_EVE_CODE);
581 cmd->async_event_bitmap |= BIT(OCRDMA_ASYNC_RDMA_EVE_CODE); 581 cmd->async_event_bitmap |= BIT(OCRDMA_ASYNC_RDMA_EVE_CODE);
582 /* Request link events on this MQ. */
583 cmd->async_event_bitmap |= BIT(OCRDMA_ASYNC_LINK_EVE_CODE);
582 584
583 cmd->async_cqid_ringsize = cq->id; 585 cmd->async_cqid_ringsize = cq->id;
584 cmd->async_cqid_ringsize |= (ocrdma_encoded_q_len(mq->len) << 586 cmd->async_cqid_ringsize |= (ocrdma_encoded_q_len(mq->len) <<
@@ -819,20 +821,42 @@ static void ocrdma_process_grp5_aync(struct ocrdma_dev *dev,
819 } 821 }
820} 822}
821 823
824static void ocrdma_process_link_state(struct ocrdma_dev *dev,
825 struct ocrdma_ae_mcqe *cqe)
826{
827 struct ocrdma_ae_lnkst_mcqe *evt;
828 u8 lstate;
829
830 evt = (struct ocrdma_ae_lnkst_mcqe *)cqe;
831 lstate = ocrdma_get_ae_link_state(evt->speed_state_ptn);
832
833 if (!(lstate & OCRDMA_AE_LSC_LLINK_MASK))
834 return;
835
836 if (dev->flags & OCRDMA_FLAGS_LINK_STATUS_INIT)
837 ocrdma_update_link_state(dev, (lstate & OCRDMA_LINK_ST_MASK));
838}
839
822static void ocrdma_process_acqe(struct ocrdma_dev *dev, void *ae_cqe) 840static void ocrdma_process_acqe(struct ocrdma_dev *dev, void *ae_cqe)
823{ 841{
824 /* async CQE processing */ 842 /* async CQE processing */
825 struct ocrdma_ae_mcqe *cqe = ae_cqe; 843 struct ocrdma_ae_mcqe *cqe = ae_cqe;
826 u32 evt_code = (cqe->valid_ae_event & OCRDMA_AE_MCQE_EVENT_CODE_MASK) >> 844 u32 evt_code = (cqe->valid_ae_event & OCRDMA_AE_MCQE_EVENT_CODE_MASK) >>
827 OCRDMA_AE_MCQE_EVENT_CODE_SHIFT; 845 OCRDMA_AE_MCQE_EVENT_CODE_SHIFT;
828 846 switch (evt_code) {
829 if (evt_code == OCRDMA_ASYNC_RDMA_EVE_CODE) 847 case OCRDMA_ASYNC_LINK_EVE_CODE:
848 ocrdma_process_link_state(dev, cqe);
849 break;
850 case OCRDMA_ASYNC_RDMA_EVE_CODE:
830 ocrdma_dispatch_ibevent(dev, cqe); 851 ocrdma_dispatch_ibevent(dev, cqe);
831 else if (evt_code == OCRDMA_ASYNC_GRP5_EVE_CODE) 852 break;
853 case OCRDMA_ASYNC_GRP5_EVE_CODE:
832 ocrdma_process_grp5_aync(dev, cqe); 854 ocrdma_process_grp5_aync(dev, cqe);
833 else 855 break;
856 default:
834 pr_err("%s(%d) invalid evt code=0x%x\n", __func__, 857 pr_err("%s(%d) invalid evt code=0x%x\n", __func__,
835 dev->id, evt_code); 858 dev->id, evt_code);
859 }
836} 860}
837 861
838static void ocrdma_process_mcqe(struct ocrdma_dev *dev, struct ocrdma_mcqe *cqe) 862static void ocrdma_process_mcqe(struct ocrdma_dev *dev, struct ocrdma_mcqe *cqe)
@@ -1363,7 +1387,8 @@ mbx_err:
1363 return status; 1387 return status;
1364} 1388}
1365 1389
1366int ocrdma_mbx_get_link_speed(struct ocrdma_dev *dev, u8 *lnk_speed) 1390int ocrdma_mbx_get_link_speed(struct ocrdma_dev *dev, u8 *lnk_speed,
1391 u8 *lnk_state)
1367{ 1392{
1368 int status = -ENOMEM; 1393 int status = -ENOMEM;
1369 struct ocrdma_get_link_speed_rsp *rsp; 1394 struct ocrdma_get_link_speed_rsp *rsp;
@@ -1384,8 +1409,11 @@ int ocrdma_mbx_get_link_speed(struct ocrdma_dev *dev, u8 *lnk_speed)
1384 goto mbx_err; 1409 goto mbx_err;
1385 1410
1386 rsp = (struct ocrdma_get_link_speed_rsp *)cmd; 1411 rsp = (struct ocrdma_get_link_speed_rsp *)cmd;
1387 *lnk_speed = (rsp->pflt_pps_ld_pnum & OCRDMA_PHY_PS_MASK) 1412 if (lnk_speed)
1388 >> OCRDMA_PHY_PS_SHIFT; 1413 *lnk_speed = (rsp->pflt_pps_ld_pnum & OCRDMA_PHY_PS_MASK)
1414 >> OCRDMA_PHY_PS_SHIFT;
1415 if (lnk_state)
1416 *lnk_state = (rsp->res_lnk_st & OCRDMA_LINK_ST_MASK);
1389 1417
1390mbx_err: 1418mbx_err:
1391 kfree(cmd); 1419 kfree(cmd);
@@ -2515,9 +2543,10 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
2515 ocrdma_cpu_to_le32(&cmd->params.sgid[0], sizeof(cmd->params.sgid)); 2543 ocrdma_cpu_to_le32(&cmd->params.sgid[0], sizeof(cmd->params.sgid));
2516 cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); 2544 cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8);
2517 2545
2518 if (vlan_id < 0x1000) { 2546 if (vlan_id == 0xFFFF)
2519 if (dev->pfc_state) { 2547 vlan_id = 0;
2520 vlan_id = 0; 2548 if (vlan_id || dev->pfc_state) {
2549 if (!vlan_id) {
2521 pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", 2550 pr_err("ocrdma%d:Using VLAN with PFC is recommended\n",
2522 dev->id); 2551 dev->id);
2523 pr_err("ocrdma%d:Using VLAN 0 for this connection\n", 2552 pr_err("ocrdma%d:Using VLAN 0 for this connection\n",
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.h b/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
index 7ed885c1851e..ebc1f442aec3 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
@@ -106,7 +106,8 @@ void ocrdma_ring_cq_db(struct ocrdma_dev *, u16 cq_id, bool armed,
106 bool solicited, u16 cqe_popped); 106 bool solicited, u16 cqe_popped);
107 107
108/* verbs specific mailbox commands */ 108/* verbs specific mailbox commands */
109int ocrdma_mbx_get_link_speed(struct ocrdma_dev *dev, u8 *lnk_speed); 109int ocrdma_mbx_get_link_speed(struct ocrdma_dev *dev, u8 *lnk_speed,
110 u8 *lnk_st);
110int ocrdma_query_config(struct ocrdma_dev *, 111int ocrdma_query_config(struct ocrdma_dev *,
111 struct ocrdma_mbx_query_config *config); 112 struct ocrdma_mbx_query_config *config);
112 113
@@ -153,5 +154,6 @@ char *port_speed_string(struct ocrdma_dev *dev);
153void ocrdma_init_service_level(struct ocrdma_dev *); 154void ocrdma_init_service_level(struct ocrdma_dev *);
154void ocrdma_alloc_pd_pool(struct ocrdma_dev *dev); 155void ocrdma_alloc_pd_pool(struct ocrdma_dev *dev);
155void ocrdma_free_pd_range(struct ocrdma_dev *dev); 156void ocrdma_free_pd_range(struct ocrdma_dev *dev);
157void ocrdma_update_link_state(struct ocrdma_dev *dev, u8 lstate);
156 158
157#endif /* __OCRDMA_HW_H__ */ 159#endif /* __OCRDMA_HW_H__ */
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 62b7009daa6c..3afb40b85159 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -290,6 +290,7 @@ static void ocrdma_remove_sysfiles(struct ocrdma_dev *dev)
290static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info) 290static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
291{ 291{
292 int status = 0, i; 292 int status = 0, i;
293 u8 lstate = 0;
293 struct ocrdma_dev *dev; 294 struct ocrdma_dev *dev;
294 295
295 dev = (struct ocrdma_dev *)ib_alloc_device(sizeof(struct ocrdma_dev)); 296 dev = (struct ocrdma_dev *)ib_alloc_device(sizeof(struct ocrdma_dev));
@@ -319,6 +320,11 @@ static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
319 if (status) 320 if (status)
320 goto alloc_err; 321 goto alloc_err;
321 322
323 /* Query Link state and update */
324 status = ocrdma_mbx_get_link_speed(dev, NULL, &lstate);
325 if (!status)
326 ocrdma_update_link_state(dev, lstate);
327
322 for (i = 0; i < ARRAY_SIZE(ocrdma_attributes); i++) 328 for (i = 0; i < ARRAY_SIZE(ocrdma_attributes); i++)
323 if (device_create_file(&dev->ibdev.dev, ocrdma_attributes[i])) 329 if (device_create_file(&dev->ibdev.dev, ocrdma_attributes[i]))
324 goto sysfs_err; 330 goto sysfs_err;
@@ -373,7 +379,7 @@ static void ocrdma_remove(struct ocrdma_dev *dev)
373 ocrdma_remove_free(dev); 379 ocrdma_remove_free(dev);
374} 380}
375 381
376static int ocrdma_open(struct ocrdma_dev *dev) 382static int ocrdma_dispatch_port_active(struct ocrdma_dev *dev)
377{ 383{
378 struct ib_event port_event; 384 struct ib_event port_event;
379 385
@@ -384,32 +390,9 @@ static int ocrdma_open(struct ocrdma_dev *dev)
384 return 0; 390 return 0;
385} 391}
386 392
387static int ocrdma_close(struct ocrdma_dev *dev) 393static int ocrdma_dispatch_port_error(struct ocrdma_dev *dev)
388{ 394{
389 int i;
390 struct ocrdma_qp *qp, **cur_qp;
391 struct ib_event err_event; 395 struct ib_event err_event;
392 struct ib_qp_attr attrs;
393 int attr_mask = IB_QP_STATE;
394
395 attrs.qp_state = IB_QPS_ERR;
396 mutex_lock(&dev->dev_lock);
397 if (dev->qp_tbl) {
398 cur_qp = dev->qp_tbl;
399 for (i = 0; i < OCRDMA_MAX_QP; i++) {
400 qp = cur_qp[i];
401 if (qp && qp->ibqp.qp_type != IB_QPT_GSI) {
402 /* change the QP state to ERROR */
403 _ocrdma_modify_qp(&qp->ibqp, &attrs, attr_mask);
404
405 err_event.event = IB_EVENT_QP_FATAL;
406 err_event.element.qp = &qp->ibqp;
407 err_event.device = &dev->ibdev;
408 ib_dispatch_event(&err_event);
409 }
410 }
411 }
412 mutex_unlock(&dev->dev_lock);
413 396
414 err_event.event = IB_EVENT_PORT_ERR; 397 err_event.event = IB_EVENT_PORT_ERR;
415 err_event.element.port_num = 1; 398 err_event.element.port_num = 1;
@@ -420,7 +403,7 @@ static int ocrdma_close(struct ocrdma_dev *dev)
420 403
421static void ocrdma_shutdown(struct ocrdma_dev *dev) 404static void ocrdma_shutdown(struct ocrdma_dev *dev)
422{ 405{
423 ocrdma_close(dev); 406 ocrdma_dispatch_port_error(dev);
424 ocrdma_remove(dev); 407 ocrdma_remove(dev);
425} 408}
426 409
@@ -431,18 +414,28 @@ static void ocrdma_shutdown(struct ocrdma_dev *dev)
431static void ocrdma_event_handler(struct ocrdma_dev *dev, u32 event) 414static void ocrdma_event_handler(struct ocrdma_dev *dev, u32 event)
432{ 415{
433 switch (event) { 416 switch (event) {
434 case BE_DEV_UP:
435 ocrdma_open(dev);
436 break;
437 case BE_DEV_DOWN:
438 ocrdma_close(dev);
439 break;
440 case BE_DEV_SHUTDOWN: 417 case BE_DEV_SHUTDOWN:
441 ocrdma_shutdown(dev); 418 ocrdma_shutdown(dev);
442 break; 419 break;
420 default:
421 break;
443 } 422 }
444} 423}
445 424
425void ocrdma_update_link_state(struct ocrdma_dev *dev, u8 lstate)
426{
427 if (!(dev->flags & OCRDMA_FLAGS_LINK_STATUS_INIT)) {
428 dev->flags |= OCRDMA_FLAGS_LINK_STATUS_INIT;
429 if (!lstate)
430 return;
431 }
432
433 if (!lstate)
434 ocrdma_dispatch_port_error(dev);
435 else
436 ocrdma_dispatch_port_active(dev);
437}
438
446static struct ocrdma_driver ocrdma_drv = { 439static struct ocrdma_driver ocrdma_drv = {
447 .name = "ocrdma_driver", 440 .name = "ocrdma_driver",
448 .add = ocrdma_add, 441 .add = ocrdma_add,
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h
index 6a38268bbe9f..99dd6fdf06d7 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h
@@ -465,8 +465,11 @@ struct ocrdma_ae_qp_mcqe {
465 u32 valid_ae_event; 465 u32 valid_ae_event;
466}; 466};
467 467
468#define OCRDMA_ASYNC_RDMA_EVE_CODE 0x14 468enum ocrdma_async_event_code {
469#define OCRDMA_ASYNC_GRP5_EVE_CODE 0x5 469 OCRDMA_ASYNC_LINK_EVE_CODE = 0x01,
470 OCRDMA_ASYNC_GRP5_EVE_CODE = 0x05,
471 OCRDMA_ASYNC_RDMA_EVE_CODE = 0x14
472};
470 473
471enum ocrdma_async_grp5_events { 474enum ocrdma_async_grp5_events {
472 OCRDMA_ASYNC_EVENT_QOS_VALUE = 0x01, 475 OCRDMA_ASYNC_EVENT_QOS_VALUE = 0x01,
@@ -489,6 +492,44 @@ enum OCRDMA_ASYNC_EVENT_TYPE {
489 OCRDMA_MAX_ASYNC_ERRORS 492 OCRDMA_MAX_ASYNC_ERRORS
490}; 493};
491 494
495struct ocrdma_ae_lnkst_mcqe {
496 u32 speed_state_ptn;
497 u32 qos_reason_falut;
498 u32 evt_tag;
499 u32 valid_ae_event;
500};
501
502enum {
503 OCRDMA_AE_LSC_PORT_NUM_MASK = 0x3F,
504 OCRDMA_AE_LSC_PT_SHIFT = 0x06,
505 OCRDMA_AE_LSC_PT_MASK = (0x03 <<
506 OCRDMA_AE_LSC_PT_SHIFT),
507 OCRDMA_AE_LSC_LS_SHIFT = 0x08,
508 OCRDMA_AE_LSC_LS_MASK = (0xFF <<
509 OCRDMA_AE_LSC_LS_SHIFT),
510 OCRDMA_AE_LSC_LD_SHIFT = 0x10,
511 OCRDMA_AE_LSC_LD_MASK = (0xFF <<
512 OCRDMA_AE_LSC_LD_SHIFT),
513 OCRDMA_AE_LSC_PPS_SHIFT = 0x18,
514 OCRDMA_AE_LSC_PPS_MASK = (0xFF <<
515 OCRDMA_AE_LSC_PPS_SHIFT),
516 OCRDMA_AE_LSC_PPF_MASK = 0xFF,
517 OCRDMA_AE_LSC_ER_SHIFT = 0x08,
518 OCRDMA_AE_LSC_ER_MASK = (0xFF <<
519 OCRDMA_AE_LSC_ER_SHIFT),
520 OCRDMA_AE_LSC_QOS_SHIFT = 0x10,
521 OCRDMA_AE_LSC_QOS_MASK = (0xFFFF <<
522 OCRDMA_AE_LSC_QOS_SHIFT)
523};
524
525enum {
526 OCRDMA_AE_LSC_PLINK_DOWN = 0x00,
527 OCRDMA_AE_LSC_PLINK_UP = 0x01,
528 OCRDMA_AE_LSC_LLINK_DOWN = 0x02,
529 OCRDMA_AE_LSC_LLINK_MASK = 0x02,
530 OCRDMA_AE_LSC_LLINK_UP = 0x03
531};
532
492/* mailbox command request and responses */ 533/* mailbox command request and responses */
493enum { 534enum {
494 OCRDMA_MBX_QUERY_CFG_CQ_OVERFLOW_SHIFT = 2, 535 OCRDMA_MBX_QUERY_CFG_CQ_OVERFLOW_SHIFT = 2,
@@ -676,7 +717,7 @@ enum {
676 OCRDMA_PHY_PFLT_SHIFT = 0x18, 717 OCRDMA_PHY_PFLT_SHIFT = 0x18,
677 OCRDMA_QOS_LNKSP_MASK = 0xFFFF0000, 718 OCRDMA_QOS_LNKSP_MASK = 0xFFFF0000,
678 OCRDMA_QOS_LNKSP_SHIFT = 0x10, 719 OCRDMA_QOS_LNKSP_SHIFT = 0x10,
679 OCRDMA_LLST_MASK = 0xFF, 720 OCRDMA_LINK_ST_MASK = 0x01,
680 OCRDMA_PLFC_MASK = 0x00000400, 721 OCRDMA_PLFC_MASK = 0x00000400,
681 OCRDMA_PLFC_SHIFT = 0x8, 722 OCRDMA_PLFC_SHIFT = 0x8,
682 OCRDMA_PLRFC_MASK = 0x00000200, 723 OCRDMA_PLRFC_MASK = 0x00000200,
@@ -691,7 +732,7 @@ struct ocrdma_get_link_speed_rsp {
691 732
692 u32 pflt_pps_ld_pnum; 733 u32 pflt_pps_ld_pnum;
693 u32 qos_lsp; 734 u32 qos_lsp;
694 u32 res_lls; 735 u32 res_lnk_st;
695}; 736};
696 737
697enum { 738enum {
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 583001bcfb8f..76e96f97b3f6 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -171,7 +171,7 @@ static inline void get_link_speed_and_width(struct ocrdma_dev *dev,
171 int status; 171 int status;
172 u8 speed; 172 u8 speed;
173 173
174 status = ocrdma_mbx_get_link_speed(dev, &speed); 174 status = ocrdma_mbx_get_link_speed(dev, &speed, NULL);
175 if (status) 175 if (status)
176 speed = OCRDMA_PHYS_LINK_SPEED_ZERO; 176 speed = OCRDMA_PHYS_LINK_SPEED_ZERO;
177 177
diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
index f434e89e1c7a..a54b339951a3 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -75,7 +75,7 @@ static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks,
75 struct nvm_block *blk; 75 struct nvm_block *blk;
76 int i; 76 int i;
77 77
78 lun = &gn->luns[(dev->nr_luns * ppa.g.ch) + ppa.g.lun]; 78 lun = &gn->luns[(dev->luns_per_chnl * ppa.g.ch) + ppa.g.lun];
79 79
80 for (i = 0; i < nr_blocks; i++) { 80 for (i = 0; i < nr_blocks; i++) {
81 if (blks[i] == 0) 81 if (blks[i] == 0)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index dbedc58d8c00..61aacab424cf 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4326,8 +4326,7 @@ action_store(struct mddev *mddev, const char *page, size_t len)
4326 } 4326 }
4327 mddev_unlock(mddev); 4327 mddev_unlock(mddev);
4328 } 4328 }
4329 } else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || 4329 } else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
4330 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
4331 return -EBUSY; 4330 return -EBUSY;
4332 else if (cmd_match(page, "resync")) 4331 else if (cmd_match(page, "resync"))
4333 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 4332 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
@@ -4340,8 +4339,12 @@ action_store(struct mddev *mddev, const char *page, size_t len)
4340 return -EINVAL; 4339 return -EINVAL;
4341 err = mddev_lock(mddev); 4340 err = mddev_lock(mddev);
4342 if (!err) { 4341 if (!err) {
4343 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 4342 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
4344 err = mddev->pers->start_reshape(mddev); 4343 err = -EBUSY;
4344 else {
4345 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
4346 err = mddev->pers->start_reshape(mddev);
4347 }
4345 mddev_unlock(mddev); 4348 mddev_unlock(mddev);
4346 } 4349 }
4347 if (err) 4350 if (err)
diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
index e87459f6d686..acd1460cf787 100644
--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/sched.h>
25#include <linux/spinlock.h> 26#include <linux/spinlock.h>
26#include <linux/types.h> 27#include <linux/types.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index b077e43b5ba9..c4cb15a3098c 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -236,7 +236,7 @@ int ubi_debugfs_init(void)
236 236
237 dfs_rootdir = debugfs_create_dir("ubi", NULL); 237 dfs_rootdir = debugfs_create_dir("ubi", NULL);
238 if (IS_ERR_OR_NULL(dfs_rootdir)) { 238 if (IS_ERR_OR_NULL(dfs_rootdir)) {
239 int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir); 239 int err = dfs_rootdir ? PTR_ERR(dfs_rootdir) : -ENODEV;
240 240
241 pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n", 241 pr_err("UBI error: cannot create \"ubi\" debugfs directory, error %d\n",
242 err); 242 err);
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 1fc23e48fe8e..10cf3b549959 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1299,7 +1299,7 @@ static int self_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
1299 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err)) 1299 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err))
1300 goto exit; 1300 goto exit;
1301 1301
1302 crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_EC_HDR_SIZE_CRC); 1302 crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_VID_HDR_SIZE_CRC);
1303 hdr_crc = be32_to_cpu(vid_hdr->hdr_crc); 1303 hdr_crc = be32_to_cpu(vid_hdr->hdr_crc);
1304 if (hdr_crc != crc) { 1304 if (hdr_crc != crc) {
1305 ubi_err(ubi, "bad VID header CRC at PEB %d, calculated %#08x, read %#08x", 1305 ubi_err(ubi, "bad VID header CRC at PEB %d, calculated %#08x, read %#08x",
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index eb4489f9082f..56065632a5b8 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -603,6 +603,7 @@ static int schedule_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
603 return 0; 603 return 0;
604} 604}
605 605
606static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk);
606/** 607/**
607 * do_sync_erase - run the erase worker synchronously. 608 * do_sync_erase - run the erase worker synchronously.
608 * @ubi: UBI device description object 609 * @ubi: UBI device description object
@@ -615,20 +616,16 @@ static int schedule_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
615static int do_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, 616static int do_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
616 int vol_id, int lnum, int torture) 617 int vol_id, int lnum, int torture)
617{ 618{
618 struct ubi_work *wl_wrk; 619 struct ubi_work wl_wrk;
619 620
620 dbg_wl("sync erase of PEB %i", e->pnum); 621 dbg_wl("sync erase of PEB %i", e->pnum);
621 622
622 wl_wrk = kmalloc(sizeof(struct ubi_work), GFP_NOFS); 623 wl_wrk.e = e;
623 if (!wl_wrk) 624 wl_wrk.vol_id = vol_id;
624 return -ENOMEM; 625 wl_wrk.lnum = lnum;
625 626 wl_wrk.torture = torture;
626 wl_wrk->e = e;
627 wl_wrk->vol_id = vol_id;
628 wl_wrk->lnum = lnum;
629 wl_wrk->torture = torture;
630 627
631 return erase_worker(ubi, wl_wrk, 0); 628 return __erase_worker(ubi, &wl_wrk);
632} 629}
633 630
634/** 631/**
@@ -1014,7 +1011,7 @@ out_unlock:
1014} 1011}
1015 1012
1016/** 1013/**
1017 * erase_worker - physical eraseblock erase worker function. 1014 * __erase_worker - physical eraseblock erase worker function.
1018 * @ubi: UBI device description object 1015 * @ubi: UBI device description object
1019 * @wl_wrk: the work object 1016 * @wl_wrk: the work object
1020 * @shutdown: non-zero if the worker has to free memory and exit 1017 * @shutdown: non-zero if the worker has to free memory and exit
@@ -1025,8 +1022,7 @@ out_unlock:
1025 * needed. Returns zero in case of success and a negative error code in case of 1022 * needed. Returns zero in case of success and a negative error code in case of
1026 * failure. 1023 * failure.
1027 */ 1024 */
1028static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk, 1025static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)
1029 int shutdown)
1030{ 1026{
1031 struct ubi_wl_entry *e = wl_wrk->e; 1027 struct ubi_wl_entry *e = wl_wrk->e;
1032 int pnum = e->pnum; 1028 int pnum = e->pnum;
@@ -1034,21 +1030,11 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1034 int lnum = wl_wrk->lnum; 1030 int lnum = wl_wrk->lnum;
1035 int err, available_consumed = 0; 1031 int err, available_consumed = 0;
1036 1032
1037 if (shutdown) {
1038 dbg_wl("cancel erasure of PEB %d EC %d", pnum, e->ec);
1039 kfree(wl_wrk);
1040 wl_entry_destroy(ubi, e);
1041 return 0;
1042 }
1043
1044 dbg_wl("erase PEB %d EC %d LEB %d:%d", 1033 dbg_wl("erase PEB %d EC %d LEB %d:%d",
1045 pnum, e->ec, wl_wrk->vol_id, wl_wrk->lnum); 1034 pnum, e->ec, wl_wrk->vol_id, wl_wrk->lnum);
1046 1035
1047 err = sync_erase(ubi, e, wl_wrk->torture); 1036 err = sync_erase(ubi, e, wl_wrk->torture);
1048 if (!err) { 1037 if (!err) {
1049 /* Fine, we've erased it successfully */
1050 kfree(wl_wrk);
1051
1052 spin_lock(&ubi->wl_lock); 1038 spin_lock(&ubi->wl_lock);
1053 wl_tree_add(e, &ubi->free); 1039 wl_tree_add(e, &ubi->free);
1054 ubi->free_count++; 1040 ubi->free_count++;
@@ -1066,7 +1052,6 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1066 } 1052 }
1067 1053
1068 ubi_err(ubi, "failed to erase PEB %d, error %d", pnum, err); 1054 ubi_err(ubi, "failed to erase PEB %d, error %d", pnum, err);
1069 kfree(wl_wrk);
1070 1055
1071 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN || 1056 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||
1072 err == -EBUSY) { 1057 err == -EBUSY) {
@@ -1075,6 +1060,7 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1075 /* Re-schedule the LEB for erasure */ 1060 /* Re-schedule the LEB for erasure */
1076 err1 = schedule_erase(ubi, e, vol_id, lnum, 0); 1061 err1 = schedule_erase(ubi, e, vol_id, lnum, 0);
1077 if (err1) { 1062 if (err1) {
1063 wl_entry_destroy(ubi, e);
1078 err = err1; 1064 err = err1;
1079 goto out_ro; 1065 goto out_ro;
1080 } 1066 }
@@ -1150,6 +1136,25 @@ out_ro:
1150 return err; 1136 return err;
1151} 1137}
1152 1138
1139static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1140 int shutdown)
1141{
1142 int ret;
1143
1144 if (shutdown) {
1145 struct ubi_wl_entry *e = wl_wrk->e;
1146
1147 dbg_wl("cancel erasure of PEB %d EC %d", e->pnum, e->ec);
1148 kfree(wl_wrk);
1149 wl_entry_destroy(ubi, e);
1150 return 0;
1151 }
1152
1153 ret = __erase_worker(ubi, wl_wrk);
1154 kfree(wl_wrk);
1155 return ret;
1156}
1157
1153/** 1158/**
1154 * ubi_wl_put_peb - return a PEB to the wear-leveling sub-system. 1159 * ubi_wl_put_peb - return a PEB to the wear-leveling sub-system.
1155 * @ubi: UBI device description object 1160 * @ubi: UBI device description object
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f8d7a2f06950..c82ab87fcbe8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3430,25 +3430,29 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
3430 return rc; 3430 return rc;
3431} 3431}
3432 3432
3433#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3) 3433/* VXLAN: 4 = 1 (for linear data BD) + 3 (2 for PBD and last BD) */
3434#define BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS 4
3435
3436/* Regular: 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */
3437#define BNX2X_NUM_TSO_WIN_SUB_BDS 3
3438
3439#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - BDS_PER_TX_PKT)
3434/* check if packet requires linearization (packet is too fragmented) 3440/* check if packet requires linearization (packet is too fragmented)
3435 no need to check fragmentation if page size > 8K (there will be no 3441 no need to check fragmentation if page size > 8K (there will be no
3436 violation to FW restrictions) */ 3442 violation to FW restrictions) */
3437static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb, 3443static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,
3438 u32 xmit_type) 3444 u32 xmit_type)
3439{ 3445{
3440 int to_copy = 0; 3446 int first_bd_sz = 0, num_tso_win_sub = BNX2X_NUM_TSO_WIN_SUB_BDS;
3441 int hlen = 0; 3447 int to_copy = 0, hlen = 0;
3442 int first_bd_sz = 0;
3443 3448
3444 /* 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */ 3449 if (xmit_type & XMIT_GSO_ENC)
3445 if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - 3)) { 3450 num_tso_win_sub = BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS;
3446 3451
3452 if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - num_tso_win_sub)) {
3447 if (xmit_type & XMIT_GSO) { 3453 if (xmit_type & XMIT_GSO) {
3448 unsigned short lso_mss = skb_shinfo(skb)->gso_size; 3454 unsigned short lso_mss = skb_shinfo(skb)->gso_size;
3449 /* Check if LSO packet needs to be copied: 3455 int wnd_size = MAX_FETCH_BD - num_tso_win_sub;
3450 3 = 1 (for headers BD) + 2 (for PBD and last BD) */
3451 int wnd_size = MAX_FETCH_BD - 3;
3452 /* Number of windows to check */ 3456 /* Number of windows to check */
3453 int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size; 3457 int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size;
3454 int wnd_idx = 0; 3458 int wnd_idx = 0;
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index d463563e1f70..6ee78c203eca 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -848,8 +848,6 @@ void be_roce_dev_remove(struct be_adapter *);
848/* 848/*
849 * internal function to open-close roce device during ifup-ifdown. 849 * internal function to open-close roce device during ifup-ifdown.
850 */ 850 */
851void be_roce_dev_open(struct be_adapter *);
852void be_roce_dev_close(struct be_adapter *);
853void be_roce_dev_shutdown(struct be_adapter *); 851void be_roce_dev_shutdown(struct be_adapter *);
854 852
855#endif /* BE_H */ 853#endif /* BE_H */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index b6ad02909d6b..8a1d9fffd7d6 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3299,8 +3299,10 @@ static int be_msix_register(struct be_adapter *adapter)
3299 3299
3300 return 0; 3300 return 0;
3301err_msix: 3301err_msix:
3302 for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--) 3302 for (i--; i >= 0; i--) {
3303 eqo = &adapter->eq_obj[i];
3303 free_irq(be_msix_vec_get(adapter, eqo), eqo); 3304 free_irq(be_msix_vec_get(adapter, eqo), eqo);
3305 }
3304 dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n", 3306 dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n",
3305 status); 3307 status);
3306 be_msix_disable(adapter); 3308 be_msix_disable(adapter);
@@ -3432,8 +3434,6 @@ static int be_close(struct net_device *netdev)
3432 3434
3433 be_disable_if_filters(adapter); 3435 be_disable_if_filters(adapter);
3434 3436
3435 be_roce_dev_close(adapter);
3436
3437 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { 3437 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
3438 for_all_evt_queues(adapter, eqo, i) { 3438 for_all_evt_queues(adapter, eqo, i) {
3439 napi_disable(&eqo->napi); 3439 napi_disable(&eqo->napi);
@@ -3601,8 +3601,6 @@ static int be_open(struct net_device *netdev)
3601 be_link_status_update(adapter, link_status); 3601 be_link_status_update(adapter, link_status);
3602 3602
3603 netif_tx_start_all_queues(netdev); 3603 netif_tx_start_all_queues(netdev);
3604 be_roce_dev_open(adapter);
3605
3606#ifdef CONFIG_BE2NET_VXLAN 3604#ifdef CONFIG_BE2NET_VXLAN
3607 if (skyhawk_chip(adapter)) 3605 if (skyhawk_chip(adapter))
3608 vxlan_get_rx_port(netdev); 3606 vxlan_get_rx_port(netdev);
diff --git a/drivers/net/ethernet/emulex/benet/be_roce.c b/drivers/net/ethernet/emulex/benet/be_roce.c
index 60368207bf58..4089156a7f5e 100644
--- a/drivers/net/ethernet/emulex/benet/be_roce.c
+++ b/drivers/net/ethernet/emulex/benet/be_roce.c
@@ -116,40 +116,6 @@ void be_roce_dev_remove(struct be_adapter *adapter)
116 } 116 }
117} 117}
118 118
119static void _be_roce_dev_open(struct be_adapter *adapter)
120{
121 if (ocrdma_drv && adapter->ocrdma_dev &&
122 ocrdma_drv->state_change_handler)
123 ocrdma_drv->state_change_handler(adapter->ocrdma_dev,
124 BE_DEV_UP);
125}
126
127void be_roce_dev_open(struct be_adapter *adapter)
128{
129 if (be_roce_supported(adapter)) {
130 mutex_lock(&be_adapter_list_lock);
131 _be_roce_dev_open(adapter);
132 mutex_unlock(&be_adapter_list_lock);
133 }
134}
135
136static void _be_roce_dev_close(struct be_adapter *adapter)
137{
138 if (ocrdma_drv && adapter->ocrdma_dev &&
139 ocrdma_drv->state_change_handler)
140 ocrdma_drv->state_change_handler(adapter->ocrdma_dev,
141 BE_DEV_DOWN);
142}
143
144void be_roce_dev_close(struct be_adapter *adapter)
145{
146 if (be_roce_supported(adapter)) {
147 mutex_lock(&be_adapter_list_lock);
148 _be_roce_dev_close(adapter);
149 mutex_unlock(&be_adapter_list_lock);
150 }
151}
152
153void be_roce_dev_shutdown(struct be_adapter *adapter) 119void be_roce_dev_shutdown(struct be_adapter *adapter)
154{ 120{
155 if (be_roce_supported(adapter)) { 121 if (be_roce_supported(adapter)) {
@@ -177,8 +143,6 @@ int be_roce_register_driver(struct ocrdma_driver *drv)
177 143
178 _be_roce_dev_add(dev); 144 _be_roce_dev_add(dev);
179 netdev = dev->netdev; 145 netdev = dev->netdev;
180 if (netif_running(netdev) && netif_oper_up(netdev))
181 _be_roce_dev_open(dev);
182 } 146 }
183 mutex_unlock(&be_adapter_list_lock); 147 mutex_unlock(&be_adapter_list_lock);
184 return 0; 148 return 0;
diff --git a/drivers/net/ethernet/emulex/benet/be_roce.h b/drivers/net/ethernet/emulex/benet/be_roce.h
index cde6ef905ec4..fde609789483 100644
--- a/drivers/net/ethernet/emulex/benet/be_roce.h
+++ b/drivers/net/ethernet/emulex/benet/be_roce.h
@@ -60,9 +60,7 @@ struct ocrdma_driver {
60 void (*state_change_handler) (struct ocrdma_dev *, u32 new_state); 60 void (*state_change_handler) (struct ocrdma_dev *, u32 new_state);
61}; 61};
62 62
63enum { 63enum be_roce_event {
64 BE_DEV_UP = 0,
65 BE_DEV_DOWN = 1,
66 BE_DEV_SHUTDOWN = 2 64 BE_DEV_SHUTDOWN = 2
67}; 65};
68 66
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
index 8a083d73efdb..038f9ce391e6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
@@ -242,6 +242,13 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
242 unsigned long flags; 242 unsigned long flags;
243 u64 ns, zero = 0; 243 u64 ns, zero = 0;
244 244
245 /* mlx4_en_init_timestamp is called for each netdev.
246 * mdev->ptp_clock is common for all ports, skip initialization if
247 * was done for other port.
248 */
249 if (mdev->ptp_clock)
250 return;
251
245 rwlock_init(&mdev->clock_lock); 252 rwlock_init(&mdev->clock_lock);
246 253
247 memset(&mdev->cycles, 0, sizeof(mdev->cycles)); 254 memset(&mdev->cycles, 0, sizeof(mdev->cycles));
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
index 005f910ec955..e0ec280a7fa1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
@@ -232,9 +232,6 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
232 if (mdev->pndev[i]) 232 if (mdev->pndev[i])
233 mlx4_en_destroy_netdev(mdev->pndev[i]); 233 mlx4_en_destroy_netdev(mdev->pndev[i]);
234 234
235 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
236 mlx4_en_remove_timestamp(mdev);
237
238 flush_workqueue(mdev->workqueue); 235 flush_workqueue(mdev->workqueue);
239 destroy_workqueue(mdev->workqueue); 236 destroy_workqueue(mdev->workqueue);
240 (void) mlx4_mr_free(dev, &mdev->mr); 237 (void) mlx4_mr_free(dev, &mdev->mr);
@@ -320,10 +317,6 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
320 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) 317 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH)
321 mdev->port_cnt++; 318 mdev->port_cnt++;
322 319
323 /* Initialize time stamp mechanism */
324 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
325 mlx4_en_init_timestamp(mdev);
326
327 /* Set default number of RX rings*/ 320 /* Set default number of RX rings*/
328 mlx4_en_set_num_rx_rings(mdev); 321 mlx4_en_set_num_rx_rings(mdev);
329 322
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 886e1bc86374..7869f97de5da 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2072,6 +2072,9 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
2072 /* flush any pending task for this netdev */ 2072 /* flush any pending task for this netdev */
2073 flush_workqueue(mdev->workqueue); 2073 flush_workqueue(mdev->workqueue);
2074 2074
2075 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
2076 mlx4_en_remove_timestamp(mdev);
2077
2075 /* Detach the netdev so tasks would not attempt to access it */ 2078 /* Detach the netdev so tasks would not attempt to access it */
2076 mutex_lock(&mdev->state_lock); 2079 mutex_lock(&mdev->state_lock);
2077 mdev->pndev[priv->port] = NULL; 2080 mdev->pndev[priv->port] = NULL;
@@ -3058,9 +3061,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3058 } 3061 }
3059 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); 3062 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
3060 3063
3064 /* Initialize time stamp mechanism */
3061 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) 3065 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
3062 queue_delayed_work(mdev->workqueue, &priv->service_task, 3066 mlx4_en_init_timestamp(mdev);
3063 SERVICE_TASK_DELAY); 3067
3068 queue_delayed_work(mdev->workqueue, &priv->service_task,
3069 SERVICE_TASK_DELAY);
3064 3070
3065 mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap, 3071 mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap,
3066 mdev->profile.prof[priv->port].rx_ppp, 3072 mdev->profile.prof[priv->port].rx_ppp,
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c
index b83f7c0fcf99..122c2ee3dfe2 100644
--- a/drivers/net/ethernet/natsemi/natsemi.c
+++ b/drivers/net/ethernet/natsemi/natsemi.c
@@ -1937,6 +1937,12 @@ static void refill_rx(struct net_device *dev)
1937 break; /* Better luck next round. */ 1937 break; /* Better luck next round. */
1938 np->rx_dma[entry] = pci_map_single(np->pci_dev, 1938 np->rx_dma[entry] = pci_map_single(np->pci_dev,
1939 skb->data, buflen, PCI_DMA_FROMDEVICE); 1939 skb->data, buflen, PCI_DMA_FROMDEVICE);
1940 if (pci_dma_mapping_error(np->pci_dev,
1941 np->rx_dma[entry])) {
1942 dev_kfree_skb_any(skb);
1943 np->rx_skbuff[entry] = NULL;
1944 break; /* Better luck next round. */
1945 }
1940 np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); 1946 np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]);
1941 } 1947 }
1942 np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); 1948 np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz);
@@ -2093,6 +2099,12 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
2093 np->tx_skbuff[entry] = skb; 2099 np->tx_skbuff[entry] = skb;
2094 np->tx_dma[entry] = pci_map_single(np->pci_dev, 2100 np->tx_dma[entry] = pci_map_single(np->pci_dev,
2095 skb->data,skb->len, PCI_DMA_TODEVICE); 2101 skb->data,skb->len, PCI_DMA_TODEVICE);
2102 if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) {
2103 np->tx_skbuff[entry] = NULL;
2104 dev_kfree_skb_irq(skb);
2105 dev->stats.tx_dropped++;
2106 return NETDEV_TX_OK;
2107 }
2096 2108
2097 np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]); 2109 np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]);
2098 2110
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
index b1a452f291ee..34906750b7e7 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
@@ -252,7 +252,7 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter)
252 state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); 252 state = QLCRDX(ahw, QLC_83XX_VNIC_STATE);
253 } 253 }
254 254
255 if (!idc->vnic_wait_limit) { 255 if (state != QLCNIC_DEV_NPAR_OPER) {
256 dev_err(&adapter->pdev->dev, 256 dev_err(&adapter->pdev->dev,
257 "vNIC mode not operational, state check timed out.\n"); 257 "vNIC mode not operational, state check timed out.\n");
258 return -EIO; 258 return -EIO;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index a0eaf50499a2..6a8fc0f341ff 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1167,6 +1167,7 @@ static void sh_eth_ring_format(struct net_device *ndev)
1167 int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; 1167 int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;
1168 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1; 1168 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
1169 dma_addr_t dma_addr; 1169 dma_addr_t dma_addr;
1170 u32 buf_len;
1170 1171
1171 mdp->cur_rx = 0; 1172 mdp->cur_rx = 0;
1172 mdp->cur_tx = 0; 1173 mdp->cur_tx = 0;
@@ -1187,9 +1188,9 @@ static void sh_eth_ring_format(struct net_device *ndev)
1187 /* RX descriptor */ 1188 /* RX descriptor */
1188 rxdesc = &mdp->rx_ring[i]; 1189 rxdesc = &mdp->rx_ring[i];
1189 /* The size of the buffer is a multiple of 32 bytes. */ 1190 /* The size of the buffer is a multiple of 32 bytes. */
1190 rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32); 1191 buf_len = ALIGN(mdp->rx_buf_sz, 32);
1191 dma_addr = dma_map_single(&ndev->dev, skb->data, 1192 rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);
1192 rxdesc->buffer_length, 1193 dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len,
1193 DMA_FROM_DEVICE); 1194 DMA_FROM_DEVICE);
1194 if (dma_mapping_error(&ndev->dev, dma_addr)) { 1195 if (dma_mapping_error(&ndev->dev, dma_addr)) {
1195 kfree_skb(skb); 1196 kfree_skb(skb);
@@ -1220,7 +1221,7 @@ static void sh_eth_ring_format(struct net_device *ndev)
1220 mdp->tx_skbuff[i] = NULL; 1221 mdp->tx_skbuff[i] = NULL;
1221 txdesc = &mdp->tx_ring[i]; 1222 txdesc = &mdp->tx_ring[i];
1222 txdesc->status = cpu_to_edmac(mdp, TD_TFP); 1223 txdesc->status = cpu_to_edmac(mdp, TD_TFP);
1223 txdesc->buffer_length = 0; 1224 txdesc->len = cpu_to_edmac(mdp, 0);
1224 if (i == 0) { 1225 if (i == 0) {
1225 /* Tx descriptor address set */ 1226 /* Tx descriptor address set */
1226 sh_eth_write(ndev, mdp->tx_desc_dma, TDLAR); 1227 sh_eth_write(ndev, mdp->tx_desc_dma, TDLAR);
@@ -1429,7 +1430,8 @@ static int sh_eth_txfree(struct net_device *ndev)
1429 if (mdp->tx_skbuff[entry]) { 1430 if (mdp->tx_skbuff[entry]) {
1430 dma_unmap_single(&ndev->dev, 1431 dma_unmap_single(&ndev->dev,
1431 edmac_to_cpu(mdp, txdesc->addr), 1432 edmac_to_cpu(mdp, txdesc->addr),
1432 txdesc->buffer_length, DMA_TO_DEVICE); 1433 edmac_to_cpu(mdp, txdesc->len) >> 16,
1434 DMA_TO_DEVICE);
1433 dev_kfree_skb_irq(mdp->tx_skbuff[entry]); 1435 dev_kfree_skb_irq(mdp->tx_skbuff[entry]);
1434 mdp->tx_skbuff[entry] = NULL; 1436 mdp->tx_skbuff[entry] = NULL;
1435 free_num++; 1437 free_num++;
@@ -1439,7 +1441,7 @@ static int sh_eth_txfree(struct net_device *ndev)
1439 txdesc->status |= cpu_to_edmac(mdp, TD_TDLE); 1441 txdesc->status |= cpu_to_edmac(mdp, TD_TDLE);
1440 1442
1441 ndev->stats.tx_packets++; 1443 ndev->stats.tx_packets++;
1442 ndev->stats.tx_bytes += txdesc->buffer_length; 1444 ndev->stats.tx_bytes += edmac_to_cpu(mdp, txdesc->len) >> 16;
1443 } 1445 }
1444 return free_num; 1446 return free_num;
1445} 1447}
@@ -1458,6 +1460,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1458 u32 desc_status; 1460 u32 desc_status;
1459 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1; 1461 int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
1460 dma_addr_t dma_addr; 1462 dma_addr_t dma_addr;
1463 u32 buf_len;
1461 1464
1462 boguscnt = min(boguscnt, *quota); 1465 boguscnt = min(boguscnt, *quota);
1463 limit = boguscnt; 1466 limit = boguscnt;
@@ -1466,7 +1469,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1466 /* RACT bit must be checked before all the following reads */ 1469 /* RACT bit must be checked before all the following reads */
1467 dma_rmb(); 1470 dma_rmb();
1468 desc_status = edmac_to_cpu(mdp, rxdesc->status); 1471 desc_status = edmac_to_cpu(mdp, rxdesc->status);
1469 pkt_len = rxdesc->frame_length; 1472 pkt_len = edmac_to_cpu(mdp, rxdesc->len) & RD_RFL;
1470 1473
1471 if (--boguscnt < 0) 1474 if (--boguscnt < 0)
1472 break; 1475 break;
@@ -1532,7 +1535,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1532 entry = mdp->dirty_rx % mdp->num_rx_ring; 1535 entry = mdp->dirty_rx % mdp->num_rx_ring;
1533 rxdesc = &mdp->rx_ring[entry]; 1536 rxdesc = &mdp->rx_ring[entry];
1534 /* The size of the buffer is 32 byte boundary. */ 1537 /* The size of the buffer is 32 byte boundary. */
1535 rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32); 1538 buf_len = ALIGN(mdp->rx_buf_sz, 32);
1539 rxdesc->len = cpu_to_edmac(mdp, buf_len << 16);
1536 1540
1537 if (mdp->rx_skbuff[entry] == NULL) { 1541 if (mdp->rx_skbuff[entry] == NULL) {
1538 skb = netdev_alloc_skb(ndev, skbuff_size); 1542 skb = netdev_alloc_skb(ndev, skbuff_size);
@@ -1540,8 +1544,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1540 break; /* Better luck next round. */ 1544 break; /* Better luck next round. */
1541 sh_eth_set_receive_align(skb); 1545 sh_eth_set_receive_align(skb);
1542 dma_addr = dma_map_single(&ndev->dev, skb->data, 1546 dma_addr = dma_map_single(&ndev->dev, skb->data,
1543 rxdesc->buffer_length, 1547 buf_len, DMA_FROM_DEVICE);
1544 DMA_FROM_DEVICE);
1545 if (dma_mapping_error(&ndev->dev, dma_addr)) { 1548 if (dma_mapping_error(&ndev->dev, dma_addr)) {
1546 kfree_skb(skb); 1549 kfree_skb(skb);
1547 break; 1550 break;
@@ -2407,7 +2410,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
2407 return NETDEV_TX_OK; 2410 return NETDEV_TX_OK;
2408 } 2411 }
2409 txdesc->addr = cpu_to_edmac(mdp, dma_addr); 2412 txdesc->addr = cpu_to_edmac(mdp, dma_addr);
2410 txdesc->buffer_length = skb->len; 2413 txdesc->len = cpu_to_edmac(mdp, skb->len << 16);
2411 2414
2412 dma_wmb(); /* TACT bit must be set after all the above writes */ 2415 dma_wmb(); /* TACT bit must be set after all the above writes */
2413 if (entry >= mdp->num_tx_ring - 1) 2416 if (entry >= mdp->num_tx_ring - 1)
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 26ad1cf0bcf1..72fcfc924589 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -283,7 +283,7 @@ enum DMAC_IM_BIT {
283 DMAC_M_RINT1 = 0x00000001, 283 DMAC_M_RINT1 = 0x00000001,
284}; 284};
285 285
286/* Receive descriptor bit */ 286/* Receive descriptor 0 bits */
287enum RD_STS_BIT { 287enum RD_STS_BIT {
288 RD_RACT = 0x80000000, RD_RDLE = 0x40000000, 288 RD_RACT = 0x80000000, RD_RDLE = 0x40000000,
289 RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000, 289 RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000,
@@ -298,6 +298,12 @@ enum RD_STS_BIT {
298#define RDFEND RD_RFP0 298#define RDFEND RD_RFP0
299#define RD_RFP (RD_RFP1|RD_RFP0) 299#define RD_RFP (RD_RFP1|RD_RFP0)
300 300
301/* Receive descriptor 1 bits */
302enum RD_LEN_BIT {
303 RD_RFL = 0x0000ffff, /* receive frame length */
304 RD_RBL = 0xffff0000, /* receive buffer length */
305};
306
301/* FCFTR */ 307/* FCFTR */
302enum FCFTR_BIT { 308enum FCFTR_BIT {
303 FCFTR_RFF2 = 0x00040000, FCFTR_RFF1 = 0x00020000, 309 FCFTR_RFF2 = 0x00040000, FCFTR_RFF1 = 0x00020000,
@@ -307,7 +313,7 @@ enum FCFTR_BIT {
307#define DEFAULT_FIFO_F_D_RFF (FCFTR_RFF2 | FCFTR_RFF1 | FCFTR_RFF0) 313#define DEFAULT_FIFO_F_D_RFF (FCFTR_RFF2 | FCFTR_RFF1 | FCFTR_RFF0)
308#define DEFAULT_FIFO_F_D_RFD (FCFTR_RFD2 | FCFTR_RFD1 | FCFTR_RFD0) 314#define DEFAULT_FIFO_F_D_RFD (FCFTR_RFD2 | FCFTR_RFD1 | FCFTR_RFD0)
309 315
310/* Transmit descriptor bit */ 316/* Transmit descriptor 0 bits */
311enum TD_STS_BIT { 317enum TD_STS_BIT {
312 TD_TACT = 0x80000000, TD_TDLE = 0x40000000, 318 TD_TACT = 0x80000000, TD_TDLE = 0x40000000,
313 TD_TFP1 = 0x20000000, TD_TFP0 = 0x10000000, 319 TD_TFP1 = 0x20000000, TD_TFP0 = 0x10000000,
@@ -317,6 +323,11 @@ enum TD_STS_BIT {
317#define TDFEND TD_TFP0 323#define TDFEND TD_TFP0
318#define TD_TFP (TD_TFP1|TD_TFP0) 324#define TD_TFP (TD_TFP1|TD_TFP0)
319 325
326/* Transmit descriptor 1 bits */
327enum TD_LEN_BIT {
328 TD_TBL = 0xffff0000, /* transmit buffer length */
329};
330
320/* RMCR */ 331/* RMCR */
321enum RMCR_BIT { 332enum RMCR_BIT {
322 RMCR_RNC = 0x00000001, 333 RMCR_RNC = 0x00000001,
@@ -425,15 +436,9 @@ enum TSU_FWSLC_BIT {
425 */ 436 */
426struct sh_eth_txdesc { 437struct sh_eth_txdesc {
427 u32 status; /* TD0 */ 438 u32 status; /* TD0 */
428#if defined(__LITTLE_ENDIAN) 439 u32 len; /* TD1 */
429 u16 pad0; /* TD1 */
430 u16 buffer_length; /* TD1 */
431#else
432 u16 buffer_length; /* TD1 */
433 u16 pad0; /* TD1 */
434#endif
435 u32 addr; /* TD2 */ 440 u32 addr; /* TD2 */
436 u32 pad1; /* padding data */ 441 u32 pad0; /* padding data */
437} __aligned(2) __packed; 442} __aligned(2) __packed;
438 443
439/* The sh ether Rx buffer descriptors. 444/* The sh ether Rx buffer descriptors.
@@ -441,13 +446,7 @@ struct sh_eth_txdesc {
441 */ 446 */
442struct sh_eth_rxdesc { 447struct sh_eth_rxdesc {
443 u32 status; /* RD0 */ 448 u32 status; /* RD0 */
444#if defined(__LITTLE_ENDIAN) 449 u32 len; /* RD1 */
445 u16 frame_length; /* RD1 */
446 u16 buffer_length; /* RD1 */
447#else
448 u16 buffer_length; /* RD1 */
449 u16 frame_length; /* RD1 */
450#endif
451 u32 addr; /* RD2 */ 450 u32 addr; /* RD2 */
452 u32 pad0; /* padding data */ 451 u32 pad0; /* padding data */
453} __aligned(2) __packed; 452} __aligned(2) __packed;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 48b92c9de12a..fc958067d10a 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2026,45 +2026,54 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
2026 for_each_child_of_node(node, slave_node) { 2026 for_each_child_of_node(node, slave_node) {
2027 struct cpsw_slave_data *slave_data = data->slave_data + i; 2027 struct cpsw_slave_data *slave_data = data->slave_data + i;
2028 const void *mac_addr = NULL; 2028 const void *mac_addr = NULL;
2029 u32 phyid;
2030 int lenp; 2029 int lenp;
2031 const __be32 *parp; 2030 const __be32 *parp;
2032 struct device_node *mdio_node;
2033 struct platform_device *mdio;
2034 2031
2035 /* This is no slave child node, continue */ 2032 /* This is no slave child node, continue */
2036 if (strcmp(slave_node->name, "slave")) 2033 if (strcmp(slave_node->name, "slave"))
2037 continue; 2034 continue;
2038 2035
2039 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); 2036 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
2037 parp = of_get_property(slave_node, "phy_id", &lenp);
2040 if (of_phy_is_fixed_link(slave_node)) { 2038 if (of_phy_is_fixed_link(slave_node)) {
2041 struct phy_device *pd; 2039 struct device_node *phy_node;
2040 struct phy_device *phy_dev;
2042 2041
2042 /* In the case of a fixed PHY, the DT node associated
2043 * to the PHY is the Ethernet MAC DT node.
2044 */
2043 ret = of_phy_register_fixed_link(slave_node); 2045 ret = of_phy_register_fixed_link(slave_node);
2044 if (ret) 2046 if (ret)
2045 return ret; 2047 return ret;
2046 pd = of_phy_find_device(slave_node); 2048 phy_node = of_node_get(slave_node);
2047 if (!pd) 2049 phy_dev = of_phy_find_device(phy_node);
2050 if (!phy_dev)
2048 return -ENODEV; 2051 return -ENODEV;
2049 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), 2052 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2050 PHY_ID_FMT, pd->bus->id, pd->phy_id); 2053 PHY_ID_FMT, phy_dev->bus->id, phy_dev->addr);
2051 goto no_phy_slave; 2054 } else if (parp) {
2052 } 2055 u32 phyid;
2053 parp = of_get_property(slave_node, "phy_id", &lenp); 2056 struct device_node *mdio_node;
2054 if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { 2057 struct platform_device *mdio;
2055 dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); 2058
2059 if (lenp != (sizeof(__be32) * 2)) {
2060 dev_err(&pdev->dev, "Invalid slave[%d] phy_id property\n", i);
2061 goto no_phy_slave;
2062 }
2063 mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
2064 phyid = be32_to_cpup(parp+1);
2065 mdio = of_find_device_by_node(mdio_node);
2066 of_node_put(mdio_node);
2067 if (!mdio) {
2068 dev_err(&pdev->dev, "Missing mdio platform device\n");
2069 return -EINVAL;
2070 }
2071 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2072 PHY_ID_FMT, mdio->name, phyid);
2073 } else {
2074 dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);
2056 goto no_phy_slave; 2075 goto no_phy_slave;
2057 } 2076 }
2058 mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
2059 phyid = be32_to_cpup(parp+1);
2060 mdio = of_find_device_by_node(mdio_node);
2061 of_node_put(mdio_node);
2062 if (!mdio) {
2063 dev_err(&pdev->dev, "Missing mdio platform device\n");
2064 return -EINVAL;
2065 }
2066 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2067 PHY_ID_FMT, mdio->name, phyid);
2068 slave_data->phy_if = of_get_phy_mode(slave_node); 2077 slave_data->phy_if = of_get_phy_mode(slave_node);
2069 if (slave_data->phy_if < 0) { 2078 if (slave_data->phy_if < 0) {
2070 dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", 2079 dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n",
@@ -2418,7 +2427,7 @@ static int cpsw_probe(struct platform_device *pdev)
2418 ndev->irq = platform_get_irq(pdev, 1); 2427 ndev->irq = platform_get_irq(pdev, 1);
2419 if (ndev->irq < 0) { 2428 if (ndev->irq < 0) {
2420 dev_err(priv->dev, "error getting irq resource\n"); 2429 dev_err(priv->dev, "error getting irq resource\n");
2421 ret = -ENOENT; 2430 ret = ndev->irq;
2422 goto clean_ale_ret; 2431 goto clean_ale_ret;
2423 } 2432 }
2424 2433
@@ -2439,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev)
2439 2448
2440 /* RX IRQ */ 2449 /* RX IRQ */
2441 irq = platform_get_irq(pdev, 1); 2450 irq = platform_get_irq(pdev, 1);
2442 if (irq < 0) 2451 if (irq < 0) {
2452 ret = irq;
2443 goto clean_ale_ret; 2453 goto clean_ale_ret;
2454 }
2444 2455
2445 priv->irqs_table[0] = irq; 2456 priv->irqs_table[0] = irq;
2446 ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, 2457 ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt,
@@ -2452,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev)
2452 2463
2453 /* TX IRQ */ 2464 /* TX IRQ */
2454 irq = platform_get_irq(pdev, 2); 2465 irq = platform_get_irq(pdev, 2);
2455 if (irq < 0) 2466 if (irq < 0) {
2467 ret = irq;
2456 goto clean_ale_ret; 2468 goto clean_ale_ret;
2469 }
2457 2470
2458 priv->irqs_table[1] = irq; 2471 priv->irqs_table[1] = irq;
2459 ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt, 2472 ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt,
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index c2b79f5d1c89..58efdec12f30 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1155,7 +1155,7 @@ static int geneve_configure(struct net *net, struct net_device *dev,
1155 struct geneve_net *gn = net_generic(net, geneve_net_id); 1155 struct geneve_net *gn = net_generic(net, geneve_net_id);
1156 struct geneve_dev *t, *geneve = netdev_priv(dev); 1156 struct geneve_dev *t, *geneve = netdev_priv(dev);
1157 bool tun_collect_md, tun_on_same_port; 1157 bool tun_collect_md, tun_on_same_port;
1158 int err; 1158 int err, encap_len;
1159 1159
1160 if (!remote) 1160 if (!remote)
1161 return -EINVAL; 1161 return -EINVAL;
@@ -1187,6 +1187,14 @@ static int geneve_configure(struct net *net, struct net_device *dev,
1187 if (t) 1187 if (t)
1188 return -EBUSY; 1188 return -EBUSY;
1189 1189
1190 /* make enough headroom for basic scenario */
1191 encap_len = GENEVE_BASE_HLEN + ETH_HLEN;
1192 if (remote->sa.sa_family == AF_INET)
1193 encap_len += sizeof(struct iphdr);
1194 else
1195 encap_len += sizeof(struct ipv6hdr);
1196 dev->needed_headroom = encap_len + ETH_HLEN;
1197
1190 if (metadata) { 1198 if (metadata) {
1191 if (tun_on_same_port) 1199 if (tun_on_same_port)
1192 return -EPERM; 1200 return -EPERM;
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 7c4a4151ef0f..9f0b1c342b77 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -683,14 +683,14 @@ static void sixpack_close(struct tty_struct *tty)
683 if (!atomic_dec_and_test(&sp->refcnt)) 683 if (!atomic_dec_and_test(&sp->refcnt))
684 down(&sp->dead_sem); 684 down(&sp->dead_sem);
685 685
686 unregister_netdev(sp->dev); 686 del_timer_sync(&sp->tx_t);
687 687 del_timer_sync(&sp->resync_t);
688 del_timer(&sp->tx_t);
689 del_timer(&sp->resync_t);
690 688
691 /* Free all 6pack frame buffers. */ 689 /* Free all 6pack frame buffers. */
692 kfree(sp->rbuff); 690 kfree(sp->rbuff);
693 kfree(sp->xbuff); 691 kfree(sp->xbuff);
692
693 unregister_netdev(sp->dev);
694} 694}
695 695
696/* Perform I/O control on an active 6pack channel. */ 696/* Perform I/O control on an active 6pack channel. */
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 216bfd350169..0b72b9de5207 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -798,13 +798,13 @@ static void mkiss_close(struct tty_struct *tty)
798 if (!atomic_dec_and_test(&ax->refcnt)) 798 if (!atomic_dec_and_test(&ax->refcnt))
799 down(&ax->dead_sem); 799 down(&ax->dead_sem);
800 800
801 unregister_netdev(ax->dev);
802
803 /* Free all AX25 frame buffers. */ 801 /* Free all AX25 frame buffers. */
804 kfree(ax->rbuff); 802 kfree(ax->rbuff);
805 kfree(ax->xbuff); 803 kfree(ax->xbuff);
806 804
807 ax->tty = NULL; 805 ax->tty = NULL;
806
807 unregister_netdev(ax->dev);
808} 808}
809 809
810/* Perform I/O control on an active ax25 channel. */ 810/* Perform I/O control on an active ax25 channel. */
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 8973abdec9f6..bdd83d95ec0a 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -100,7 +100,7 @@ static const struct net_device_ops cdc_mbim_netdev_ops = {
100 .ndo_stop = usbnet_stop, 100 .ndo_stop = usbnet_stop,
101 .ndo_start_xmit = usbnet_start_xmit, 101 .ndo_start_xmit = usbnet_start_xmit,
102 .ndo_tx_timeout = usbnet_tx_timeout, 102 .ndo_tx_timeout = usbnet_tx_timeout,
103 .ndo_change_mtu = usbnet_change_mtu, 103 .ndo_change_mtu = cdc_ncm_change_mtu,
104 .ndo_set_mac_address = eth_mac_addr, 104 .ndo_set_mac_address = eth_mac_addr,
105 .ndo_validate_addr = eth_validate_addr, 105 .ndo_validate_addr = eth_validate_addr,
106 .ndo_vlan_rx_add_vid = cdc_mbim_rx_add_vid, 106 .ndo_vlan_rx_add_vid = cdc_mbim_rx_add_vid,
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 1e9843a41168..e8a1144c5a8b 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -41,6 +41,7 @@
41#include <linux/module.h> 41#include <linux/module.h>
42#include <linux/netdevice.h> 42#include <linux/netdevice.h>
43#include <linux/ctype.h> 43#include <linux/ctype.h>
44#include <linux/etherdevice.h>
44#include <linux/ethtool.h> 45#include <linux/ethtool.h>
45#include <linux/workqueue.h> 46#include <linux/workqueue.h>
46#include <linux/mii.h> 47#include <linux/mii.h>
@@ -689,6 +690,33 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx)
689 kfree(ctx); 690 kfree(ctx);
690} 691}
691 692
693/* we need to override the usbnet change_mtu ndo for two reasons:
694 * - respect the negotiated maximum datagram size
695 * - avoid unwanted changes to rx and tx buffers
696 */
697int cdc_ncm_change_mtu(struct net_device *net, int new_mtu)
698{
699 struct usbnet *dev = netdev_priv(net);
700 struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
701 int maxmtu = ctx->max_datagram_size - cdc_ncm_eth_hlen(dev);
702
703 if (new_mtu <= 0 || new_mtu > maxmtu)
704 return -EINVAL;
705 net->mtu = new_mtu;
706 return 0;
707}
708EXPORT_SYMBOL_GPL(cdc_ncm_change_mtu);
709
710static const struct net_device_ops cdc_ncm_netdev_ops = {
711 .ndo_open = usbnet_open,
712 .ndo_stop = usbnet_stop,
713 .ndo_start_xmit = usbnet_start_xmit,
714 .ndo_tx_timeout = usbnet_tx_timeout,
715 .ndo_change_mtu = cdc_ncm_change_mtu,
716 .ndo_set_mac_address = eth_mac_addr,
717 .ndo_validate_addr = eth_validate_addr,
718};
719
692int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) 720int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags)
693{ 721{
694 struct cdc_ncm_ctx *ctx; 722 struct cdc_ncm_ctx *ctx;
@@ -823,6 +851,9 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
823 /* add our sysfs attrs */ 851 /* add our sysfs attrs */
824 dev->net->sysfs_groups[0] = &cdc_ncm_sysfs_attr_group; 852 dev->net->sysfs_groups[0] = &cdc_ncm_sysfs_attr_group;
825 853
854 /* must handle MTU changes */
855 dev->net->netdev_ops = &cdc_ncm_netdev_ops;
856
826 return 0; 857 return 0;
827 858
828error2: 859error2:
@@ -1558,6 +1589,24 @@ static const struct usb_device_id cdc_devs[] = {
1558 .driver_info = (unsigned long) &wwan_info, 1589 .driver_info = (unsigned long) &wwan_info,
1559 }, 1590 },
1560 1591
1592 /* DW5812 LTE Verizon Mobile Broadband Card
1593 * Unlike DW5550 this device requires FLAG_NOARP
1594 */
1595 { USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x81bb,
1596 USB_CLASS_COMM,
1597 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
1598 .driver_info = (unsigned long)&wwan_noarp_info,
1599 },
1600
1601 /* DW5813 LTE AT&T Mobile Broadband Card
1602 * Unlike DW5550 this device requires FLAG_NOARP
1603 */
1604 { USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x81bc,
1605 USB_CLASS_COMM,
1606 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
1607 .driver_info = (unsigned long)&wwan_noarp_info,
1608 },
1609
1561 /* Dell branded MBM devices like DW5550 */ 1610 /* Dell branded MBM devices like DW5550 */
1562 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 1611 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
1563 | USB_DEVICE_ID_MATCH_VENDOR, 1612 | USB_DEVICE_ID_MATCH_VENDOR,
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 0ef4a5ad5557..ba21d072be31 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -117,12 +117,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
117 kfree_skb(skb); 117 kfree_skb(skb);
118 goto drop; 118 goto drop;
119 } 119 }
120 /* don't change ip_summed == CHECKSUM_PARTIAL, as that
121 * will cause bad checksum on forwarded packets
122 */
123 if (skb->ip_summed == CHECKSUM_NONE &&
124 rcv->features & NETIF_F_RXCSUM)
125 skb->ip_summed = CHECKSUM_UNNECESSARY;
126 120
127 if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) { 121 if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
128 struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats); 122 struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
index bf88ec3a65fa..d9a4aee246a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -69,13 +69,19 @@
69#include "iwl-agn-hw.h" 69#include "iwl-agn-hw.h"
70 70
71/* Highest firmware API version supported */ 71/* Highest firmware API version supported */
72#define IWL7260_UCODE_API_MAX 19 72#define IWL7260_UCODE_API_MAX 17
73#define IWL7265_UCODE_API_MAX 19
74#define IWL7265D_UCODE_API_MAX 19
73 75
74/* Oldest version we won't warn about */ 76/* Oldest version we won't warn about */
75#define IWL7260_UCODE_API_OK 13 77#define IWL7260_UCODE_API_OK 13
78#define IWL7265_UCODE_API_OK 13
79#define IWL7265D_UCODE_API_OK 13
76 80
77/* Lowest firmware API version supported */ 81/* Lowest firmware API version supported */
78#define IWL7260_UCODE_API_MIN 13 82#define IWL7260_UCODE_API_MIN 13
83#define IWL7265_UCODE_API_MIN 13
84#define IWL7265D_UCODE_API_MIN 13
79 85
80/* NVM versions */ 86/* NVM versions */
81#define IWL7260_NVM_VERSION 0x0a1d 87#define IWL7260_NVM_VERSION 0x0a1d
@@ -149,10 +155,7 @@ static const struct iwl_ht_params iwl7000_ht_params = {
149 .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), 155 .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
150}; 156};
151 157
152#define IWL_DEVICE_7000 \ 158#define IWL_DEVICE_7000_COMMON \
153 .ucode_api_max = IWL7260_UCODE_API_MAX, \
154 .ucode_api_ok = IWL7260_UCODE_API_OK, \
155 .ucode_api_min = IWL7260_UCODE_API_MIN, \
156 .device_family = IWL_DEVICE_FAMILY_7000, \ 159 .device_family = IWL_DEVICE_FAMILY_7000, \
157 .max_inst_size = IWL60_RTC_INST_SIZE, \ 160 .max_inst_size = IWL60_RTC_INST_SIZE, \
158 .max_data_size = IWL60_RTC_DATA_SIZE, \ 161 .max_data_size = IWL60_RTC_DATA_SIZE, \
@@ -163,6 +166,24 @@ static const struct iwl_ht_params iwl7000_ht_params = {
163 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \ 166 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \
164 .dccm_offset = IWL7000_DCCM_OFFSET 167 .dccm_offset = IWL7000_DCCM_OFFSET
165 168
169#define IWL_DEVICE_7000 \
170 IWL_DEVICE_7000_COMMON, \
171 .ucode_api_max = IWL7260_UCODE_API_MAX, \
172 .ucode_api_ok = IWL7260_UCODE_API_OK, \
173 .ucode_api_min = IWL7260_UCODE_API_MIN
174
175#define IWL_DEVICE_7005 \
176 IWL_DEVICE_7000_COMMON, \
177 .ucode_api_max = IWL7265_UCODE_API_MAX, \
178 .ucode_api_ok = IWL7265_UCODE_API_OK, \
179 .ucode_api_min = IWL7265_UCODE_API_MIN
180
181#define IWL_DEVICE_7005D \
182 IWL_DEVICE_7000_COMMON, \
183 .ucode_api_max = IWL7265D_UCODE_API_MAX, \
184 .ucode_api_ok = IWL7265D_UCODE_API_OK, \
185 .ucode_api_min = IWL7265D_UCODE_API_MIN
186
166const struct iwl_cfg iwl7260_2ac_cfg = { 187const struct iwl_cfg iwl7260_2ac_cfg = {
167 .name = "Intel(R) Dual Band Wireless AC 7260", 188 .name = "Intel(R) Dual Band Wireless AC 7260",
168 .fw_name_pre = IWL7260_FW_PRE, 189 .fw_name_pre = IWL7260_FW_PRE,
@@ -266,7 +287,7 @@ static const struct iwl_ht_params iwl7265_ht_params = {
266const struct iwl_cfg iwl3165_2ac_cfg = { 287const struct iwl_cfg iwl3165_2ac_cfg = {
267 .name = "Intel(R) Dual Band Wireless AC 3165", 288 .name = "Intel(R) Dual Band Wireless AC 3165",
268 .fw_name_pre = IWL7265D_FW_PRE, 289 .fw_name_pre = IWL7265D_FW_PRE,
269 IWL_DEVICE_7000, 290 IWL_DEVICE_7005D,
270 .ht_params = &iwl7000_ht_params, 291 .ht_params = &iwl7000_ht_params,
271 .nvm_ver = IWL3165_NVM_VERSION, 292 .nvm_ver = IWL3165_NVM_VERSION,
272 .nvm_calib_ver = IWL3165_TX_POWER_VERSION, 293 .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
@@ -277,7 +298,7 @@ const struct iwl_cfg iwl3165_2ac_cfg = {
277const struct iwl_cfg iwl7265_2ac_cfg = { 298const struct iwl_cfg iwl7265_2ac_cfg = {
278 .name = "Intel(R) Dual Band Wireless AC 7265", 299 .name = "Intel(R) Dual Band Wireless AC 7265",
279 .fw_name_pre = IWL7265_FW_PRE, 300 .fw_name_pre = IWL7265_FW_PRE,
280 IWL_DEVICE_7000, 301 IWL_DEVICE_7005,
281 .ht_params = &iwl7265_ht_params, 302 .ht_params = &iwl7265_ht_params,
282 .nvm_ver = IWL7265_NVM_VERSION, 303 .nvm_ver = IWL7265_NVM_VERSION,
283 .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 304 .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
@@ -288,7 +309,7 @@ const struct iwl_cfg iwl7265_2ac_cfg = {
288const struct iwl_cfg iwl7265_2n_cfg = { 309const struct iwl_cfg iwl7265_2n_cfg = {
289 .name = "Intel(R) Dual Band Wireless N 7265", 310 .name = "Intel(R) Dual Band Wireless N 7265",
290 .fw_name_pre = IWL7265_FW_PRE, 311 .fw_name_pre = IWL7265_FW_PRE,
291 IWL_DEVICE_7000, 312 IWL_DEVICE_7005,
292 .ht_params = &iwl7265_ht_params, 313 .ht_params = &iwl7265_ht_params,
293 .nvm_ver = IWL7265_NVM_VERSION, 314 .nvm_ver = IWL7265_NVM_VERSION,
294 .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 315 .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
@@ -299,7 +320,7 @@ const struct iwl_cfg iwl7265_2n_cfg = {
299const struct iwl_cfg iwl7265_n_cfg = { 320const struct iwl_cfg iwl7265_n_cfg = {
300 .name = "Intel(R) Wireless N 7265", 321 .name = "Intel(R) Wireless N 7265",
301 .fw_name_pre = IWL7265_FW_PRE, 322 .fw_name_pre = IWL7265_FW_PRE,
302 IWL_DEVICE_7000, 323 IWL_DEVICE_7005,
303 .ht_params = &iwl7265_ht_params, 324 .ht_params = &iwl7265_ht_params,
304 .nvm_ver = IWL7265_NVM_VERSION, 325 .nvm_ver = IWL7265_NVM_VERSION,
305 .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 326 .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
@@ -310,7 +331,7 @@ const struct iwl_cfg iwl7265_n_cfg = {
310const struct iwl_cfg iwl7265d_2ac_cfg = { 331const struct iwl_cfg iwl7265d_2ac_cfg = {
311 .name = "Intel(R) Dual Band Wireless AC 7265", 332 .name = "Intel(R) Dual Band Wireless AC 7265",
312 .fw_name_pre = IWL7265D_FW_PRE, 333 .fw_name_pre = IWL7265D_FW_PRE,
313 IWL_DEVICE_7000, 334 IWL_DEVICE_7005D,
314 .ht_params = &iwl7265_ht_params, 335 .ht_params = &iwl7265_ht_params,
315 .nvm_ver = IWL7265D_NVM_VERSION, 336 .nvm_ver = IWL7265D_NVM_VERSION,
316 .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 337 .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
@@ -321,7 +342,7 @@ const struct iwl_cfg iwl7265d_2ac_cfg = {
321const struct iwl_cfg iwl7265d_2n_cfg = { 342const struct iwl_cfg iwl7265d_2n_cfg = {
322 .name = "Intel(R) Dual Band Wireless N 7265", 343 .name = "Intel(R) Dual Band Wireless N 7265",
323 .fw_name_pre = IWL7265D_FW_PRE, 344 .fw_name_pre = IWL7265D_FW_PRE,
324 IWL_DEVICE_7000, 345 IWL_DEVICE_7005D,
325 .ht_params = &iwl7265_ht_params, 346 .ht_params = &iwl7265_ht_params,
326 .nvm_ver = IWL7265D_NVM_VERSION, 347 .nvm_ver = IWL7265D_NVM_VERSION,
327 .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 348 .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
@@ -332,7 +353,7 @@ const struct iwl_cfg iwl7265d_2n_cfg = {
332const struct iwl_cfg iwl7265d_n_cfg = { 353const struct iwl_cfg iwl7265d_n_cfg = {
333 .name = "Intel(R) Wireless N 7265", 354 .name = "Intel(R) Wireless N 7265",
334 .fw_name_pre = IWL7265D_FW_PRE, 355 .fw_name_pre = IWL7265D_FW_PRE,
335 IWL_DEVICE_7000, 356 IWL_DEVICE_7005D,
336 .ht_params = &iwl7265_ht_params, 357 .ht_params = &iwl7265_ht_params,
337 .nvm_ver = IWL7265D_NVM_VERSION, 358 .nvm_ver = IWL7265D_NVM_VERSION,
338 .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 359 .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
@@ -342,5 +363,5 @@ const struct iwl_cfg iwl7265d_n_cfg = {
342 363
343MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 364MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
344MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 365MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
345MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 366MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_OK));
346MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 367MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 354acbde088e..2b976b110207 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -1222,8 +1222,8 @@ static u8 iwl_mvm_get_key_sta_id(struct iwl_mvm *mvm,
1222 mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { 1222 mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
1223 u8 sta_id = mvmvif->ap_sta_id; 1223 u8 sta_id = mvmvif->ap_sta_id;
1224 1224
1225 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], 1225 sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id],
1226 lockdep_is_held(&mvm->mutex)); 1226 lockdep_is_held(&mvm->mutex));
1227 /* 1227 /*
1228 * It is possible that the 'sta' parameter is NULL, 1228 * It is possible that the 'sta' parameter is NULL,
1229 * for example when a GTK is removed - the sta_id will then 1229 * for example when a GTK is removed - the sta_id will then
@@ -1590,14 +1590,15 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm,
1590 u16 *phase1key) 1590 u16 *phase1key)
1591{ 1591{
1592 struct iwl_mvm_sta *mvm_sta; 1592 struct iwl_mvm_sta *mvm_sta;
1593 u8 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); 1593 u8 sta_id;
1594 bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); 1594 bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE);
1595 1595
1596 if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT))
1597 return;
1598
1599 rcu_read_lock(); 1596 rcu_read_lock();
1600 1597
1598 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta);
1599 if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT))
1600 goto unlock;
1601
1601 if (!sta) { 1602 if (!sta) {
1602 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); 1603 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
1603 if (WARN_ON(IS_ERR_OR_NULL(sta))) { 1604 if (WARN_ON(IS_ERR_OR_NULL(sta))) {
@@ -1609,6 +1610,8 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm,
1609 mvm_sta = iwl_mvm_sta_from_mac80211(sta); 1610 mvm_sta = iwl_mvm_sta_from_mac80211(sta);
1610 iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, 1611 iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast,
1611 iv32, phase1key, CMD_ASYNC, keyconf->hw_key_idx); 1612 iv32, phase1key, CMD_ASYNC, keyconf->hw_key_idx);
1613
1614 unlock:
1612 rcu_read_unlock(); 1615 rcu_read_unlock();
1613} 1616}
1614 1617
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 9e294ff4e652..0c67b57be83c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2540,8 +2540,17 @@ static void nvme_ns_remove(struct nvme_ns *ns)
2540{ 2540{
2541 bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue); 2541 bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue);
2542 2542
2543 if (kill) 2543 if (kill) {
2544 blk_set_queue_dying(ns->queue); 2544 blk_set_queue_dying(ns->queue);
2545
2546 /*
2547 * The controller was shutdown first if we got here through
2548 * device removal. The shutdown may requeue outstanding
2549 * requests. These need to be aborted immediately so
2550 * del_gendisk doesn't block indefinitely for their completion.
2551 */
2552 blk_mq_abort_requeue_list(ns->queue);
2553 }
2545 if (ns->disk->flags & GENHD_FL_UP) 2554 if (ns->disk->flags & GENHD_FL_UP)
2546 del_gendisk(ns->disk); 2555 del_gendisk(ns->disk);
2547 if (kill || !blk_queue_dying(ns->queue)) { 2556 if (kill || !blk_queue_dying(ns->queue)) {
@@ -2977,6 +2986,15 @@ static void nvme_dev_remove(struct nvme_dev *dev)
2977{ 2986{
2978 struct nvme_ns *ns, *next; 2987 struct nvme_ns *ns, *next;
2979 2988
2989 if (nvme_io_incapable(dev)) {
2990 /*
2991 * If the device is not capable of IO (surprise hot-removal,
2992 * for example), we need to quiesce prior to deleting the
2993 * namespaces. This will end outstanding requests and prevent
2994 * attempts to sync dirty data.
2995 */
2996 nvme_dev_shutdown(dev);
2997 }
2980 list_for_each_entry_safe(ns, next, &dev->namespaces, list) 2998 list_for_each_entry_safe(ns, next, &dev->namespaces, list)
2981 nvme_ns_remove(ns); 2999 nvme_ns_remove(ns);
2982} 3000}
diff --git a/drivers/pci/host/pcie-hisi.c b/drivers/pci/host/pcie-hisi.c
index 163671a4f798..77f7c669a1b9 100644
--- a/drivers/pci/host/pcie-hisi.c
+++ b/drivers/pci/host/pcie-hisi.c
@@ -61,7 +61,9 @@ static int hisi_pcie_cfg_read(struct pcie_port *pp, int where, int size,
61 *val = *(u8 __force *) walker; 61 *val = *(u8 __force *) walker;
62 else if (size == 2) 62 else if (size == 2)
63 *val = *(u16 __force *) walker; 63 *val = *(u16 __force *) walker;
64 else if (size != 4) 64 else if (size == 4)
65 *val = reg_val;
66 else
65 return PCIBIOS_BAD_REGISTER_NUMBER; 67 return PCIBIOS_BAD_REGISTER_NUMBER;
66 68
67 return PCIBIOS_SUCCESSFUL; 69 return PCIBIOS_SUCCESSFUL;
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 61f768518a34..24ec282e15d8 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -599,8 +599,10 @@ static enum ap_wait ap_sm_read(struct ap_device *ap_dev)
599 status = ap_sm_recv(ap_dev); 599 status = ap_sm_recv(ap_dev);
600 switch (status.response_code) { 600 switch (status.response_code) {
601 case AP_RESPONSE_NORMAL: 601 case AP_RESPONSE_NORMAL:
602 if (ap_dev->queue_count > 0) 602 if (ap_dev->queue_count > 0) {
603 ap_dev->state = AP_STATE_WORKING;
603 return AP_WAIT_AGAIN; 604 return AP_WAIT_AGAIN;
605 }
604 ap_dev->state = AP_STATE_IDLE; 606 ap_dev->state = AP_STATE_IDLE;
605 return AP_WAIT_NONE; 607 return AP_WAIT_NONE;
606 case AP_RESPONSE_NO_PENDING_REPLY: 608 case AP_RESPONSE_NO_PENDING_REPLY:
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index b2a1a81e6fc8..1b831598df7c 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -984,6 +984,36 @@ static struct virtqueue *virtio_ccw_vq_by_ind(struct virtio_ccw_device *vcdev,
984 return vq; 984 return vq;
985} 985}
986 986
987static void virtio_ccw_check_activity(struct virtio_ccw_device *vcdev,
988 __u32 activity)
989{
990 if (vcdev->curr_io & activity) {
991 switch (activity) {
992 case VIRTIO_CCW_DOING_READ_FEAT:
993 case VIRTIO_CCW_DOING_WRITE_FEAT:
994 case VIRTIO_CCW_DOING_READ_CONFIG:
995 case VIRTIO_CCW_DOING_WRITE_CONFIG:
996 case VIRTIO_CCW_DOING_WRITE_STATUS:
997 case VIRTIO_CCW_DOING_SET_VQ:
998 case VIRTIO_CCW_DOING_SET_IND:
999 case VIRTIO_CCW_DOING_SET_CONF_IND:
1000 case VIRTIO_CCW_DOING_RESET:
1001 case VIRTIO_CCW_DOING_READ_VQ_CONF:
1002 case VIRTIO_CCW_DOING_SET_IND_ADAPTER:
1003 case VIRTIO_CCW_DOING_SET_VIRTIO_REV:
1004 vcdev->curr_io &= ~activity;
1005 wake_up(&vcdev->wait_q);
1006 break;
1007 default:
1008 /* don't know what to do... */
1009 dev_warn(&vcdev->cdev->dev,
1010 "Suspicious activity '%08x'\n", activity);
1011 WARN_ON(1);
1012 break;
1013 }
1014 }
1015}
1016
987static void virtio_ccw_int_handler(struct ccw_device *cdev, 1017static void virtio_ccw_int_handler(struct ccw_device *cdev,
988 unsigned long intparm, 1018 unsigned long intparm,
989 struct irb *irb) 1019 struct irb *irb)
@@ -995,6 +1025,12 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev,
995 1025
996 if (!vcdev) 1026 if (!vcdev)
997 return; 1027 return;
1028 if (IS_ERR(irb)) {
1029 vcdev->err = PTR_ERR(irb);
1030 virtio_ccw_check_activity(vcdev, activity);
1031 /* Don't poke around indicators, something's wrong. */
1032 return;
1033 }
998 /* Check if it's a notification from the host. */ 1034 /* Check if it's a notification from the host. */
999 if ((intparm == 0) && 1035 if ((intparm == 0) &&
1000 (scsw_stctl(&irb->scsw) == 1036 (scsw_stctl(&irb->scsw) ==
@@ -1010,31 +1046,7 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev,
1010 /* Map everything else to -EIO. */ 1046 /* Map everything else to -EIO. */
1011 vcdev->err = -EIO; 1047 vcdev->err = -EIO;
1012 } 1048 }
1013 if (vcdev->curr_io & activity) { 1049 virtio_ccw_check_activity(vcdev, activity);
1014 switch (activity) {
1015 case VIRTIO_CCW_DOING_READ_FEAT:
1016 case VIRTIO_CCW_DOING_WRITE_FEAT:
1017 case VIRTIO_CCW_DOING_READ_CONFIG:
1018 case VIRTIO_CCW_DOING_WRITE_CONFIG:
1019 case VIRTIO_CCW_DOING_WRITE_STATUS:
1020 case VIRTIO_CCW_DOING_SET_VQ:
1021 case VIRTIO_CCW_DOING_SET_IND:
1022 case VIRTIO_CCW_DOING_SET_CONF_IND:
1023 case VIRTIO_CCW_DOING_RESET:
1024 case VIRTIO_CCW_DOING_READ_VQ_CONF:
1025 case VIRTIO_CCW_DOING_SET_IND_ADAPTER:
1026 case VIRTIO_CCW_DOING_SET_VIRTIO_REV:
1027 vcdev->curr_io &= ~activity;
1028 wake_up(&vcdev->wait_q);
1029 break;
1030 default:
1031 /* don't know what to do... */
1032 dev_warn(&cdev->dev, "Suspicious activity '%08x'\n",
1033 activity);
1034 WARN_ON(1);
1035 break;
1036 }
1037 }
1038 for_each_set_bit(i, &vcdev->indicators, 1050 for_each_set_bit(i, &vcdev->indicators,
1039 sizeof(vcdev->indicators) * BITS_PER_BYTE) { 1051 sizeof(vcdev->indicators) * BITS_PER_BYTE) {
1040 /* The bit clear must happen before the vring kick. */ 1052 /* The bit clear must happen before the vring kick. */
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index 064031870ba0..ca0d3802f2af 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -148,8 +148,10 @@ static int receive_chars_read(struct uart_port *port)
148 uart_handle_dcd_change(port, 1); 148 uart_handle_dcd_change(port, 1);
149 } 149 }
150 150
151 for (i = 0; i < bytes_read; i++) 151 if (port->sysrq != 0 && *con_read_page) {
152 uart_handle_sysrq_char(port, con_read_page[i]); 152 for (i = 0; i < bytes_read; i++)
153 uart_handle_sysrq_char(port, con_read_page[i]);
154 }
153 155
154 if (port->state == NULL) 156 if (port->state == NULL)
155 continue; 157 continue;
@@ -168,17 +170,17 @@ struct sunhv_ops {
168 int (*receive_chars)(struct uart_port *port); 170 int (*receive_chars)(struct uart_port *port);
169}; 171};
170 172
171static struct sunhv_ops bychar_ops = { 173static const struct sunhv_ops bychar_ops = {
172 .transmit_chars = transmit_chars_putchar, 174 .transmit_chars = transmit_chars_putchar,
173 .receive_chars = receive_chars_getchar, 175 .receive_chars = receive_chars_getchar,
174}; 176};
175 177
176static struct sunhv_ops bywrite_ops = { 178static const struct sunhv_ops bywrite_ops = {
177 .transmit_chars = transmit_chars_write, 179 .transmit_chars = transmit_chars_write,
178 .receive_chars = receive_chars_read, 180 .receive_chars = receive_chars_read,
179}; 181};
180 182
181static struct sunhv_ops *sunhv_ops = &bychar_ops; 183static const struct sunhv_ops *sunhv_ops = &bychar_ops;
182 184
183static struct tty_port *receive_chars(struct uart_port *port) 185static struct tty_port *receive_chars(struct uart_port *port)
184{ 186{
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 9ffef06b30d5..c9d6c715c0fb 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -616,6 +616,7 @@ nfsd4_cb_layout_prepare(struct nfsd4_callback *cb)
616 616
617 mutex_lock(&ls->ls_mutex); 617 mutex_lock(&ls->ls_mutex);
618 nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid); 618 nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid);
619 mutex_unlock(&ls->ls_mutex);
619} 620}
620 621
621static int 622static int
@@ -659,7 +660,6 @@ nfsd4_cb_layout_release(struct nfsd4_callback *cb)
659 660
660 trace_layout_recall_release(&ls->ls_stid.sc_stateid); 661 trace_layout_recall_release(&ls->ls_stid.sc_stateid);
661 662
662 mutex_unlock(&ls->ls_mutex);
663 nfsd4_return_all_layouts(ls, &reaplist); 663 nfsd4_return_all_layouts(ls, &reaplist);
664 nfsd4_free_layouts(&reaplist); 664 nfsd4_free_layouts(&reaplist);
665 nfs4_put_stid(&ls->ls_stid); 665 nfs4_put_stid(&ls->ls_stid);
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index ce38b4ccc9ab..84f2f8079466 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2843,6 +2843,8 @@ again:
2843 res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY; 2843 res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY;
2844 if (!ret) 2844 if (!ret)
2845 BUG_ON(!(res->state & DLM_LOCK_RES_MIGRATING)); 2845 BUG_ON(!(res->state & DLM_LOCK_RES_MIGRATING));
2846 else
2847 res->migration_pending = 0;
2846 spin_unlock(&res->spinlock); 2848 spin_unlock(&res->spinlock);
2847 2849
2848 /* 2850 /*
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index 652ece4a9d9e..d56f0079b858 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -67,7 +67,10 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
67 */ 67 */
68 68
69 locks_lock_file_wait(file, 69 locks_lock_file_wait(file,
70 &(struct file_lock){.fl_type = F_UNLCK}); 70 &(struct file_lock) {
71 .fl_type = F_UNLCK,
72 .fl_flags = FL_FLOCK
73 });
71 74
72 ocfs2_file_unlock(file); 75 ocfs2_file_unlock(file);
73 } 76 }
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index d5da6f624142..79b8021302b3 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -54,11 +54,12 @@
54static u16 ocfs2_calc_new_backup_super(struct inode *inode, 54static u16 ocfs2_calc_new_backup_super(struct inode *inode,
55 struct ocfs2_group_desc *gd, 55 struct ocfs2_group_desc *gd,
56 u16 cl_cpg, 56 u16 cl_cpg,
57 u16 old_bg_clusters,
57 int set) 58 int set)
58{ 59{
59 int i; 60 int i;
60 u16 backups = 0; 61 u16 backups = 0;
61 u32 cluster; 62 u32 cluster, lgd_cluster;
62 u64 blkno, gd_blkno, lgd_blkno = le64_to_cpu(gd->bg_blkno); 63 u64 blkno, gd_blkno, lgd_blkno = le64_to_cpu(gd->bg_blkno);
63 64
64 for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) { 65 for (i = 0; i < OCFS2_MAX_BACKUP_SUPERBLOCKS; i++) {
@@ -71,6 +72,12 @@ static u16 ocfs2_calc_new_backup_super(struct inode *inode,
71 else if (gd_blkno > lgd_blkno) 72 else if (gd_blkno > lgd_blkno)
72 break; 73 break;
73 74
75 /* check if already done backup super */
76 lgd_cluster = ocfs2_blocks_to_clusters(inode->i_sb, lgd_blkno);
77 lgd_cluster += old_bg_clusters;
78 if (lgd_cluster >= cluster)
79 continue;
80
74 if (set) 81 if (set)
75 ocfs2_set_bit(cluster % cl_cpg, 82 ocfs2_set_bit(cluster % cl_cpg,
76 (unsigned long *)gd->bg_bitmap); 83 (unsigned long *)gd->bg_bitmap);
@@ -99,6 +106,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
99 u16 chain, num_bits, backups = 0; 106 u16 chain, num_bits, backups = 0;
100 u16 cl_bpc = le16_to_cpu(cl->cl_bpc); 107 u16 cl_bpc = le16_to_cpu(cl->cl_bpc);
101 u16 cl_cpg = le16_to_cpu(cl->cl_cpg); 108 u16 cl_cpg = le16_to_cpu(cl->cl_cpg);
109 u16 old_bg_clusters;
102 110
103 trace_ocfs2_update_last_group_and_inode(new_clusters, 111 trace_ocfs2_update_last_group_and_inode(new_clusters,
104 first_new_cluster); 112 first_new_cluster);
@@ -112,6 +120,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
112 120
113 group = (struct ocfs2_group_desc *)group_bh->b_data; 121 group = (struct ocfs2_group_desc *)group_bh->b_data;
114 122
123 old_bg_clusters = le16_to_cpu(group->bg_bits) / cl_bpc;
115 /* update the group first. */ 124 /* update the group first. */
116 num_bits = new_clusters * cl_bpc; 125 num_bits = new_clusters * cl_bpc;
117 le16_add_cpu(&group->bg_bits, num_bits); 126 le16_add_cpu(&group->bg_bits, num_bits);
@@ -125,7 +134,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
125 OCFS2_FEATURE_COMPAT_BACKUP_SB)) { 134 OCFS2_FEATURE_COMPAT_BACKUP_SB)) {
126 backups = ocfs2_calc_new_backup_super(bm_inode, 135 backups = ocfs2_calc_new_backup_super(bm_inode,
127 group, 136 group,
128 cl_cpg, 1); 137 cl_cpg, old_bg_clusters, 1);
129 le16_add_cpu(&group->bg_free_bits_count, -1 * backups); 138 le16_add_cpu(&group->bg_free_bits_count, -1 * backups);
130 } 139 }
131 140
@@ -163,7 +172,7 @@ out_rollback:
163 if (ret < 0) { 172 if (ret < 0) {
164 ocfs2_calc_new_backup_super(bm_inode, 173 ocfs2_calc_new_backup_super(bm_inode,
165 group, 174 group,
166 cl_cpg, 0); 175 cl_cpg, old_bg_clusters, 0);
167 le16_add_cpu(&group->bg_free_bits_count, backups); 176 le16_add_cpu(&group->bg_free_bits_count, backups);
168 le16_add_cpu(&group->bg_bits, -1 * num_bits); 177 le16_add_cpu(&group->bg_bits, -1 * num_bits);
169 le16_add_cpu(&group->bg_free_bits_count, -1 * num_bits); 178 le16_add_cpu(&group->bg_free_bits_count, -1 * num_bits);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0169ba2e2e64..c70e3588a48c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -797,6 +797,7 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
797extern int blk_queue_enter(struct request_queue *q, gfp_t gfp); 797extern int blk_queue_enter(struct request_queue *q, gfp_t gfp);
798extern void blk_queue_exit(struct request_queue *q); 798extern void blk_queue_exit(struct request_queue *q);
799extern void blk_start_queue(struct request_queue *q); 799extern void blk_start_queue(struct request_queue *q);
800extern void blk_start_queue_async(struct request_queue *q);
800extern void blk_stop_queue(struct request_queue *q); 801extern void blk_stop_queue(struct request_queue *q);
801extern void blk_sync_queue(struct request_queue *q); 802extern void blk_sync_queue(struct request_queue *q);
802extern void __blk_stop_queue(struct request_queue *q); 803extern void __blk_stop_queue(struct request_queue *q);
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 1f6526c76ee8..3a375d07d0dc 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -138,6 +138,7 @@ struct cdc_ncm_ctx {
138}; 138};
139 139
140u8 cdc_ncm_select_altsetting(struct usb_interface *intf); 140u8 cdc_ncm_select_altsetting(struct usb_interface *intf);
141int cdc_ncm_change_mtu(struct net_device *net, int new_mtu);
141int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); 142int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags);
142void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 143void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
143struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); 144struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 5dbc8b0ee567..3e5d9075960f 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -176,11 +176,11 @@ extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp);
176#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) 176#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
177 177
178#ifdef CONFIG_SMP 178#ifdef CONFIG_SMP
179void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int); 179void __mod_zone_page_state(struct zone *, enum zone_stat_item item, long);
180void __inc_zone_page_state(struct page *, enum zone_stat_item); 180void __inc_zone_page_state(struct page *, enum zone_stat_item);
181void __dec_zone_page_state(struct page *, enum zone_stat_item); 181void __dec_zone_page_state(struct page *, enum zone_stat_item);
182 182
183void mod_zone_page_state(struct zone *, enum zone_stat_item, int); 183void mod_zone_page_state(struct zone *, enum zone_stat_item, long);
184void inc_zone_page_state(struct page *, enum zone_stat_item); 184void inc_zone_page_state(struct page *, enum zone_stat_item);
185void dec_zone_page_state(struct page *, enum zone_stat_item); 185void dec_zone_page_state(struct page *, enum zone_stat_item);
186 186
@@ -205,7 +205,7 @@ void set_pgdat_percpu_threshold(pg_data_t *pgdat,
205 * The functions directly modify the zone and global counters. 205 * The functions directly modify the zone and global counters.
206 */ 206 */
207static inline void __mod_zone_page_state(struct zone *zone, 207static inline void __mod_zone_page_state(struct zone *zone,
208 enum zone_stat_item item, int delta) 208 enum zone_stat_item item, long delta)
209{ 209{
210 zone_page_state_add(delta, zone, item); 210 zone_page_state_add(delta, zone, item);
211} 211}
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a8b4b9c8b1d2..fb955e69a78e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1655,7 +1655,7 @@ extern const struct dev_pm_ops snd_soc_pm_ops;
1655/* Helper functions */ 1655/* Helper functions */
1656static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm) 1656static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
1657{ 1657{
1658 mutex_lock(&dapm->card->dapm_mutex); 1658 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
1659} 1659}
1660 1660
1661static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) 1661static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index eb9240c458fa..51282f579760 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -519,7 +519,8 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter)
519 return -ENOMEM; 519 return -ENOMEM;
520 520
521 spin_lock(&ht->lock); 521 spin_lock(&ht->lock);
522 iter->walker->tbl = rht_dereference(ht->tbl, ht); 522 iter->walker->tbl =
523 rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock));
523 list_add(&iter->walker->list, &iter->walker->tbl->walkers); 524 list_add(&iter->walker->list, &iter->walker->tbl->walkers);
524 spin_unlock(&ht->lock); 525 spin_unlock(&ht->lock);
525 526
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e234c21a5e6c..fc10620967c7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -903,14 +903,20 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
903 if (prev && reclaim->generation != iter->generation) 903 if (prev && reclaim->generation != iter->generation)
904 goto out_unlock; 904 goto out_unlock;
905 905
906 do { 906 while (1) {
907 pos = READ_ONCE(iter->position); 907 pos = READ_ONCE(iter->position);
908 if (!pos || css_tryget(&pos->css))
909 break;
908 /* 910 /*
909 * A racing update may change the position and 911 * css reference reached zero, so iter->position will
910 * put the last reference, hence css_tryget(), 912 * be cleared by ->css_released. However, we should not
911 * or retry to see the updated position. 913 * rely on this happening soon, because ->css_released
914 * is called from a work queue, and by busy-waiting we
915 * might block it. So we clear iter->position right
916 * away.
912 */ 917 */
913 } while (pos && !css_tryget(&pos->css)); 918 (void)cmpxchg(&iter->position, pos, NULL);
919 }
914 } 920 }
915 921
916 if (pos) 922 if (pos)
@@ -956,17 +962,13 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
956 } 962 }
957 963
958 if (reclaim) { 964 if (reclaim) {
959 if (cmpxchg(&iter->position, pos, memcg) == pos) {
960 if (memcg)
961 css_get(&memcg->css);
962 if (pos)
963 css_put(&pos->css);
964 }
965
966 /* 965 /*
967 * pairs with css_tryget when dereferencing iter->position 966 * The position could have already been updated by a competing
968 * above. 967 * thread, so check that the value hasn't changed since we read
968 * it to avoid reclaiming from the same cgroup twice.
969 */ 969 */
970 (void)cmpxchg(&iter->position, pos, memcg);
971
970 if (pos) 972 if (pos)
971 css_put(&pos->css); 973 css_put(&pos->css);
972 974
@@ -999,6 +1001,28 @@ void mem_cgroup_iter_break(struct mem_cgroup *root,
999 css_put(&prev->css); 1001 css_put(&prev->css);
1000} 1002}
1001 1003
1004static void invalidate_reclaim_iterators(struct mem_cgroup *dead_memcg)
1005{
1006 struct mem_cgroup *memcg = dead_memcg;
1007 struct mem_cgroup_reclaim_iter *iter;
1008 struct mem_cgroup_per_zone *mz;
1009 int nid, zid;
1010 int i;
1011
1012 while ((memcg = parent_mem_cgroup(memcg))) {
1013 for_each_node(nid) {
1014 for (zid = 0; zid < MAX_NR_ZONES; zid++) {
1015 mz = &memcg->nodeinfo[nid]->zoneinfo[zid];
1016 for (i = 0; i <= DEF_PRIORITY; i++) {
1017 iter = &mz->iter[i];
1018 cmpxchg(&iter->position,
1019 dead_memcg, NULL);
1020 }
1021 }
1022 }
1023 }
1024}
1025
1002/* 1026/*
1003 * Iteration constructs for visiting all cgroups (under a tree). If 1027 * Iteration constructs for visiting all cgroups (under a tree). If
1004 * loops are exited prematurely (break), mem_cgroup_iter_break() must 1028 * loops are exited prematurely (break), mem_cgroup_iter_break() must
@@ -4324,6 +4348,13 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css)
4324 wb_memcg_offline(memcg); 4348 wb_memcg_offline(memcg);
4325} 4349}
4326 4350
4351static void mem_cgroup_css_released(struct cgroup_subsys_state *css)
4352{
4353 struct mem_cgroup *memcg = mem_cgroup_from_css(css);
4354
4355 invalidate_reclaim_iterators(memcg);
4356}
4357
4327static void mem_cgroup_css_free(struct cgroup_subsys_state *css) 4358static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
4328{ 4359{
4329 struct mem_cgroup *memcg = mem_cgroup_from_css(css); 4360 struct mem_cgroup *memcg = mem_cgroup_from_css(css);
@@ -5185,6 +5216,7 @@ struct cgroup_subsys memory_cgrp_subsys = {
5185 .css_alloc = mem_cgroup_css_alloc, 5216 .css_alloc = mem_cgroup_css_alloc,
5186 .css_online = mem_cgroup_css_online, 5217 .css_online = mem_cgroup_css_online,
5187 .css_offline = mem_cgroup_css_offline, 5218 .css_offline = mem_cgroup_css_offline,
5219 .css_released = mem_cgroup_css_released,
5188 .css_free = mem_cgroup_css_free, 5220 .css_free = mem_cgroup_css_free,
5189 .css_reset = mem_cgroup_css_reset, 5221 .css_reset = mem_cgroup_css_reset,
5190 .can_attach = mem_cgroup_can_attach, 5222 .can_attach = mem_cgroup_can_attach,
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 67d488ab495e..a042a9d537bb 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1375,23 +1375,30 @@ int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
1375 */ 1375 */
1376int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) 1376int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)
1377{ 1377{
1378 unsigned long pfn; 1378 unsigned long pfn, sec_end_pfn;
1379 struct zone *zone = NULL; 1379 struct zone *zone = NULL;
1380 struct page *page; 1380 struct page *page;
1381 int i; 1381 int i;
1382 for (pfn = start_pfn; 1382 for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn);
1383 pfn < end_pfn; 1383 pfn < end_pfn;
1384 pfn += MAX_ORDER_NR_PAGES) { 1384 pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) {
1385 i = 0; 1385 /* Make sure the memory section is present first */
1386 /* This is just a CONFIG_HOLES_IN_ZONE check.*/ 1386 if (!present_section_nr(pfn_to_section_nr(pfn)))
1387 while ((i < MAX_ORDER_NR_PAGES) && !pfn_valid_within(pfn + i))
1388 i++;
1389 if (i == MAX_ORDER_NR_PAGES)
1390 continue; 1387 continue;
1391 page = pfn_to_page(pfn + i); 1388 for (; pfn < sec_end_pfn && pfn < end_pfn;
1392 if (zone && page_zone(page) != zone) 1389 pfn += MAX_ORDER_NR_PAGES) {
1393 return 0; 1390 i = 0;
1394 zone = page_zone(page); 1391 /* This is just a CONFIG_HOLES_IN_ZONE check.*/
1392 while ((i < MAX_ORDER_NR_PAGES) &&
1393 !pfn_valid_within(pfn + i))
1394 i++;
1395 if (i == MAX_ORDER_NR_PAGES)
1396 continue;
1397 page = pfn_to_page(pfn + i);
1398 if (zone && page_zone(page) != zone)
1399 return 0;
1400 zone = page_zone(page);
1401 }
1395 } 1402 }
1396 return 1; 1403 return 1;
1397} 1404}
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 0d5712b0206c..4ebc17d948cb 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -219,7 +219,7 @@ void set_pgdat_percpu_threshold(pg_data_t *pgdat,
219 * particular counter cannot be updated from interrupt context. 219 * particular counter cannot be updated from interrupt context.
220 */ 220 */
221void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item, 221void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
222 int delta) 222 long delta)
223{ 223{
224 struct per_cpu_pageset __percpu *pcp = zone->pageset; 224 struct per_cpu_pageset __percpu *pcp = zone->pageset;
225 s8 __percpu *p = pcp->vm_stat_diff + item; 225 s8 __percpu *p = pcp->vm_stat_diff + item;
@@ -318,8 +318,8 @@ EXPORT_SYMBOL(__dec_zone_page_state);
318 * 1 Overstepping half of threshold 318 * 1 Overstepping half of threshold
319 * -1 Overstepping minus half of threshold 319 * -1 Overstepping minus half of threshold
320*/ 320*/
321static inline void mod_state(struct zone *zone, 321static inline void mod_state(struct zone *zone, enum zone_stat_item item,
322 enum zone_stat_item item, int delta, int overstep_mode) 322 long delta, int overstep_mode)
323{ 323{
324 struct per_cpu_pageset __percpu *pcp = zone->pageset; 324 struct per_cpu_pageset __percpu *pcp = zone->pageset;
325 s8 __percpu *p = pcp->vm_stat_diff + item; 325 s8 __percpu *p = pcp->vm_stat_diff + item;
@@ -357,7 +357,7 @@ static inline void mod_state(struct zone *zone,
357} 357}
358 358
359void mod_zone_page_state(struct zone *zone, enum zone_stat_item item, 359void mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
360 int delta) 360 long delta)
361{ 361{
362 mod_state(zone, item, delta, 0); 362 mod_state(zone, item, delta, 0);
363} 363}
@@ -384,7 +384,7 @@ EXPORT_SYMBOL(dec_zone_page_state);
384 * Use interrupt disable to serialize counter updates 384 * Use interrupt disable to serialize counter updates
385 */ 385 */
386void mod_zone_page_state(struct zone *zone, enum zone_stat_item item, 386void mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
387 int delta) 387 long delta)
388{ 388{
389 unsigned long flags; 389 unsigned long flags;
390 390
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 5396ff08af32..12045dea276c 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -39,7 +39,7 @@ void br_init_port(struct net_bridge_port *p)
39 struct switchdev_attr attr = { 39 struct switchdev_attr attr = {
40 .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME, 40 .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
41 .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER, 41 .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER,
42 .u.ageing_time = p->br->ageing_time, 42 .u.ageing_time = jiffies_to_clock_t(p->br->ageing_time),
43 }; 43 };
44 int err; 44 int err;
45 45
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index f34c31defafe..a09fb0dec725 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -253,9 +253,6 @@ ipip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
253 253
254 p.i_key = p.o_key = 0; 254 p.i_key = p.o_key = 0;
255 p.i_flags = p.o_flags = 0; 255 p.i_flags = p.o_flags = 0;
256 if (p.iph.ttl)
257 p.iph.frag_off |= htons(IP_DF);
258
259 err = ip_tunnel_ioctl(dev, &p, cmd); 256 err = ip_tunnel_ioctl(dev, &p, cmd);
260 if (err) 257 if (err)
261 return err; 258 return err;
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 1e0c3c835a63..7b0edb37a115 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -259,7 +259,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
259 xfrm_dst_ifdown(dst, dev); 259 xfrm_dst_ifdown(dst, dev);
260} 260}
261 261
262static struct dst_ops xfrm4_dst_ops = { 262static struct dst_ops xfrm4_dst_ops_template = {
263 .family = AF_INET, 263 .family = AF_INET,
264 .gc = xfrm4_garbage_collect, 264 .gc = xfrm4_garbage_collect,
265 .update_pmtu = xfrm4_update_pmtu, 265 .update_pmtu = xfrm4_update_pmtu,
@@ -273,7 +273,7 @@ static struct dst_ops xfrm4_dst_ops = {
273 273
274static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { 274static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
275 .family = AF_INET, 275 .family = AF_INET,
276 .dst_ops = &xfrm4_dst_ops, 276 .dst_ops = &xfrm4_dst_ops_template,
277 .dst_lookup = xfrm4_dst_lookup, 277 .dst_lookup = xfrm4_dst_lookup,
278 .get_saddr = xfrm4_get_saddr, 278 .get_saddr = xfrm4_get_saddr,
279 .decode_session = _decode_session4, 279 .decode_session = _decode_session4,
@@ -295,7 +295,7 @@ static struct ctl_table xfrm4_policy_table[] = {
295 { } 295 { }
296}; 296};
297 297
298static int __net_init xfrm4_net_init(struct net *net) 298static int __net_init xfrm4_net_sysctl_init(struct net *net)
299{ 299{
300 struct ctl_table *table; 300 struct ctl_table *table;
301 struct ctl_table_header *hdr; 301 struct ctl_table_header *hdr;
@@ -323,7 +323,7 @@ err_alloc:
323 return -ENOMEM; 323 return -ENOMEM;
324} 324}
325 325
326static void __net_exit xfrm4_net_exit(struct net *net) 326static void __net_exit xfrm4_net_sysctl_exit(struct net *net)
327{ 327{
328 struct ctl_table *table; 328 struct ctl_table *table;
329 329
@@ -335,12 +335,44 @@ static void __net_exit xfrm4_net_exit(struct net *net)
335 if (!net_eq(net, &init_net)) 335 if (!net_eq(net, &init_net))
336 kfree(table); 336 kfree(table);
337} 337}
338#else /* CONFIG_SYSCTL */
339static int inline xfrm4_net_sysctl_init(struct net *net)
340{
341 return 0;
342}
343
344static void inline xfrm4_net_sysctl_exit(struct net *net)
345{
346}
347#endif
348
349static int __net_init xfrm4_net_init(struct net *net)
350{
351 int ret;
352
353 memcpy(&net->xfrm.xfrm4_dst_ops, &xfrm4_dst_ops_template,
354 sizeof(xfrm4_dst_ops_template));
355 ret = dst_entries_init(&net->xfrm.xfrm4_dst_ops);
356 if (ret)
357 return ret;
358
359 ret = xfrm4_net_sysctl_init(net);
360 if (ret)
361 dst_entries_destroy(&net->xfrm.xfrm4_dst_ops);
362
363 return ret;
364}
365
366static void __net_exit xfrm4_net_exit(struct net *net)
367{
368 xfrm4_net_sysctl_exit(net);
369 dst_entries_destroy(&net->xfrm.xfrm4_dst_ops);
370}
338 371
339static struct pernet_operations __net_initdata xfrm4_net_ops = { 372static struct pernet_operations __net_initdata xfrm4_net_ops = {
340 .init = xfrm4_net_init, 373 .init = xfrm4_net_init,
341 .exit = xfrm4_net_exit, 374 .exit = xfrm4_net_exit,
342}; 375};
343#endif
344 376
345static void __init xfrm4_policy_init(void) 377static void __init xfrm4_policy_init(void)
346{ 378{
@@ -349,13 +381,9 @@ static void __init xfrm4_policy_init(void)
349 381
350void __init xfrm4_init(void) 382void __init xfrm4_init(void)
351{ 383{
352 dst_entries_init(&xfrm4_dst_ops);
353
354 xfrm4_state_init(); 384 xfrm4_state_init();
355 xfrm4_policy_init(); 385 xfrm4_policy_init();
356 xfrm4_protocol_init(); 386 xfrm4_protocol_init();
357#ifdef CONFIG_SYSCTL
358 register_pernet_subsys(&xfrm4_net_ops); 387 register_pernet_subsys(&xfrm4_net_ops);
359#endif
360} 388}
361 389
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 17f8e7ea133b..1f21087accab 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5369,13 +5369,10 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,
5369 goto out; 5369 goto out;
5370 } 5370 }
5371 5371
5372 if (!write) { 5372 err = snprintf(str, sizeof(str), "%pI6", &secret->secret);
5373 err = snprintf(str, sizeof(str), "%pI6", 5373 if (err >= sizeof(str)) {
5374 &secret->secret); 5374 err = -EIO;
5375 if (err >= sizeof(str)) { 5375 goto out;
5376 err = -EIO;
5377 goto out;
5378 }
5379 } 5376 }
5380 5377
5381 err = proc_dostring(&lctl, write, buffer, lenp, ppos); 5378 err = proc_dostring(&lctl, write, buffer, lenp, ppos);
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index 882124ebb438..a8f6986dcbe5 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -552,7 +552,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh)
552 552
553 rcu_read_lock(); 553 rcu_read_lock();
554 p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index); 554 p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index);
555 if (p && ip6addrlbl_hold(p)) 555 if (p && !ip6addrlbl_hold(p))
556 p = NULL; 556 p = NULL;
557 lseq = ip6addrlbl_table.seq; 557 lseq = ip6addrlbl_table.seq;
558 rcu_read_unlock(); 558 rcu_read_unlock();
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d6161e1c48c8..84afb9a77278 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1183,7 +1183,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1183 */ 1183 */
1184 if (!in6_dev->cnf.accept_ra_from_local && 1184 if (!in6_dev->cnf.accept_ra_from_local &&
1185 ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, 1185 ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
1186 NULL, 0)) { 1186 in6_dev->dev, 0)) {
1187 ND_PRINTK(2, info, 1187 ND_PRINTK(2, info,
1188 "RA from local address detected on dev: %s: default router ignored\n", 1188 "RA from local address detected on dev: %s: default router ignored\n",
1189 skb->dev->name); 1189 skb->dev->name);
@@ -1337,7 +1337,7 @@ skip_linkparms:
1337#ifdef CONFIG_IPV6_ROUTE_INFO 1337#ifdef CONFIG_IPV6_ROUTE_INFO
1338 if (!in6_dev->cnf.accept_ra_from_local && 1338 if (!in6_dev->cnf.accept_ra_from_local &&
1339 ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, 1339 ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
1340 NULL, 0)) { 1340 in6_dev->dev, 0)) {
1341 ND_PRINTK(2, info, 1341 ND_PRINTK(2, info,
1342 "RA from local address detected on dev: %s: router info ignored.\n", 1342 "RA from local address detected on dev: %s: router info ignored.\n",
1343 skb->dev->name); 1343 skb->dev->name);
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 5643423fe67a..c074771a10f7 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -279,7 +279,7 @@ static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
279 xfrm_dst_ifdown(dst, dev); 279 xfrm_dst_ifdown(dst, dev);
280} 280}
281 281
282static struct dst_ops xfrm6_dst_ops = { 282static struct dst_ops xfrm6_dst_ops_template = {
283 .family = AF_INET6, 283 .family = AF_INET6,
284 .gc = xfrm6_garbage_collect, 284 .gc = xfrm6_garbage_collect,
285 .update_pmtu = xfrm6_update_pmtu, 285 .update_pmtu = xfrm6_update_pmtu,
@@ -293,7 +293,7 @@ static struct dst_ops xfrm6_dst_ops = {
293 293
294static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { 294static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
295 .family = AF_INET6, 295 .family = AF_INET6,
296 .dst_ops = &xfrm6_dst_ops, 296 .dst_ops = &xfrm6_dst_ops_template,
297 .dst_lookup = xfrm6_dst_lookup, 297 .dst_lookup = xfrm6_dst_lookup,
298 .get_saddr = xfrm6_get_saddr, 298 .get_saddr = xfrm6_get_saddr,
299 .decode_session = _decode_session6, 299 .decode_session = _decode_session6,
@@ -325,7 +325,7 @@ static struct ctl_table xfrm6_policy_table[] = {
325 { } 325 { }
326}; 326};
327 327
328static int __net_init xfrm6_net_init(struct net *net) 328static int __net_init xfrm6_net_sysctl_init(struct net *net)
329{ 329{
330 struct ctl_table *table; 330 struct ctl_table *table;
331 struct ctl_table_header *hdr; 331 struct ctl_table_header *hdr;
@@ -353,7 +353,7 @@ err_alloc:
353 return -ENOMEM; 353 return -ENOMEM;
354} 354}
355 355
356static void __net_exit xfrm6_net_exit(struct net *net) 356static void __net_exit xfrm6_net_sysctl_exit(struct net *net)
357{ 357{
358 struct ctl_table *table; 358 struct ctl_table *table;
359 359
@@ -365,24 +365,52 @@ static void __net_exit xfrm6_net_exit(struct net *net)
365 if (!net_eq(net, &init_net)) 365 if (!net_eq(net, &init_net))
366 kfree(table); 366 kfree(table);
367} 367}
368#else /* CONFIG_SYSCTL */
369static int inline xfrm6_net_sysctl_init(struct net *net)
370{
371 return 0;
372}
373
374static void inline xfrm6_net_sysctl_exit(struct net *net)
375{
376}
377#endif
378
379static int __net_init xfrm6_net_init(struct net *net)
380{
381 int ret;
382
383 memcpy(&net->xfrm.xfrm6_dst_ops, &xfrm6_dst_ops_template,
384 sizeof(xfrm6_dst_ops_template));
385 ret = dst_entries_init(&net->xfrm.xfrm6_dst_ops);
386 if (ret)
387 return ret;
388
389 ret = xfrm6_net_sysctl_init(net);
390 if (ret)
391 dst_entries_destroy(&net->xfrm.xfrm6_dst_ops);
392
393 return ret;
394}
395
396static void __net_exit xfrm6_net_exit(struct net *net)
397{
398 xfrm6_net_sysctl_exit(net);
399 dst_entries_destroy(&net->xfrm.xfrm6_dst_ops);
400}
368 401
369static struct pernet_operations xfrm6_net_ops = { 402static struct pernet_operations xfrm6_net_ops = {
370 .init = xfrm6_net_init, 403 .init = xfrm6_net_init,
371 .exit = xfrm6_net_exit, 404 .exit = xfrm6_net_exit,
372}; 405};
373#endif
374 406
375int __init xfrm6_init(void) 407int __init xfrm6_init(void)
376{ 408{
377 int ret; 409 int ret;
378 410
379 dst_entries_init(&xfrm6_dst_ops);
380
381 ret = xfrm6_policy_init(); 411 ret = xfrm6_policy_init();
382 if (ret) { 412 if (ret)
383 dst_entries_destroy(&xfrm6_dst_ops);
384 goto out; 413 goto out;
385 }
386 ret = xfrm6_state_init(); 414 ret = xfrm6_state_init();
387 if (ret) 415 if (ret)
388 goto out_policy; 416 goto out_policy;
@@ -391,9 +419,7 @@ int __init xfrm6_init(void)
391 if (ret) 419 if (ret)
392 goto out_state; 420 goto out_state;
393 421
394#ifdef CONFIG_SYSCTL
395 register_pernet_subsys(&xfrm6_net_ops); 422 register_pernet_subsys(&xfrm6_net_ops);
396#endif
397out: 423out:
398 return ret; 424 return ret;
399out_state: 425out_state:
@@ -405,11 +431,8 @@ out_policy:
405 431
406void xfrm6_fini(void) 432void xfrm6_fini(void)
407{ 433{
408#ifdef CONFIG_SYSCTL
409 unregister_pernet_subsys(&xfrm6_net_ops); 434 unregister_pernet_subsys(&xfrm6_net_ops);
410#endif
411 xfrm6_protocol_fini(); 435 xfrm6_protocol_fini();
412 xfrm6_policy_fini(); 436 xfrm6_policy_fini();
413 xfrm6_state_fini(); 437 xfrm6_state_fini();
414 dst_entries_destroy(&xfrm6_dst_ops);
415} 438}
diff --git a/net/netfilter/nf_tables_netdev.c b/net/netfilter/nf_tables_netdev.c
index 7b9c053ba750..edb3502f2016 100644
--- a/net/netfilter/nf_tables_netdev.c
+++ b/net/netfilter/nf_tables_netdev.c
@@ -94,7 +94,7 @@ nft_do_chain_netdev(void *priv, struct sk_buff *skb,
94{ 94{
95 struct nft_pktinfo pkt; 95 struct nft_pktinfo pkt;
96 96
97 switch (eth_hdr(skb)->h_proto) { 97 switch (skb->protocol) {
98 case htons(ETH_P_IP): 98 case htons(ETH_P_IP):
99 nft_netdev_set_pktinfo_ipv4(&pkt, skb, state); 99 nft_netdev_set_pktinfo_ipv4(&pkt, skb, state);
100 break; 100 break;
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index 8cbca3432f90..939921532764 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -366,6 +366,7 @@ static int nft_ct_get_dump(struct sk_buff *skb, const struct nft_expr *expr)
366 goto nla_put_failure; 366 goto nla_put_failure;
367 367
368 switch (priv->key) { 368 switch (priv->key) {
369 case NFT_CT_L3PROTOCOL:
369 case NFT_CT_PROTOCOL: 370 case NFT_CT_PROTOCOL:
370 case NFT_CT_SRC: 371 case NFT_CT_SRC:
371 case NFT_CT_DST: 372 case NFT_CT_DST:
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index 3e8892216f94..e004067ec24a 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -698,6 +698,10 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr,
698 OVS_NLERR(log, "Failed to allocate conntrack template"); 698 OVS_NLERR(log, "Failed to allocate conntrack template");
699 return -ENOMEM; 699 return -ENOMEM;
700 } 700 }
701
702 __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);
703 nf_conntrack_get(&ct_info.ct->ct_general);
704
701 if (helper) { 705 if (helper) {
702 err = ovs_ct_add_helper(&ct_info, helper, key, log); 706 err = ovs_ct_add_helper(&ct_info, helper, key, log);
703 if (err) 707 if (err)
@@ -709,8 +713,6 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr,
709 if (err) 713 if (err)
710 goto err_free_ct; 714 goto err_free_ct;
711 715
712 __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);
713 nf_conntrack_get(&ct_info.ct->ct_general);
714 return 0; 716 return 0;
715err_free_ct: 717err_free_ct:
716 __ovs_ct_free_action(&ct_info); 718 __ovs_ct_free_action(&ct_info);
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 907d6fd28ede..d1bd4a45ca2d 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -2434,7 +2434,10 @@ static int set_action_to_attr(const struct nlattr *a, struct sk_buff *skb)
2434 if (!start) 2434 if (!start)
2435 return -EMSGSIZE; 2435 return -EMSGSIZE;
2436 2436
2437 err = ovs_nla_put_tunnel_info(skb, tun_info); 2437 err = ip_tun_to_nlattr(skb, &tun_info->key,
2438 ip_tunnel_info_opts(tun_info),
2439 tun_info->options_len,
2440 ip_tunnel_info_af(tun_info));
2438 if (err) 2441 if (err)
2439 return err; 2442 return err;
2440 nla_nest_end(skb, start); 2443 nla_nest_end(skb, start);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index cd34a4a34065..22c2bf367d7e 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4829,7 +4829,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort(
4829 4829
4830 retval = SCTP_DISPOSITION_CONSUME; 4830 retval = SCTP_DISPOSITION_CONSUME;
4831 4831
4832 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4832 if (abort)
4833 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4833 4834
4834 /* Even if we can't send the ABORT due to low memory delete the 4835 /* Even if we can't send the ABORT due to low memory delete the
4835 * TCB. This is a departure from our typical NOMEM handling. 4836 * TCB. This is a departure from our typical NOMEM handling.
@@ -4966,7 +4967,8 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort(
4966 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); 4967 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
4967 retval = SCTP_DISPOSITION_CONSUME; 4968 retval = SCTP_DISPOSITION_CONSUME;
4968 4969
4969 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4970 if (abort)
4971 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4970 4972
4971 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 4973 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
4972 SCTP_STATE(SCTP_STATE_CLOSED)); 4974 SCTP_STATE(SCTP_STATE_CLOSED));
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9b6cc6de80d8..ef1d90fdc773 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1301,8 +1301,9 @@ static int __sctp_setsockopt_connectx(struct sock *sk,
1301 int addrs_size, 1301 int addrs_size,
1302 sctp_assoc_t *assoc_id) 1302 sctp_assoc_t *assoc_id)
1303{ 1303{
1304 int err = 0;
1305 struct sockaddr *kaddrs; 1304 struct sockaddr *kaddrs;
1305 gfp_t gfp = GFP_KERNEL;
1306 int err = 0;
1306 1307
1307 pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", 1308 pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n",
1308 __func__, sk, addrs, addrs_size); 1309 __func__, sk, addrs, addrs_size);
@@ -1315,7 +1316,9 @@ static int __sctp_setsockopt_connectx(struct sock *sk,
1315 return -EFAULT; 1316 return -EFAULT;
1316 1317
1317 /* Alloc space for the address array in kernel memory. */ 1318 /* Alloc space for the address array in kernel memory. */
1318 kaddrs = kmalloc(addrs_size, GFP_KERNEL); 1319 if (sk->sk_socket->file)
1320 gfp = GFP_USER | __GFP_NOWARN;
1321 kaddrs = kmalloc(addrs_size, gfp);
1319 if (unlikely(!kaddrs)) 1322 if (unlikely(!kaddrs))
1320 return -ENOMEM; 1323 return -ENOMEM;
1321 1324
@@ -1513,8 +1516,7 @@ static void sctp_close(struct sock *sk, long timeout)
1513 struct sctp_chunk *chunk; 1516 struct sctp_chunk *chunk;
1514 1517
1515 chunk = sctp_make_abort_user(asoc, NULL, 0); 1518 chunk = sctp_make_abort_user(asoc, NULL, 0);
1516 if (chunk) 1519 sctp_primitive_ABORT(net, asoc, chunk);
1517 sctp_primitive_ABORT(net, asoc, chunk);
1518 } else 1520 } else
1519 sctp_primitive_SHUTDOWN(net, asoc, NULL); 1521 sctp_primitive_SHUTDOWN(net, asoc, NULL);
1520 } 1522 }
@@ -5773,7 +5775,7 @@ static int sctp_getsockopt_assoc_ids(struct sock *sk, int len,
5773 5775
5774 len = sizeof(struct sctp_assoc_ids) + sizeof(sctp_assoc_t) * num; 5776 len = sizeof(struct sctp_assoc_ids) + sizeof(sctp_assoc_t) * num;
5775 5777
5776 ids = kmalloc(len, GFP_KERNEL); 5778 ids = kmalloc(len, GFP_USER | __GFP_NOWARN);
5777 if (unlikely(!ids)) 5779 if (unlikely(!ids))
5778 return -ENOMEM; 5780 return -ENOMEM;
5779 5781
@@ -7199,6 +7201,8 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
7199 7201
7200 if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) 7202 if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)
7201 net_enable_timestamp(); 7203 net_enable_timestamp();
7204
7205 security_sk_clone(sk, newsk);
7202} 7206}
7203 7207
7204static inline void sctp_copy_descendant(struct sock *sk_to, 7208static inline void sctp_copy_descendant(struct sock *sk_to,
diff --git a/net/socket.c b/net/socket.c
index 29822d6dd91e..d730ef9dfbf0 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -257,6 +257,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb)
257 } 257 }
258 init_waitqueue_head(&wq->wait); 258 init_waitqueue_head(&wq->wait);
259 wq->fasync_list = NULL; 259 wq->fasync_list = NULL;
260 wq->flags = 0;
260 RCU_INIT_POINTER(ei->socket.wq, wq); 261 RCU_INIT_POINTER(ei->socket.wq, wq);
261 262
262 ei->socket.state = SS_UNCONNECTED; 263 ei->socket.state = SS_UNCONNECTED;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 948fa5560de5..b5e665b3cfb0 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2826,7 +2826,6 @@ static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst,
2826 2826
2827int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) 2827int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
2828{ 2828{
2829 struct net *net;
2830 int err = 0; 2829 int err = 0;
2831 if (unlikely(afinfo == NULL)) 2830 if (unlikely(afinfo == NULL))
2832 return -EINVAL; 2831 return -EINVAL;
@@ -2857,26 +2856,6 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
2857 } 2856 }
2858 spin_unlock(&xfrm_policy_afinfo_lock); 2857 spin_unlock(&xfrm_policy_afinfo_lock);
2859 2858
2860 rtnl_lock();
2861 for_each_net(net) {
2862 struct dst_ops *xfrm_dst_ops;
2863
2864 switch (afinfo->family) {
2865 case AF_INET:
2866 xfrm_dst_ops = &net->xfrm.xfrm4_dst_ops;
2867 break;
2868#if IS_ENABLED(CONFIG_IPV6)
2869 case AF_INET6:
2870 xfrm_dst_ops = &net->xfrm.xfrm6_dst_ops;
2871 break;
2872#endif
2873 default:
2874 BUG();
2875 }
2876 *xfrm_dst_ops = *afinfo->dst_ops;
2877 }
2878 rtnl_unlock();
2879
2880 return err; 2859 return err;
2881} 2860}
2882EXPORT_SYMBOL(xfrm_policy_register_afinfo); 2861EXPORT_SYMBOL(xfrm_policy_register_afinfo);
@@ -2912,22 +2891,6 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
2912} 2891}
2913EXPORT_SYMBOL(xfrm_policy_unregister_afinfo); 2892EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);
2914 2893
2915static void __net_init xfrm_dst_ops_init(struct net *net)
2916{
2917 struct xfrm_policy_afinfo *afinfo;
2918
2919 rcu_read_lock();
2920 afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]);
2921 if (afinfo)
2922 net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops;
2923#if IS_ENABLED(CONFIG_IPV6)
2924 afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET6]);
2925 if (afinfo)
2926 net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops;
2927#endif
2928 rcu_read_unlock();
2929}
2930
2931static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) 2894static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
2932{ 2895{
2933 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 2896 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
@@ -3076,7 +3039,6 @@ static int __net_init xfrm_net_init(struct net *net)
3076 rv = xfrm_policy_init(net); 3039 rv = xfrm_policy_init(net);
3077 if (rv < 0) 3040 if (rv < 0)
3078 goto out_policy; 3041 goto out_policy;
3079 xfrm_dst_ops_init(net);
3080 rv = xfrm_sysctl_init(net); 3042 rv = xfrm_sysctl_init(net);
3081 if (rv < 0) 3043 if (rv < 0)
3082 goto out_sysctl; 3044 goto out_sysctl;
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 698768bdc581..301d70b0174f 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -48,12 +48,17 @@
48 48
49static int fd_map; /* File descriptor for file being modified. */ 49static int fd_map; /* File descriptor for file being modified. */
50static int mmap_failed; /* Boolean flag. */ 50static int mmap_failed; /* Boolean flag. */
51static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */
52static char gpfx; /* prefix for global symbol name (sometimes '_') */ 51static char gpfx; /* prefix for global symbol name (sometimes '_') */
53static struct stat sb; /* Remember .st_size, etc. */ 52static struct stat sb; /* Remember .st_size, etc. */
54static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */ 53static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */
55static const char *altmcount; /* alternate mcount symbol name */ 54static const char *altmcount; /* alternate mcount symbol name */
56static int warn_on_notrace_sect; /* warn when section has mcount not being recorded */ 55static int warn_on_notrace_sect; /* warn when section has mcount not being recorded */
56static void *file_map; /* pointer of the mapped file */
57static void *file_end; /* pointer to the end of the mapped file */
58static int file_updated; /* flag to state file was changed */
59static void *file_ptr; /* current file pointer location */
60static void *file_append; /* added to the end of the file */
61static size_t file_append_size; /* how much is added to end of file */
57 62
58/* setjmp() return values */ 63/* setjmp() return values */
59enum { 64enum {
@@ -67,10 +72,14 @@ static void
67cleanup(void) 72cleanup(void)
68{ 73{
69 if (!mmap_failed) 74 if (!mmap_failed)
70 munmap(ehdr_curr, sb.st_size); 75 munmap(file_map, sb.st_size);
71 else 76 else
72 free(ehdr_curr); 77 free(file_map);
73 close(fd_map); 78 file_map = NULL;
79 free(file_append);
80 file_append = NULL;
81 file_append_size = 0;
82 file_updated = 0;
74} 83}
75 84
76static void __attribute__((noreturn)) 85static void __attribute__((noreturn))
@@ -92,12 +101,22 @@ succeed_file(void)
92static off_t 101static off_t
93ulseek(int const fd, off_t const offset, int const whence) 102ulseek(int const fd, off_t const offset, int const whence)
94{ 103{
95 off_t const w = lseek(fd, offset, whence); 104 switch (whence) {
96 if (w == (off_t)-1) { 105 case SEEK_SET:
97 perror("lseek"); 106 file_ptr = file_map + offset;
107 break;
108 case SEEK_CUR:
109 file_ptr += offset;
110 break;
111 case SEEK_END:
112 file_ptr = file_map + (sb.st_size - offset);
113 break;
114 }
115 if (file_ptr < file_map) {
116 fprintf(stderr, "lseek: seek before file\n");
98 fail_file(); 117 fail_file();
99 } 118 }
100 return w; 119 return file_ptr - file_map;
101} 120}
102 121
103static size_t 122static size_t
@@ -114,12 +133,38 @@ uread(int const fd, void *const buf, size_t const count)
114static size_t 133static size_t
115uwrite(int const fd, void const *const buf, size_t const count) 134uwrite(int const fd, void const *const buf, size_t const count)
116{ 135{
117 size_t const n = write(fd, buf, count); 136 size_t cnt = count;
118 if (n != count) { 137 off_t idx = 0;
119 perror("write"); 138
120 fail_file(); 139 file_updated = 1;
140
141 if (file_ptr + count >= file_end) {
142 off_t aoffset = (file_ptr + count) - file_end;
143
144 if (aoffset > file_append_size) {
145 file_append = realloc(file_append, aoffset);
146 file_append_size = aoffset;
147 }
148 if (!file_append) {
149 perror("write");
150 fail_file();
151 }
152 if (file_ptr < file_end) {
153 cnt = file_end - file_ptr;
154 } else {
155 cnt = 0;
156 idx = aoffset - count;
157 }
121 } 158 }
122 return n; 159
160 if (cnt)
161 memcpy(file_ptr, buf, cnt);
162
163 if (cnt < count)
164 memcpy(file_append + idx, buf + cnt, count - cnt);
165
166 file_ptr += count;
167 return count;
123} 168}
124 169
125static void * 170static void *
@@ -192,9 +237,7 @@ static int make_nop_arm64(void *map, size_t const offset)
192 */ 237 */
193static void *mmap_file(char const *fname) 238static void *mmap_file(char const *fname)
194{ 239{
195 void *addr; 240 fd_map = open(fname, O_RDONLY);
196
197 fd_map = open(fname, O_RDWR);
198 if (fd_map < 0 || fstat(fd_map, &sb) < 0) { 241 if (fd_map < 0 || fstat(fd_map, &sb) < 0) {
199 perror(fname); 242 perror(fname);
200 fail_file(); 243 fail_file();
@@ -203,15 +246,58 @@ static void *mmap_file(char const *fname)
203 fprintf(stderr, "not a regular file: %s\n", fname); 246 fprintf(stderr, "not a regular file: %s\n", fname);
204 fail_file(); 247 fail_file();
205 } 248 }
206 addr = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, 249 file_map = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE,
207 fd_map, 0); 250 fd_map, 0);
208 mmap_failed = 0; 251 mmap_failed = 0;
209 if (addr == MAP_FAILED) { 252 if (file_map == MAP_FAILED) {
210 mmap_failed = 1; 253 mmap_failed = 1;
211 addr = umalloc(sb.st_size); 254 file_map = umalloc(sb.st_size);
212 uread(fd_map, addr, sb.st_size); 255 uread(fd_map, file_map, sb.st_size);
256 }
257 close(fd_map);
258
259 file_end = file_map + sb.st_size;
260
261 return file_map;
262}
263
264static void write_file(const char *fname)
265{
266 char tmp_file[strlen(fname) + 4];
267 size_t n;
268
269 if (!file_updated)
270 return;
271
272 sprintf(tmp_file, "%s.rc", fname);
273
274 /*
275 * After reading the entire file into memory, delete it
276 * and write it back, to prevent weird side effects of modifying
277 * an object file in place.
278 */
279 fd_map = open(tmp_file, O_WRONLY | O_TRUNC | O_CREAT, sb.st_mode);
280 if (fd_map < 0) {
281 perror(fname);
282 fail_file();
283 }
284 n = write(fd_map, file_map, sb.st_size);
285 if (n != sb.st_size) {
286 perror("write");
287 fail_file();
288 }
289 if (file_append_size) {
290 n = write(fd_map, file_append, file_append_size);
291 if (n != file_append_size) {
292 perror("write");
293 fail_file();
294 }
295 }
296 close(fd_map);
297 if (rename(tmp_file, fname) < 0) {
298 perror(fname);
299 fail_file();
213 } 300 }
214 return addr;
215} 301}
216 302
217/* w8rev, w8nat, ...: Handle endianness. */ 303/* w8rev, w8nat, ...: Handle endianness. */
@@ -318,7 +404,6 @@ do_file(char const *const fname)
318 Elf32_Ehdr *const ehdr = mmap_file(fname); 404 Elf32_Ehdr *const ehdr = mmap_file(fname);
319 unsigned int reltype = 0; 405 unsigned int reltype = 0;
320 406
321 ehdr_curr = ehdr;
322 w = w4nat; 407 w = w4nat;
323 w2 = w2nat; 408 w2 = w2nat;
324 w8 = w8nat; 409 w8 = w8nat;
@@ -441,6 +526,7 @@ do_file(char const *const fname)
441 } 526 }
442 } /* end switch */ 527 } /* end switch */
443 528
529 write_file(fname);
444 cleanup(); 530 cleanup();
445} 531}
446 532
@@ -493,11 +579,14 @@ main(int argc, char *argv[])
493 case SJ_SETJMP: /* normal sequence */ 579 case SJ_SETJMP: /* normal sequence */
494 /* Avoid problems if early cleanup() */ 580 /* Avoid problems if early cleanup() */
495 fd_map = -1; 581 fd_map = -1;
496 ehdr_curr = NULL;
497 mmap_failed = 1; 582 mmap_failed = 1;
583 file_map = NULL;
584 file_ptr = NULL;
585 file_updated = 0;
498 do_file(file); 586 do_file(file);
499 break; 587 break;
500 case SJ_FAIL: /* error in do_file or below */ 588 case SJ_FAIL: /* error in do_file or below */
589 sprintf("%s: failed\n", file);
501 ++n_error; 590 ++n_error;
502 break; 591 break;
503 case SJ_SUCCEED: /* premature success */ 592 case SJ_SUCCEED: /* premature success */
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index fb111eafcb89..1c3872aeed14 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -751,16 +751,16 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
751 751
752 /* the key is probably readable - now try to read it */ 752 /* the key is probably readable - now try to read it */
753can_read_key: 753can_read_key:
754 ret = key_validate(key); 754 ret = -EOPNOTSUPP;
755 if (ret == 0) { 755 if (key->type->read) {
756 ret = -EOPNOTSUPP; 756 /* Read the data with the semaphore held (since we might sleep)
757 if (key->type->read) { 757 * to protect against the key being updated or revoked.
758 /* read the data with the semaphore held (since we 758 */
759 * might sleep) */ 759 down_read(&key->sem);
760 down_read(&key->sem); 760 ret = key_validate(key);
761 if (ret == 0)
761 ret = key->type->read(key, buffer, buflen); 762 ret = key->type->read(key, buffer, buflen);
762 up_read(&key->sem); 763 up_read(&key->sem);
763 }
764 } 764 }
765 765
766error2: 766error2:
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index b3ea24d64c50..93b400800905 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1537,7 +1537,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1537 bool reconfig; 1537 bool reconfig;
1538 unsigned int aif_tx_state, aif_rx_state; 1538 unsigned int aif_tx_state, aif_rx_state;
1539 1539
1540 if (params_rate(params) % 8000) 1540 if (params_rate(params) % 4000)
1541 rates = &arizona_44k1_bclk_rates[0]; 1541 rates = &arizona_44k1_bclk_rates[0];
1542 else 1542 else
1543 rates = &arizona_48k_bclk_rates[0]; 1543 rates = &arizona_48k_bclk_rates[0];
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index ef76940f9dcb..3e3c7f6be29d 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -1667,9 +1667,13 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w,
1667 RT5645_PWR_CLS_D_L, 1667 RT5645_PWR_CLS_D_L,
1668 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | 1668 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R |
1669 RT5645_PWR_CLS_D_L); 1669 RT5645_PWR_CLS_D_L);
1670 snd_soc_update_bits(codec, RT5645_GEN_CTRL3,
1671 RT5645_DET_CLK_MASK, RT5645_DET_CLK_MODE1);
1670 break; 1672 break;
1671 1673
1672 case SND_SOC_DAPM_PRE_PMD: 1674 case SND_SOC_DAPM_PRE_PMD:
1675 snd_soc_update_bits(codec, RT5645_GEN_CTRL3,
1676 RT5645_DET_CLK_MASK, RT5645_DET_CLK_DIS);
1673 snd_soc_write(codec, RT5645_EQ_CTRL2, 0); 1677 snd_soc_write(codec, RT5645_EQ_CTRL2, 0);
1674 snd_soc_update_bits(codec, RT5645_PWR_DIG1, 1678 snd_soc_update_bits(codec, RT5645_PWR_DIG1,
1675 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | 1679 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R |
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index 093e46d559fb..205e0715c99a 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -2122,6 +2122,10 @@ enum {
2122/* General Control3 (0xfc) */ 2122/* General Control3 (0xfc) */
2123#define RT5645_JD_PSV_MODE (0x1 << 12) 2123#define RT5645_JD_PSV_MODE (0x1 << 12)
2124#define RT5645_IRQ_CLK_GATE_CTRL (0x1 << 11) 2124#define RT5645_IRQ_CLK_GATE_CTRL (0x1 << 11)
2125#define RT5645_DET_CLK_MASK (0x3 << 9)
2126#define RT5645_DET_CLK_DIS (0x0 << 9)
2127#define RT5645_DET_CLK_MODE1 (0x1 << 9)
2128#define RT5645_DET_CLK_MODE2 (0x2 << 9)
2125#define RT5645_MICINDET_MANU (0x1 << 7) 2129#define RT5645_MICINDET_MANU (0x1 << 7)
2126#define RT5645_RING2_SLEEVE_GND (0x1 << 5) 2130#define RT5645_RING2_SLEEVE_GND (0x1 << 5)
2127 2131
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index ffea427aeca8..ad4d0f82603e 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1240,7 +1240,6 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
1240 */ 1240 */
1241 ret = snd_soc_tplg_component_load(&platform->component, 1241 ret = snd_soc_tplg_component_load(&platform->component,
1242 &skl_tplg_ops, fw, 0); 1242 &skl_tplg_ops, fw, 0);
1243 release_firmware(fw);
1244 if (ret < 0) { 1243 if (ret < 0) {
1245 dev_err(bus->dev, "tplg component load failed%d\n", ret); 1244 dev_err(bus->dev, "tplg component load failed%d\n", ret);
1246 return -EINVAL; 1245 return -EINVAL;
@@ -1249,5 +1248,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
1249 skl->resource.max_mcps = SKL_MAX_MCPS; 1248 skl->resource.max_mcps = SKL_MAX_MCPS;
1250 skl->resource.max_mem = SKL_FW_MAX_MEM; 1249 skl->resource.max_mem = SKL_FW_MAX_MEM;
1251 1250
1251 skl->tplg = fw;
1252
1252 return 0; 1253 return 0;
1253} 1254}
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 5319529aedf7..caa69c4598a6 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -25,6 +25,7 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/firmware.h>
28#include <sound/pcm.h> 29#include <sound/pcm.h>
29#include "skl.h" 30#include "skl.h"
30 31
@@ -520,6 +521,9 @@ static void skl_remove(struct pci_dev *pci)
520 struct hdac_ext_bus *ebus = pci_get_drvdata(pci); 521 struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
521 struct skl *skl = ebus_to_skl(ebus); 522 struct skl *skl = ebus_to_skl(ebus);
522 523
524 if (skl->tplg)
525 release_firmware(skl->tplg);
526
523 if (pci_dev_run_wake(pci)) 527 if (pci_dev_run_wake(pci))
524 pm_runtime_get_noresume(&pci->dev); 528 pm_runtime_get_noresume(&pci->dev);
525 pci_dev_put(pci); 529 pci_dev_put(pci);
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index dd2e79ae45a8..a0709e344d44 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -68,6 +68,8 @@ struct skl {
68 struct skl_dsp_resource resource; 68 struct skl_dsp_resource resource;
69 struct list_head ppl_list; 69 struct list_head ppl_list;
70 struct list_head dapm_path_list; 70 struct list_head dapm_path_list;
71
72 const struct firmware *tplg;
71}; 73};
72 74
73#define skl_to_ebus(s) (&(s)->ebus) 75#define skl_to_ebus(s) (&(s)->ebus)
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 65461f821a75..7a2f449bd85d 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -1114,7 +1114,7 @@ bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, struct irq_phys_map *map)
1114 return true; 1114 return true;
1115 } 1115 }
1116 1116
1117 return dist_active_irq(vcpu); 1117 return vgic_irq_is_active(vcpu, map->virt_irq);
1118} 1118}
1119 1119
1120/* 1120/*