aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/net/dsa/dsa.txt4
-rw-r--r--Documentation/input/alps.txt8
-rw-r--r--Documentation/input/event-codes.txt6
-rw-r--r--Documentation/input/multi-touch-protocol.txt9
-rw-r--r--MAINTAINERS5
-rw-r--r--Makefile2
-rw-r--r--arch/powerpc/include/asm/cputhreads.h2
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c10
-rw-r--r--arch/x86/kernel/entry_64.S16
-rw-r--r--arch/x86/kernel/kgdb.c2
-rw-r--r--arch/x86/kernel/reboot.c10
-rw-r--r--arch/x86/xen/p2m.c10
-rw-r--r--block/blk-settings.c6
-rw-r--r--drivers/firmware/dmi_scan.c22
-rw-r--r--drivers/gpu/drm/drm_edid_load.c1
-rw-r--r--drivers/gpu/drm/drm_probe_helper.c1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c8
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c17
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c2
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c4
-rw-r--r--drivers/gpu/drm/radeon/cikd.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_mn.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c22
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c4
-rw-r--r--drivers/gpu/drm/radeon/vce_v2_0.c3
-rw-r--r--drivers/iio/accel/bma180.c2
-rw-r--r--drivers/iio/accel/bmc150-accel.c20
-rw-r--r--drivers/iio/accel/kxcjk-1013.c2
-rw-r--r--drivers/iio/adc/Kconfig3
-rw-r--r--drivers/iio/adc/at91_adc.c5
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c3
-rw-r--r--drivers/iio/adc/vf610_adc.c91
-rw-r--r--drivers/iio/gyro/bmg160.c2
-rw-r--r--drivers/iio/imu/adis_trigger.c2
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_core.c56
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c25
-rw-r--r--drivers/iio/imu/kmx61.c2
-rw-r--r--drivers/iio/industrialio-core.c5
-rw-r--r--drivers/iio/industrialio-event.c1
-rw-r--r--drivers/iio/proximity/sx9500.c2
-rw-r--r--drivers/infiniband/core/umem.c8
-rw-r--r--drivers/input/mouse/alps.c48
-rw-r--r--drivers/input/mouse/synaptics.c7
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c57
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c3
-rw-r--r--drivers/net/xen-netfront.c5
-rw-r--r--drivers/of/address.c11
-rw-r--r--drivers/staging/iio/Kconfig1
-rw-r--r--drivers/staging/iio/magnetometer/hmc5843_core.c1
-rw-r--r--drivers/tty/serial/fsl_lpuart.c5
-rw-r--r--drivers/tty/serial/samsung.c1
-rw-r--r--drivers/usb/host/xhci-hub.c9
-rw-r--r--drivers/usb/host/xhci-pci.c2
-rw-r--r--drivers/usb/isp1760/isp1760-udc.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c9
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h6
-rw-r--r--drivers/usb/serial/keyspan_pda.c3
-rw-r--r--drivers/xen/Kconfig17
-rw-r--r--drivers/xen/balloon.c23
-rw-r--r--fs/cifs/cifsencrypt.c6
-rw-r--r--fs/cifs/connect.c13
-rw-r--r--fs/cifs/file.c1
-rw-r--r--fs/cifs/inode.c2
-rw-r--r--fs/cifs/smb2misc.c2
-rw-r--r--fs/cifs/smb2ops.c3
-rw-r--r--fs/cifs/smb2pdu.c17
-rw-r--r--include/linux/irqchip/arm-gic-v3.h17
-rw-r--r--include/linux/lcm.h1
-rw-r--r--include/linux/netdevice.h6
-rw-r--r--include/net/ip.h16
-rw-r--r--include/net/ip6_route.h3
-rw-r--r--include/net/sock.h2
-rw-r--r--include/uapi/linux/input.h3
-rw-r--r--lib/lcm.c11
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/fib_rules.c2
-rw-r--r--net/core/net_namespace.c28
-rw-r--r--net/core/sock.c19
-rw-r--r--net/decnet/dn_rules.c2
-rw-r--r--net/dsa/dsa.c23
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/ipmr.c5
-rw-r--r--net/ipv4/tcp_input.c7
-rw-r--r--net/ipv6/fib6_rules.c2
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/ip6mr.c4
-rw-r--r--net/l2tp/l2tp_core.c1
91 files changed, 575 insertions, 275 deletions
diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
index e124847443f8..f0b4cd72411d 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
@@ -19,7 +19,9 @@ the parent DSA node. The maximum number of allowed child nodes is 4
19(DSA_MAX_SWITCHES). 19(DSA_MAX_SWITCHES).
20Each of these switch child nodes should have the following required properties: 20Each of these switch child nodes should have the following required properties:
21 21
22- reg : Describes the switch address on the MII bus 22- reg : Contains two fields. The first one describes the
23 address on the MII bus. The second is the switch
24 number that must be unique in cascaded configurations
23- #address-cells : Must be 1 25- #address-cells : Must be 1
24- #size-cells : Must be 0 26- #size-cells : Must be 0
25 27
diff --git a/Documentation/input/alps.txt b/Documentation/input/alps.txt
index a63e5e013a8c..92ae734c00c3 100644
--- a/Documentation/input/alps.txt
+++ b/Documentation/input/alps.txt
@@ -114,6 +114,9 @@ ALPS Absolute Mode - Protocol Version 2
114 byte 4: 0 y6 y5 y4 y3 y2 y1 y0 114 byte 4: 0 y6 y5 y4 y3 y2 y1 y0
115 byte 5: 0 z6 z5 z4 z3 z2 z1 z0 115 byte 5: 0 z6 z5 z4 z3 z2 z1 z0
116 116
117Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for
118the DualPoint Stick.
119
117Dualpoint device -- interleaved packet format 120Dualpoint device -- interleaved packet format
118--------------------------------------------- 121---------------------------------------------
119 122
@@ -127,6 +130,11 @@ Dualpoint device -- interleaved packet format
127 byte 7: 0 y6 y5 y4 y3 y2 y1 y0 130 byte 7: 0 y6 y5 y4 y3 y2 y1 y0
128 byte 8: 0 z6 z5 z4 z3 z2 z1 z0 131 byte 8: 0 z6 z5 z4 z3 z2 z1 z0
129 132
133Devices which use the interleaving format normally send standard PS/2 mouse
134packets for the DualPoint Stick + ALPS Absolute Mode packets for the
135touchpad, switching to the interleaved packet format when both the stick and
136the touchpad are used at the same time.
137
130ALPS Absolute Mode - Protocol Version 3 138ALPS Absolute Mode - Protocol Version 3
131--------------------------------------- 139---------------------------------------
132 140
diff --git a/Documentation/input/event-codes.txt b/Documentation/input/event-codes.txt
index c587a966413e..96705616f582 100644
--- a/Documentation/input/event-codes.txt
+++ b/Documentation/input/event-codes.txt
@@ -294,6 +294,12 @@ accordingly. This property does not affect kernel behavior.
294The kernel does not provide button emulation for such devices but treats 294The kernel does not provide button emulation for such devices but treats
295them as any other INPUT_PROP_BUTTONPAD device. 295them as any other INPUT_PROP_BUTTONPAD device.
296 296
297INPUT_PROP_ACCELEROMETER
298-------------------------
299Directional axes on this device (absolute and/or relative x, y, z) represent
300accelerometer data. All other axes retain their meaning. A device must not mix
301regular directional axes and accelerometer axes on the same event node.
302
297Guidelines: 303Guidelines:
298========== 304==========
299The guidelines below ensure proper single-touch and multi-finger functionality. 305The guidelines below ensure proper single-touch and multi-finger functionality.
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt
index 7b4f59c09ee2..b85d000faeb4 100644
--- a/Documentation/input/multi-touch-protocol.txt
+++ b/Documentation/input/multi-touch-protocol.txt
@@ -312,9 +312,12 @@ ABS_MT_TOOL_TYPE
312 312
313The type of approaching tool. A lot of kernel drivers cannot distinguish 313The type of approaching tool. A lot of kernel drivers cannot distinguish
314between different tool types, such as a finger or a pen. In such cases, the 314between different tool types, such as a finger or a pen. In such cases, the
315event should be omitted. The protocol currently supports MT_TOOL_FINGER and 315event should be omitted. The protocol currently supports MT_TOOL_FINGER,
316MT_TOOL_PEN [2]. For type B devices, this event is handled by input core; 316MT_TOOL_PEN, and MT_TOOL_PALM [2]. For type B devices, this event is handled
317drivers should instead use input_mt_report_slot_state(). 317by input core; drivers should instead use input_mt_report_slot_state().
318A contact's ABS_MT_TOOL_TYPE may change over time while still touching the
319device, because the firmware may not be able to determine which tool is being
320used when it first appears.
318 321
319ABS_MT_BLOB_ID 322ABS_MT_BLOB_ID
320 323
diff --git a/MAINTAINERS b/MAINTAINERS
index 7f2eb47f5246..9091b4ad1cc3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -637,8 +637,7 @@ F: drivers/gpu/drm/radeon/radeon_kfd.h
637F: include/uapi/linux/kfd_ioctl.h 637F: include/uapi/linux/kfd_ioctl.h
638 638
639AMD MICROCODE UPDATE SUPPORT 639AMD MICROCODE UPDATE SUPPORT
640M: Andreas Herrmann <herrmann.der.user@googlemail.com> 640M: Borislav Petkov <bp@alien8.de>
641L: amd64-microcode@amd64.org
642S: Maintained 641S: Maintained
643F: arch/x86/kernel/cpu/microcode/amd* 642F: arch/x86/kernel/cpu/microcode/amd*
644 643
@@ -5095,7 +5094,7 @@ S: Supported
5095F: drivers/platform/x86/intel_menlow.c 5094F: drivers/platform/x86/intel_menlow.c
5096 5095
5097INTEL IA32 MICROCODE UPDATE SUPPORT 5096INTEL IA32 MICROCODE UPDATE SUPPORT
5098M: Tigran Aivazian <tigran@aivazian.fsnet.co.uk> 5097M: Borislav Petkov <bp@alien8.de>
5099S: Maintained 5098S: Maintained
5100F: arch/x86/kernel/cpu/microcode/core* 5099F: arch/x86/kernel/cpu/microcode/core*
5101F: arch/x86/kernel/cpu/microcode/intel* 5100F: arch/x86/kernel/cpu/microcode/intel*
diff --git a/Makefile b/Makefile
index da36a3be7969..54430f933b62 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 0 2PATCHLEVEL = 0
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Hurr durr I'ma sheep 5NAME = Hurr durr I'ma sheep
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h
index 2bf8e9307be9..4c8ad592ae33 100644
--- a/arch/powerpc/include/asm/cputhreads.h
+++ b/arch/powerpc/include/asm/cputhreads.h
@@ -55,7 +55,7 @@ static inline cpumask_t cpu_thread_mask_to_cores(const struct cpumask *threads)
55 55
56static inline int cpu_nr_cores(void) 56static inline int cpu_nr_cores(void)
57{ 57{
58 return NR_CPUS >> threads_shift; 58 return nr_cpu_ids >> threads_shift;
59} 59}
60 60
61static inline cpumask_t cpu_online_cores_map(void) 61static inline cpumask_t cpu_online_cores_map(void)
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 498b6d967138..258990688a5e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -212,11 +212,11 @@ static struct event_constraint intel_hsw_event_constraints[] = {
212 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ 212 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */
213 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ 213 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */
214 /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ 214 /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */
215 INTEL_EVENT_CONSTRAINT(0x08a3, 0x4), 215 INTEL_UEVENT_CONSTRAINT(0x08a3, 0x4),
216 /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ 216 /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */
217 INTEL_EVENT_CONSTRAINT(0x0ca3, 0x4), 217 INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4),
218 /* CYCLE_ACTIVITY.CYCLES_NO_EXECUTE */ 218 /* CYCLE_ACTIVITY.CYCLES_NO_EXECUTE */
219 INTEL_EVENT_CONSTRAINT(0x04a3, 0xf), 219 INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf),
220 EVENT_CONSTRAINT_END 220 EVENT_CONSTRAINT_END
221}; 221};
222 222
@@ -1649,11 +1649,11 @@ intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event
1649 if (c) 1649 if (c)
1650 return c; 1650 return c;
1651 1651
1652 c = intel_pebs_constraints(event); 1652 c = intel_shared_regs_constraints(cpuc, event);
1653 if (c) 1653 if (c)
1654 return c; 1654 return c;
1655 1655
1656 c = intel_shared_regs_constraints(cpuc, event); 1656 c = intel_pebs_constraints(event);
1657 if (c) 1657 if (c)
1658 return c; 1658 return c;
1659 1659
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 2babb393915e..f0095a76c182 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -799,7 +799,21 @@ retint_swapgs: /* return to user-space */
799 cmpq %r11,(EFLAGS-ARGOFFSET)(%rsp) /* R11 == RFLAGS */ 799 cmpq %r11,(EFLAGS-ARGOFFSET)(%rsp) /* R11 == RFLAGS */
800 jne opportunistic_sysret_failed 800 jne opportunistic_sysret_failed
801 801
802 testq $X86_EFLAGS_RF,%r11 /* sysret can't restore RF */ 802 /*
803 * SYSRET can't restore RF. SYSRET can restore TF, but unlike IRET,
804 * restoring TF results in a trap from userspace immediately after
805 * SYSRET. This would cause an infinite loop whenever #DB happens
806 * with register state that satisfies the opportunistic SYSRET
807 * conditions. For example, single-stepping this user code:
808 *
809 * movq $stuck_here,%rcx
810 * pushfq
811 * popq %r11
812 * stuck_here:
813 *
814 * would never get past 'stuck_here'.
815 */
816 testq $(X86_EFLAGS_RF|X86_EFLAGS_TF), %r11
803 jnz opportunistic_sysret_failed 817 jnz opportunistic_sysret_failed
804 818
805 /* nothing to check for RSP */ 819 /* nothing to check for RSP */
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 7ec1d5f8d283..25ecd56cefa8 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -72,7 +72,7 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
72 { "bx", 8, offsetof(struct pt_regs, bx) }, 72 { "bx", 8, offsetof(struct pt_regs, bx) },
73 { "cx", 8, offsetof(struct pt_regs, cx) }, 73 { "cx", 8, offsetof(struct pt_regs, cx) },
74 { "dx", 8, offsetof(struct pt_regs, dx) }, 74 { "dx", 8, offsetof(struct pt_regs, dx) },
75 { "si", 8, offsetof(struct pt_regs, dx) }, 75 { "si", 8, offsetof(struct pt_regs, si) },
76 { "di", 8, offsetof(struct pt_regs, di) }, 76 { "di", 8, offsetof(struct pt_regs, di) },
77 { "bp", 8, offsetof(struct pt_regs, bp) }, 77 { "bp", 8, offsetof(struct pt_regs, bp) },
78 { "sp", 8, offsetof(struct pt_regs, sp) }, 78 { "sp", 8, offsetof(struct pt_regs, sp) },
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index bae6c609888e..86db4bcd7ce5 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -183,6 +183,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
183 }, 183 },
184 }, 184 },
185 185
186 /* ASRock */
187 { /* Handle problems with rebooting on ASRock Q1900DC-ITX */
188 .callback = set_pci_reboot,
189 .ident = "ASRock Q1900DC-ITX",
190 .matches = {
191 DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"),
192 DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"),
193 },
194 },
195
186 /* ASUS */ 196 /* ASUS */
187 { /* Handle problems with rebooting on ASUS P4S800 */ 197 { /* Handle problems with rebooting on ASUS P4S800 */
188 .callback = set_bios_reboot, 198 .callback = set_bios_reboot,
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 9f93af56a5fc..b47124d4cd67 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -91,6 +91,12 @@ EXPORT_SYMBOL_GPL(xen_p2m_size);
91unsigned long xen_max_p2m_pfn __read_mostly; 91unsigned long xen_max_p2m_pfn __read_mostly;
92EXPORT_SYMBOL_GPL(xen_max_p2m_pfn); 92EXPORT_SYMBOL_GPL(xen_max_p2m_pfn);
93 93
94#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG_LIMIT
95#define P2M_LIMIT CONFIG_XEN_BALLOON_MEMORY_HOTPLUG_LIMIT
96#else
97#define P2M_LIMIT 0
98#endif
99
94static DEFINE_SPINLOCK(p2m_update_lock); 100static DEFINE_SPINLOCK(p2m_update_lock);
95 101
96static unsigned long *p2m_mid_missing_mfn; 102static unsigned long *p2m_mid_missing_mfn;
@@ -385,9 +391,11 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
385void __init xen_vmalloc_p2m_tree(void) 391void __init xen_vmalloc_p2m_tree(void)
386{ 392{
387 static struct vm_struct vm; 393 static struct vm_struct vm;
394 unsigned long p2m_limit;
388 395
396 p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE;
389 vm.flags = VM_ALLOC; 397 vm.flags = VM_ALLOC;
390 vm.size = ALIGN(sizeof(unsigned long) * xen_max_p2m_pfn, 398 vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit),
391 PMD_SIZE * PMDS_PER_MID_PAGE); 399 PMD_SIZE * PMDS_PER_MID_PAGE);
392 vm_area_register_early(&vm, PMD_SIZE * PMDS_PER_MID_PAGE); 400 vm_area_register_early(&vm, PMD_SIZE * PMDS_PER_MID_PAGE);
393 pr_notice("p2m virtual area at %p, size is %lx\n", vm.addr, vm.size); 401 pr_notice("p2m virtual area at %p, size is %lx\n", vm.addr, vm.size);
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 6ed2cbe5e8c9..12600bfffca9 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -585,7 +585,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
585 b->physical_block_size); 585 b->physical_block_size);
586 586
587 t->io_min = max(t->io_min, b->io_min); 587 t->io_min = max(t->io_min, b->io_min);
588 t->io_opt = lcm(t->io_opt, b->io_opt); 588 t->io_opt = lcm_not_zero(t->io_opt, b->io_opt);
589 589
590 t->cluster &= b->cluster; 590 t->cluster &= b->cluster;
591 t->discard_zeroes_data &= b->discard_zeroes_data; 591 t->discard_zeroes_data &= b->discard_zeroes_data;
@@ -616,7 +616,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
616 b->raid_partial_stripes_expensive); 616 b->raid_partial_stripes_expensive);
617 617
618 /* Find lowest common alignment_offset */ 618 /* Find lowest common alignment_offset */
619 t->alignment_offset = lcm(t->alignment_offset, alignment) 619 t->alignment_offset = lcm_not_zero(t->alignment_offset, alignment)
620 % max(t->physical_block_size, t->io_min); 620 % max(t->physical_block_size, t->io_min);
621 621
622 /* Verify that new alignment_offset is on a logical block boundary */ 622 /* Verify that new alignment_offset is on a logical block boundary */
@@ -643,7 +643,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
643 b->max_discard_sectors); 643 b->max_discard_sectors);
644 t->discard_granularity = max(t->discard_granularity, 644 t->discard_granularity = max(t->discard_granularity,
645 b->discard_granularity); 645 b->discard_granularity);
646 t->discard_alignment = lcm(t->discard_alignment, alignment) % 646 t->discard_alignment = lcm_not_zero(t->discard_alignment, alignment) %
647 t->discard_granularity; 647 t->discard_granularity;
648 } 648 }
649 649
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 69fac068669f..2eebd28b4c40 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -86,10 +86,13 @@ static void dmi_table(u8 *buf, u32 len, int num,
86 int i = 0; 86 int i = 0;
87 87
88 /* 88 /*
89 * Stop when we see all the items the table claimed to have 89 * Stop when we have seen all the items the table claimed to have
90 * OR we run off the end of the table (also happens) 90 * (SMBIOS < 3.0 only) OR we reach an end-of-table marker OR we run
91 * off the end of the table (should never happen but sometimes does
92 * on bogus implementations.)
91 */ 93 */
92 while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { 94 while ((!num || i < num) &&
95 (data - buf + sizeof(struct dmi_header)) <= len) {
93 const struct dmi_header *dm = (const struct dmi_header *)data; 96 const struct dmi_header *dm = (const struct dmi_header *)data;
94 97
95 /* 98 /*
@@ -529,21 +532,10 @@ static int __init dmi_smbios3_present(const u8 *buf)
529 if (memcmp(buf, "_SM3_", 5) == 0 && 532 if (memcmp(buf, "_SM3_", 5) == 0 &&
530 buf[6] < 32 && dmi_checksum(buf, buf[6])) { 533 buf[6] < 32 && dmi_checksum(buf, buf[6])) {
531 dmi_ver = get_unaligned_be16(buf + 7); 534 dmi_ver = get_unaligned_be16(buf + 7);
535 dmi_num = 0; /* No longer specified */
532 dmi_len = get_unaligned_le32(buf + 12); 536 dmi_len = get_unaligned_le32(buf + 12);
533 dmi_base = get_unaligned_le64(buf + 16); 537 dmi_base = get_unaligned_le64(buf + 16);
534 538
535 /*
536 * The 64-bit SMBIOS 3.0 entry point no longer has a field
537 * containing the number of structures present in the table.
538 * Instead, it defines the table size as a maximum size, and
539 * relies on the end-of-table structure type (#127) to be used
540 * to signal the end of the table.
541 * So let's define dmi_num as an upper bound as well: each
542 * structure has a 4 byte header, so dmi_len / 4 is an upper
543 * bound for the number of structures in the table.
544 */
545 dmi_num = dmi_len / 4;
546
547 if (dmi_walk_early(dmi_decode) == 0) { 539 if (dmi_walk_early(dmi_decode) == 0) {
548 pr_info("SMBIOS %d.%d present.\n", 540 pr_info("SMBIOS %d.%d present.\n",
549 dmi_ver >> 8, dmi_ver & 0xFF); 541 dmi_ver >> 8, dmi_ver & 0xFF);
diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
index 732cb6f8e653..4c0aa97aaf03 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -287,6 +287,7 @@ int drm_load_edid_firmware(struct drm_connector *connector)
287 287
288 drm_mode_connector_update_edid_property(connector, edid); 288 drm_mode_connector_update_edid_property(connector, edid);
289 ret = drm_add_edid_modes(connector, edid); 289 ret = drm_add_edid_modes(connector, edid);
290 drm_edid_to_eld(connector, edid);
290 kfree(edid); 291 kfree(edid);
291 292
292 return ret; 293 return ret;
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 6591d48c1b9d..3fee587bc284 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -174,6 +174,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
174 struct edid *edid = (struct edid *) connector->edid_blob_ptr->data; 174 struct edid *edid = (struct edid *) connector->edid_blob_ptr->data;
175 175
176 count = drm_add_edid_modes(connector, edid); 176 count = drm_add_edid_modes(connector, edid);
177 drm_edid_to_eld(connector, edid);
177 } else 178 } else
178 count = (*connector_funcs->get_modes)(connector); 179 count = (*connector_funcs->get_modes)(connector);
179 } 180 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index c300e22da8ac..33a10ce967ea 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -147,6 +147,7 @@ struct fimd_win_data {
147 unsigned int ovl_height; 147 unsigned int ovl_height;
148 unsigned int fb_width; 148 unsigned int fb_width;
149 unsigned int fb_height; 149 unsigned int fb_height;
150 unsigned int fb_pitch;
150 unsigned int bpp; 151 unsigned int bpp;
151 unsigned int pixel_format; 152 unsigned int pixel_format;
152 dma_addr_t dma_addr; 153 dma_addr_t dma_addr;
@@ -532,13 +533,14 @@ static void fimd_win_mode_set(struct exynos_drm_crtc *crtc,
532 win_data->offset_y = plane->crtc_y; 533 win_data->offset_y = plane->crtc_y;
533 win_data->ovl_width = plane->crtc_width; 534 win_data->ovl_width = plane->crtc_width;
534 win_data->ovl_height = plane->crtc_height; 535 win_data->ovl_height = plane->crtc_height;
536 win_data->fb_pitch = plane->pitch;
535 win_data->fb_width = plane->fb_width; 537 win_data->fb_width = plane->fb_width;
536 win_data->fb_height = plane->fb_height; 538 win_data->fb_height = plane->fb_height;
537 win_data->dma_addr = plane->dma_addr[0] + offset; 539 win_data->dma_addr = plane->dma_addr[0] + offset;
538 win_data->bpp = plane->bpp; 540 win_data->bpp = plane->bpp;
539 win_data->pixel_format = plane->pixel_format; 541 win_data->pixel_format = plane->pixel_format;
540 win_data->buf_offsize = (plane->fb_width - plane->crtc_width) * 542 win_data->buf_offsize =
541 (plane->bpp >> 3); 543 plane->pitch - (plane->crtc_width * (plane->bpp >> 3));
542 win_data->line_size = plane->crtc_width * (plane->bpp >> 3); 544 win_data->line_size = plane->crtc_width * (plane->bpp >> 3);
543 545
544 DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n", 546 DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n",
@@ -704,7 +706,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)
704 writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); 706 writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
705 707
706 /* buffer end address */ 708 /* buffer end address */
707 size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); 709 size = win_data->fb_pitch * win_data->ovl_height * (win_data->bpp >> 3);
708 val = (unsigned long)(win_data->dma_addr + size); 710 val = (unsigned long)(win_data->dma_addr + size);
709 writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); 711 writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
710 712
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 3518bc4654c5..2e3bc57ea50e 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -55,6 +55,7 @@ struct hdmi_win_data {
55 unsigned int fb_x; 55 unsigned int fb_x;
56 unsigned int fb_y; 56 unsigned int fb_y;
57 unsigned int fb_width; 57 unsigned int fb_width;
58 unsigned int fb_pitch;
58 unsigned int fb_height; 59 unsigned int fb_height;
59 unsigned int src_width; 60 unsigned int src_width;
60 unsigned int src_height; 61 unsigned int src_height;
@@ -438,7 +439,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
438 } else { 439 } else {
439 luma_addr[0] = win_data->dma_addr; 440 luma_addr[0] = win_data->dma_addr;
440 chroma_addr[0] = win_data->dma_addr 441 chroma_addr[0] = win_data->dma_addr
441 + (win_data->fb_width * win_data->fb_height); 442 + (win_data->fb_pitch * win_data->fb_height);
442 } 443 }
443 444
444 if (win_data->scan_flags & DRM_MODE_FLAG_INTERLACE) { 445 if (win_data->scan_flags & DRM_MODE_FLAG_INTERLACE) {
@@ -447,8 +448,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
447 luma_addr[1] = luma_addr[0] + 0x40; 448 luma_addr[1] = luma_addr[0] + 0x40;
448 chroma_addr[1] = chroma_addr[0] + 0x40; 449 chroma_addr[1] = chroma_addr[0] + 0x40;
449 } else { 450 } else {
450 luma_addr[1] = luma_addr[0] + win_data->fb_width; 451 luma_addr[1] = luma_addr[0] + win_data->fb_pitch;
451 chroma_addr[1] = chroma_addr[0] + win_data->fb_width; 452 chroma_addr[1] = chroma_addr[0] + win_data->fb_pitch;
452 } 453 }
453 } else { 454 } else {
454 ctx->interlace = false; 455 ctx->interlace = false;
@@ -469,10 +470,10 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
469 vp_reg_writemask(res, VP_MODE, val, VP_MODE_FMT_MASK); 470 vp_reg_writemask(res, VP_MODE, val, VP_MODE_FMT_MASK);
470 471
471 /* setting size of input image */ 472 /* setting size of input image */
472 vp_reg_write(res, VP_IMG_SIZE_Y, VP_IMG_HSIZE(win_data->fb_width) | 473 vp_reg_write(res, VP_IMG_SIZE_Y, VP_IMG_HSIZE(win_data->fb_pitch) |
473 VP_IMG_VSIZE(win_data->fb_height)); 474 VP_IMG_VSIZE(win_data->fb_height));
474 /* chroma height has to reduced by 2 to avoid chroma distorions */ 475 /* chroma height has to reduced by 2 to avoid chroma distorions */
475 vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(win_data->fb_width) | 476 vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(win_data->fb_pitch) |
476 VP_IMG_VSIZE(win_data->fb_height / 2)); 477 VP_IMG_VSIZE(win_data->fb_height / 2));
477 478
478 vp_reg_write(res, VP_SRC_WIDTH, win_data->src_width); 479 vp_reg_write(res, VP_SRC_WIDTH, win_data->src_width);
@@ -559,7 +560,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
559 /* converting dma address base and source offset */ 560 /* converting dma address base and source offset */
560 dma_addr = win_data->dma_addr 561 dma_addr = win_data->dma_addr
561 + (win_data->fb_x * win_data->bpp >> 3) 562 + (win_data->fb_x * win_data->bpp >> 3)
562 + (win_data->fb_y * win_data->fb_width * win_data->bpp >> 3); 563 + (win_data->fb_y * win_data->fb_pitch);
563 src_x_offset = 0; 564 src_x_offset = 0;
564 src_y_offset = 0; 565 src_y_offset = 0;
565 566
@@ -576,7 +577,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
576 MXR_GRP_CFG_FORMAT_VAL(fmt), MXR_GRP_CFG_FORMAT_MASK); 577 MXR_GRP_CFG_FORMAT_VAL(fmt), MXR_GRP_CFG_FORMAT_MASK);
577 578
578 /* setup geometry */ 579 /* setup geometry */
579 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win), win_data->fb_width); 580 mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
581 win_data->fb_pitch / (win_data->bpp >> 3));
580 582
581 /* setup display size */ 583 /* setup display size */
582 if (ctx->mxr_ver == MXR_VER_128_0_0_184 && 584 if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
@@ -961,6 +963,7 @@ static void mixer_win_mode_set(struct exynos_drm_crtc *crtc,
961 win_data->fb_y = plane->fb_y; 963 win_data->fb_y = plane->fb_y;
962 win_data->fb_width = plane->fb_width; 964 win_data->fb_width = plane->fb_width;
963 win_data->fb_height = plane->fb_height; 965 win_data->fb_height = plane->fb_height;
966 win_data->fb_pitch = plane->pitch;
964 win_data->src_width = plane->src_width; 967 win_data->src_width = plane->src_width;
965 win_data->src_height = plane->src_height; 968 win_data->src_height = plane->src_height;
966 969
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index b773368fc62c..38a742532c4f 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1487,7 +1487,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
1487 goto err; 1487 goto err;
1488 } 1488 }
1489 1489
1490 if (i915_needs_cmd_parser(ring)) { 1490 if (i915_needs_cmd_parser(ring) && args->batch_len) {
1491 batch_obj = i915_gem_execbuffer_parse(ring, 1491 batch_obj = i915_gem_execbuffer_parse(ring,
1492 &shadow_exec_entry, 1492 &shadow_exec_entry,
1493 eb, 1493 eb,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 0a52c44ad03d..9c5451c97942 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1322,7 +1322,7 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
1322 drm_modeset_lock_all(dev); 1322 drm_modeset_lock_all(dev);
1323 1323
1324 plane = drm_plane_find(dev, set->plane_id); 1324 plane = drm_plane_find(dev, set->plane_id);
1325 if (!plane) { 1325 if (!plane || plane->type != DRM_PLANE_TYPE_OVERLAY) {
1326 ret = -ENOENT; 1326 ret = -ENOENT;
1327 goto out_unlock; 1327 goto out_unlock;
1328 } 1328 }
@@ -1349,7 +1349,7 @@ int intel_sprite_get_colorkey(struct drm_device *dev, void *data,
1349 drm_modeset_lock_all(dev); 1349 drm_modeset_lock_all(dev);
1350 1350
1351 plane = drm_plane_find(dev, get->plane_id); 1351 plane = drm_plane_find(dev, get->plane_id);
1352 if (!plane) { 1352 if (!plane || plane->type != DRM_PLANE_TYPE_OVERLAY) {
1353 ret = -ENOENT; 1353 ret = -ENOENT;
1354 goto out_unlock; 1354 goto out_unlock;
1355 } 1355 }
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h
index c648e1996dab..243a36c93b8f 100644
--- a/drivers/gpu/drm/radeon/cikd.h
+++ b/drivers/gpu/drm/radeon/cikd.h
@@ -2129,6 +2129,7 @@
2129#define VCE_UENC_REG_CLOCK_GATING 0x207c0 2129#define VCE_UENC_REG_CLOCK_GATING 0x207c0
2130#define VCE_SYS_INT_EN 0x21300 2130#define VCE_SYS_INT_EN 0x21300
2131# define VCE_SYS_INT_TRAP_INTERRUPT_EN (1 << 3) 2131# define VCE_SYS_INT_TRAP_INTERRUPT_EN (1 << 3)
2132#define VCE_LMI_VCPU_CACHE_40BIT_BAR 0x2145c
2132#define VCE_LMI_CTRL2 0x21474 2133#define VCE_LMI_CTRL2 0x21474
2133#define VCE_LMI_CTRL 0x21498 2134#define VCE_LMI_CTRL 0x21498
2134#define VCE_LMI_VM_CTRL 0x214a0 2135#define VCE_LMI_VM_CTRL 0x214a0
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5587603b4a89..33d5a4f4eebd 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1565,6 +1565,7 @@ struct radeon_dpm {
1565 int new_active_crtc_count; 1565 int new_active_crtc_count;
1566 u32 current_active_crtcs; 1566 u32 current_active_crtcs;
1567 int current_active_crtc_count; 1567 int current_active_crtc_count;
1568 bool single_display;
1568 struct radeon_dpm_dynamic_state dyn_state; 1569 struct radeon_dpm_dynamic_state dyn_state;
1569 struct radeon_dpm_fan fan; 1570 struct radeon_dpm_fan fan;
1570 u32 tdp_limit; 1571 u32 tdp_limit;
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 63ccb8fa799c..d27e4ccb848c 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
76 76
77static bool radeon_read_bios(struct radeon_device *rdev) 77static bool radeon_read_bios(struct radeon_device *rdev)
78{ 78{
79 uint8_t __iomem *bios; 79 uint8_t __iomem *bios, val1, val2;
80 size_t size; 80 size_t size;
81 81
82 rdev->bios = NULL; 82 rdev->bios = NULL;
@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev)
86 return false; 86 return false;
87 } 87 }
88 88
89 if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { 89 val1 = readb(&bios[0]);
90 val2 = readb(&bios[1]);
91
92 if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
90 pci_unmap_rom(rdev->pdev, bios); 93 pci_unmap_rom(rdev->pdev, bios);
91 return false; 94 return false;
92 } 95 }
93 rdev->bios = kmemdup(bios, size, GFP_KERNEL); 96 rdev->bios = kzalloc(size, GFP_KERNEL);
94 if (rdev->bios == NULL) { 97 if (rdev->bios == NULL) {
95 pci_unmap_rom(rdev->pdev, bios); 98 pci_unmap_rom(rdev->pdev, bios);
96 return false; 99 return false;
97 } 100 }
101 memcpy_fromio(rdev->bios, bios, size);
98 pci_unmap_rom(rdev->pdev, bios); 102 pci_unmap_rom(rdev->pdev, bios);
99 return true; 103 return true;
100} 104}
diff --git a/drivers/gpu/drm/radeon/radeon_mn.c b/drivers/gpu/drm/radeon/radeon_mn.c
index a69bd441dd2d..572b4dbec186 100644
--- a/drivers/gpu/drm/radeon/radeon_mn.c
+++ b/drivers/gpu/drm/radeon/radeon_mn.c
@@ -122,7 +122,6 @@ static void radeon_mn_invalidate_range_start(struct mmu_notifier *mn,
122 it = interval_tree_iter_first(&rmn->objects, start, end); 122 it = interval_tree_iter_first(&rmn->objects, start, end);
123 while (it) { 123 while (it) {
124 struct radeon_bo *bo; 124 struct radeon_bo *bo;
125 struct fence *fence;
126 int r; 125 int r;
127 126
128 bo = container_of(it, struct radeon_bo, mn_it); 127 bo = container_of(it, struct radeon_bo, mn_it);
@@ -134,12 +133,10 @@ static void radeon_mn_invalidate_range_start(struct mmu_notifier *mn,
134 continue; 133 continue;
135 } 134 }
136 135
137 fence = reservation_object_get_excl(bo->tbo.resv); 136 r = reservation_object_wait_timeout_rcu(bo->tbo.resv, true,
138 if (fence) { 137 false, MAX_SCHEDULE_TIMEOUT);
139 r = radeon_fence_wait((struct radeon_fence *)fence, false); 138 if (r)
140 if (r) 139 DRM_ERROR("(%d) failed to wait for user bo\n", r);
141 DRM_ERROR("(%d) failed to wait for user bo\n", r);
142 }
143 140
144 radeon_ttm_placement_from_domain(bo, RADEON_GEM_DOMAIN_CPU); 141 radeon_ttm_placement_from_domain(bo, RADEON_GEM_DOMAIN_CPU);
145 r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false); 142 r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 33cf4108386d..c1ba83a8dd8c 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -837,12 +837,8 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work)
837 radeon_pm_compute_clocks(rdev); 837 radeon_pm_compute_clocks(rdev);
838} 838}
839 839
840static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, 840static bool radeon_dpm_single_display(struct radeon_device *rdev)
841 enum radeon_pm_state_type dpm_state)
842{ 841{
843 int i;
844 struct radeon_ps *ps;
845 u32 ui_class;
846 bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ? 842 bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ?
847 true : false; 843 true : false;
848 844
@@ -858,6 +854,17 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
858 if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120)) 854 if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120))
859 single_display = false; 855 single_display = false;
860 856
857 return single_display;
858}
859
860static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
861 enum radeon_pm_state_type dpm_state)
862{
863 int i;
864 struct radeon_ps *ps;
865 u32 ui_class;
866 bool single_display = radeon_dpm_single_display(rdev);
867
861 /* certain older asics have a separare 3D performance state, 868 /* certain older asics have a separare 3D performance state,
862 * so try that first if the user selected performance 869 * so try that first if the user selected performance
863 */ 870 */
@@ -983,6 +990,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
983 struct radeon_ps *ps; 990 struct radeon_ps *ps;
984 enum radeon_pm_state_type dpm_state; 991 enum radeon_pm_state_type dpm_state;
985 int ret; 992 int ret;
993 bool single_display = radeon_dpm_single_display(rdev);
986 994
987 /* if dpm init failed */ 995 /* if dpm init failed */
988 if (!rdev->pm.dpm_enabled) 996 if (!rdev->pm.dpm_enabled)
@@ -1007,6 +1015,9 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
1007 /* vce just modifies an existing state so force a change */ 1015 /* vce just modifies an existing state so force a change */
1008 if (ps->vce_active != rdev->pm.dpm.vce_active) 1016 if (ps->vce_active != rdev->pm.dpm.vce_active)
1009 goto force; 1017 goto force;
1018 /* user has made a display change (such as timing) */
1019 if (rdev->pm.dpm.single_display != single_display)
1020 goto force;
1010 if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) { 1021 if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) {
1011 /* for pre-BTC and APUs if the num crtcs changed but state is the same, 1022 /* for pre-BTC and APUs if the num crtcs changed but state is the same,
1012 * all we need to do is update the display configuration. 1023 * all we need to do is update the display configuration.
@@ -1069,6 +1080,7 @@ force:
1069 1080
1070 rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; 1081 rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs;
1071 rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; 1082 rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count;
1083 rdev->pm.dpm.single_display = single_display;
1072 1084
1073 /* wait for the rings to drain */ 1085 /* wait for the rings to drain */
1074 for (i = 0; i < RADEON_NUM_RINGS; i++) { 1086 for (i = 0; i < RADEON_NUM_RINGS; i++) {
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 2456f69efd23..8c7872339c2a 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -495,7 +495,7 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)
495 seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); 495 seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw);
496 seq_printf(m, "%u dwords in ring\n", count); 496 seq_printf(m, "%u dwords in ring\n", count);
497 497
498 if (!ring->ready) 498 if (!ring->ring)
499 return 0; 499 return 0;
500 500
501 /* print 8 dw before current rptr as often it's the last executed 501 /* print 8 dw before current rptr as often it's the last executed
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index d02aa1d0f588..b292aca0f342 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -598,6 +598,10 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
598 enum dma_data_direction direction = write ? 598 enum dma_data_direction direction = write ?
599 DMA_BIDIRECTIONAL : DMA_TO_DEVICE; 599 DMA_BIDIRECTIONAL : DMA_TO_DEVICE;
600 600
601 /* double check that we don't free the table twice */
602 if (!ttm->sg->sgl)
603 return;
604
601 /* free the sg table and pages again */ 605 /* free the sg table and pages again */
602 dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction); 606 dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
603 607
diff --git a/drivers/gpu/drm/radeon/vce_v2_0.c b/drivers/gpu/drm/radeon/vce_v2_0.c
index 1ac7bb825a1b..fbbe78fbd087 100644
--- a/drivers/gpu/drm/radeon/vce_v2_0.c
+++ b/drivers/gpu/drm/radeon/vce_v2_0.c
@@ -156,6 +156,9 @@ int vce_v2_0_resume(struct radeon_device *rdev)
156 WREG32(VCE_LMI_SWAP_CNTL1, 0); 156 WREG32(VCE_LMI_SWAP_CNTL1, 0);
157 WREG32(VCE_LMI_VM_CTRL, 0); 157 WREG32(VCE_LMI_VM_CTRL, 0);
158 158
159 WREG32(VCE_LMI_VCPU_CACHE_40BIT_BAR, addr >> 8);
160
161 addr &= 0xff;
159 size = RADEON_GPU_PAGE_ALIGN(rdev->vce_fw->size); 162 size = RADEON_GPU_PAGE_ALIGN(rdev->vce_fw->size);
160 WREG32(VCE_VCPU_CACHE_OFFSET0, addr & 0x7fffffff); 163 WREG32(VCE_VCPU_CACHE_OFFSET0, addr & 0x7fffffff);
161 WREG32(VCE_VCPU_CACHE_SIZE0, size); 164 WREG32(VCE_VCPU_CACHE_SIZE0, size);
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 1096da327130..75c6d2103e07 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
659 659
660 mutex_lock(&data->mutex); 660 mutex_lock(&data->mutex);
661 661
662 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 662 for_each_set_bit(bit, indio_dev->active_scan_mask,
663 indio_dev->masklength) { 663 indio_dev->masklength) {
664 ret = bma180_get_data_reg(data, bit); 664 ret = bma180_get_data_reg(data, bit);
665 if (ret < 0) { 665 if (ret < 0) {
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c
index 066d0c04072c..75567fd457dc 100644
--- a/drivers/iio/accel/bmc150-accel.c
+++ b/drivers/iio/accel/bmc150-accel.c
@@ -168,14 +168,14 @@ static const struct {
168 int val; 168 int val;
169 int val2; 169 int val2;
170 u8 bw_bits; 170 u8 bw_bits;
171} bmc150_accel_samp_freq_table[] = { {7, 810000, 0x08}, 171} bmc150_accel_samp_freq_table[] = { {15, 620000, 0x08},
172 {15, 630000, 0x09}, 172 {31, 260000, 0x09},
173 {31, 250000, 0x0A}, 173 {62, 500000, 0x0A},
174 {62, 500000, 0x0B}, 174 {125, 0, 0x0B},
175 {125, 0, 0x0C}, 175 {250, 0, 0x0C},
176 {250, 0, 0x0D}, 176 {500, 0, 0x0D},
177 {500, 0, 0x0E}, 177 {1000, 0, 0x0E},
178 {1000, 0, 0x0F} }; 178 {2000, 0, 0x0F} };
179 179
180static const struct { 180static const struct {
181 int bw_bits; 181 int bw_bits;
@@ -840,7 +840,7 @@ static int bmc150_accel_validate_trigger(struct iio_dev *indio_dev,
840} 840}
841 841
842static IIO_CONST_ATTR_SAMP_FREQ_AVAIL( 842static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
843 "7.810000 15.630000 31.250000 62.500000 125 250 500 1000"); 843 "15.620000 31.260000 62.50000 125 250 500 1000 2000");
844 844
845static struct attribute *bmc150_accel_attributes[] = { 845static struct attribute *bmc150_accel_attributes[] = {
846 &iio_const_attr_sampling_frequency_available.dev_attr.attr, 846 &iio_const_attr_sampling_frequency_available.dev_attr.attr,
@@ -986,7 +986,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)
986 int bit, ret, i = 0; 986 int bit, ret, i = 0;
987 987
988 mutex_lock(&data->mutex); 988 mutex_lock(&data->mutex);
989 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 989 for_each_set_bit(bit, indio_dev->active_scan_mask,
990 indio_dev->masklength) { 990 indio_dev->masklength) {
991 ret = i2c_smbus_read_word_data(data->client, 991 ret = i2c_smbus_read_word_data(data->client,
992 BMC150_ACCEL_AXIS_TO_REG(bit)); 992 BMC150_ACCEL_AXIS_TO_REG(bit));
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 567de269cc00..1a6379525fa4 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
956 956
957 mutex_lock(&data->mutex); 957 mutex_lock(&data->mutex);
958 958
959 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 959 for_each_set_bit(bit, indio_dev->active_scan_mask,
960 indio_dev->masklength) { 960 indio_dev->masklength) {
961 ret = kxcjk1013_get_acc_reg(data, bit); 961 ret = kxcjk1013_get_acc_reg(data, bit);
962 if (ret < 0) { 962 if (ret < 0) {
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 202daf889be2..46379b1fb25b 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -137,7 +137,8 @@ config AXP288_ADC
137 137
138config CC10001_ADC 138config CC10001_ADC
139 tristate "Cosmic Circuits 10001 ADC driver" 139 tristate "Cosmic Circuits 10001 ADC driver"
140 depends on HAS_IOMEM || HAVE_CLK || REGULATOR 140 depends on HAVE_CLK || REGULATOR
141 depends on HAS_IOMEM
141 select IIO_BUFFER 142 select IIO_BUFFER
142 select IIO_TRIGGERED_BUFFER 143 select IIO_TRIGGERED_BUFFER
143 help 144 help
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index ff61ae55dd3f..8a0eb4a04fb5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
544{ 544{
545 struct iio_dev *idev = iio_trigger_get_drvdata(trig); 545 struct iio_dev *idev = iio_trigger_get_drvdata(trig);
546 struct at91_adc_state *st = iio_priv(idev); 546 struct at91_adc_state *st = iio_priv(idev);
547 struct iio_buffer *buffer = idev->buffer;
548 struct at91_adc_reg_desc *reg = st->registers; 547 struct at91_adc_reg_desc *reg = st->registers;
549 u32 status = at91_adc_readl(st, reg->trigger_register); 548 u32 status = at91_adc_readl(st, reg->trigger_register);
550 int value; 549 int value;
@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
564 at91_adc_writel(st, reg->trigger_register, 563 at91_adc_writel(st, reg->trigger_register,
565 status | value); 564 status | value);
566 565
567 for_each_set_bit(bit, buffer->scan_mask, 566 for_each_set_bit(bit, idev->active_scan_mask,
568 st->num_channels) { 567 st->num_channels) {
569 struct iio_chan_spec const *chan = idev->channels + bit; 568 struct iio_chan_spec const *chan = idev->channels + bit;
570 at91_adc_writel(st, AT91_ADC_CHER, 569 at91_adc_writel(st, AT91_ADC_CHER,
@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
579 at91_adc_writel(st, reg->trigger_register, 578 at91_adc_writel(st, reg->trigger_register,
580 status & ~value); 579 status & ~value);
581 580
582 for_each_set_bit(bit, buffer->scan_mask, 581 for_each_set_bit(bit, idev->active_scan_mask,
583 st->num_channels) { 582 st->num_channels) {
584 struct iio_chan_spec const *chan = idev->channels + bit; 583 struct iio_chan_spec const *chan = idev->channels + bit;
585 at91_adc_writel(st, AT91_ADC_CHDR, 584 at91_adc_writel(st, AT91_ADC_CHDR,
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 2e5cc4409f78..a0e7161f040c 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -188,12 +188,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
188static int tiadc_buffer_postenable(struct iio_dev *indio_dev) 188static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
189{ 189{
190 struct tiadc_device *adc_dev = iio_priv(indio_dev); 190 struct tiadc_device *adc_dev = iio_priv(indio_dev);
191 struct iio_buffer *buffer = indio_dev->buffer;
192 unsigned int enb = 0; 191 unsigned int enb = 0;
193 u8 bit; 192 u8 bit;
194 193
195 tiadc_step_config(indio_dev); 194 tiadc_step_config(indio_dev);
196 for_each_set_bit(bit, buffer->scan_mask, adc_dev->channels) 195 for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels)
197 enb |= (get_adc_step_bit(adc_dev, bit) << 1); 196 enb |= (get_adc_step_bit(adc_dev, bit) << 1);
198 adc_dev->buffer_en_ch_steps = enb; 197 adc_dev->buffer_en_ch_steps = enb;
199 198
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index 8ec353c01d98..e63b8e76d4c3 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -141,9 +141,13 @@ struct vf610_adc {
141 struct regulator *vref; 141 struct regulator *vref;
142 struct vf610_adc_feature adc_feature; 142 struct vf610_adc_feature adc_feature;
143 143
144 u32 sample_freq_avail[5];
145
144 struct completion completion; 146 struct completion completion;
145}; 147};
146 148
149static const u32 vf610_hw_avgs[] = { 1, 4, 8, 16, 32 };
150
147#define VF610_ADC_CHAN(_idx, _chan_type) { \ 151#define VF610_ADC_CHAN(_idx, _chan_type) { \
148 .type = (_chan_type), \ 152 .type = (_chan_type), \
149 .indexed = 1, \ 153 .indexed = 1, \
@@ -180,35 +184,47 @@ static const struct iio_chan_spec vf610_adc_iio_channels[] = {
180 /* sentinel */ 184 /* sentinel */
181}; 185};
182 186
183/* 187static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
184 * ADC sample frequency, unit is ADCK cycles. 188{
185 * ADC clk source is ipg clock, which is the same as bus clock. 189 unsigned long adck_rate, ipg_rate = clk_get_rate(info->clk);
186 * 190 int i;
187 * ADC conversion time = SFCAdder + AverageNum x (BCT + LSTAdder) 191
188 * SFCAdder: fixed to 6 ADCK cycles 192 /*
189 * AverageNum: 1, 4, 8, 16, 32 samples for hardware average. 193 * Calculate ADC sample frequencies
190 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode 194 * Sample time unit is ADCK cycles. ADCK clk source is ipg clock,
191 * LSTAdder(Long Sample Time): fixed to 3 ADCK cycles 195 * which is the same as bus clock.
192 * 196 *
193 * By default, enable 12 bit resolution mode, clock source 197 * ADC conversion time = SFCAdder + AverageNum x (BCT + LSTAdder)
194 * set to ipg clock, So get below frequency group: 198 * SFCAdder: fixed to 6 ADCK cycles
195 */ 199 * AverageNum: 1, 4, 8, 16, 32 samples for hardware average.
196static const u32 vf610_sample_freq_avail[5] = 200 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
197{1941176, 559332, 286957, 145374, 73171}; 201 * LSTAdder(Long Sample Time): fixed to 3 ADCK cycles
202 */
203 adck_rate = ipg_rate / info->adc_feature.clk_div;
204 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)
205 info->sample_freq_avail[i] =
206 adck_rate / (6 + vf610_hw_avgs[i] * (25 + 3));
207}
198 208
199static inline void vf610_adc_cfg_init(struct vf610_adc *info) 209static inline void vf610_adc_cfg_init(struct vf610_adc *info)
200{ 210{
211 struct vf610_adc_feature *adc_feature = &info->adc_feature;
212
201 /* set default Configuration for ADC controller */ 213 /* set default Configuration for ADC controller */
202 info->adc_feature.clk_sel = VF610_ADCIOC_BUSCLK_SET; 214 adc_feature->clk_sel = VF610_ADCIOC_BUSCLK_SET;
203 info->adc_feature.vol_ref = VF610_ADCIOC_VR_VREF_SET; 215 adc_feature->vol_ref = VF610_ADCIOC_VR_VREF_SET;
216
217 adc_feature->calibration = true;
218 adc_feature->ovwren = true;
219
220 adc_feature->res_mode = 12;
221 adc_feature->sample_rate = 1;
222 adc_feature->lpm = true;
204 223
205 info->adc_feature.calibration = true; 224 /* Use a save ADCK which is below 20MHz on all devices */
206 info->adc_feature.ovwren = true; 225 adc_feature->clk_div = 8;
207 226
208 info->adc_feature.clk_div = 1; 227 vf610_adc_calculate_rates(info);
209 info->adc_feature.res_mode = 12;
210 info->adc_feature.sample_rate = 1;
211 info->adc_feature.lpm = true;
212} 228}
213 229
214static void vf610_adc_cfg_post_set(struct vf610_adc *info) 230static void vf610_adc_cfg_post_set(struct vf610_adc *info)
@@ -290,12 +306,10 @@ static void vf610_adc_cfg_set(struct vf610_adc *info)
290 306
291 cfg_data = readl(info->regs + VF610_REG_ADC_CFG); 307 cfg_data = readl(info->regs + VF610_REG_ADC_CFG);
292 308
293 /* low power configuration */
294 cfg_data &= ~VF610_ADC_ADLPC_EN; 309 cfg_data &= ~VF610_ADC_ADLPC_EN;
295 if (adc_feature->lpm) 310 if (adc_feature->lpm)
296 cfg_data |= VF610_ADC_ADLPC_EN; 311 cfg_data |= VF610_ADC_ADLPC_EN;
297 312
298 /* disable high speed */
299 cfg_data &= ~VF610_ADC_ADHSC_EN; 313 cfg_data &= ~VF610_ADC_ADHSC_EN;
300 314
301 writel(cfg_data, info->regs + VF610_REG_ADC_CFG); 315 writel(cfg_data, info->regs + VF610_REG_ADC_CFG);
@@ -435,10 +449,27 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id)
435 return IRQ_HANDLED; 449 return IRQ_HANDLED;
436} 450}
437 451
438static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("1941176, 559332, 286957, 145374, 73171"); 452static ssize_t vf610_show_samp_freq_avail(struct device *dev,
453 struct device_attribute *attr, char *buf)
454{
455 struct vf610_adc *info = iio_priv(dev_to_iio_dev(dev));
456 size_t len = 0;
457 int i;
458
459 for (i = 0; i < ARRAY_SIZE(info->sample_freq_avail); i++)
460 len += scnprintf(buf + len, PAGE_SIZE - len,
461 "%u ", info->sample_freq_avail[i]);
462
463 /* replace trailing space by newline */
464 buf[len - 1] = '\n';
465
466 return len;
467}
468
469static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(vf610_show_samp_freq_avail);
439 470
440static struct attribute *vf610_attributes[] = { 471static struct attribute *vf610_attributes[] = {
441 &iio_const_attr_sampling_frequency_available.dev_attr.attr, 472 &iio_dev_attr_sampling_frequency_available.dev_attr.attr,
442 NULL 473 NULL
443}; 474};
444 475
@@ -502,7 +533,7 @@ static int vf610_read_raw(struct iio_dev *indio_dev,
502 return IIO_VAL_FRACTIONAL_LOG2; 533 return IIO_VAL_FRACTIONAL_LOG2;
503 534
504 case IIO_CHAN_INFO_SAMP_FREQ: 535 case IIO_CHAN_INFO_SAMP_FREQ:
505 *val = vf610_sample_freq_avail[info->adc_feature.sample_rate]; 536 *val = info->sample_freq_avail[info->adc_feature.sample_rate];
506 *val2 = 0; 537 *val2 = 0;
507 return IIO_VAL_INT; 538 return IIO_VAL_INT;
508 539
@@ -525,9 +556,9 @@ static int vf610_write_raw(struct iio_dev *indio_dev,
525 switch (mask) { 556 switch (mask) {
526 case IIO_CHAN_INFO_SAMP_FREQ: 557 case IIO_CHAN_INFO_SAMP_FREQ:
527 for (i = 0; 558 for (i = 0;
528 i < ARRAY_SIZE(vf610_sample_freq_avail); 559 i < ARRAY_SIZE(info->sample_freq_avail);
529 i++) 560 i++)
530 if (val == vf610_sample_freq_avail[i]) { 561 if (val == info->sample_freq_avail[i]) {
531 info->adc_feature.sample_rate = i; 562 info->adc_feature.sample_rate = i;
532 vf610_adc_sample_set(info); 563 vf610_adc_sample_set(info);
533 return 0; 564 return 0;
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
index 60451b328242..ccf3ea7e1afa 100644
--- a/drivers/iio/gyro/bmg160.c
+++ b/drivers/iio/gyro/bmg160.c
@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
822 int bit, ret, i = 0; 822 int bit, ret, i = 0;
823 823
824 mutex_lock(&data->mutex); 824 mutex_lock(&data->mutex);
825 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 825 for_each_set_bit(bit, indio_dev->active_scan_mask,
826 indio_dev->masklength) { 826 indio_dev->masklength) {
827 ret = i2c_smbus_read_word_data(data->client, 827 ret = i2c_smbus_read_word_data(data->client,
828 BMG160_AXIS_TO_REG(bit)); 828 BMG160_AXIS_TO_REG(bit));
diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index e0017c22bb9c..f53e9a803a0e 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
60 iio_trigger_set_drvdata(adis->trig, adis); 60 iio_trigger_set_drvdata(adis->trig, adis);
61 ret = iio_trigger_register(adis->trig); 61 ret = iio_trigger_register(adis->trig);
62 62
63 indio_dev->trig = adis->trig; 63 indio_dev->trig = iio_trigger_get(adis->trig);
64 if (ret) 64 if (ret)
65 goto error_free_irq; 65 goto error_free_irq;
66 66
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index d8d5bed65e07..ef76afe2643c 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -410,42 +410,46 @@ error_read_raw:
410 } 410 }
411} 411}
412 412
413static int inv_mpu6050_write_fsr(struct inv_mpu6050_state *st, int fsr) 413static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val)
414{ 414{
415 int result; 415 int result, i;
416 u8 d; 416 u8 d;
417 417
418 if (fsr < 0 || fsr > INV_MPU6050_MAX_GYRO_FS_PARAM) 418 for (i = 0; i < ARRAY_SIZE(gyro_scale_6050); ++i) {
419 return -EINVAL; 419 if (gyro_scale_6050[i] == val) {
420 if (fsr == st->chip_config.fsr) 420 d = (i << INV_MPU6050_GYRO_CONFIG_FSR_SHIFT);
421 return 0; 421 result = inv_mpu6050_write_reg(st,
422 st->reg->gyro_config, d);
423 if (result)
424 return result;
422 425
423 d = (fsr << INV_MPU6050_GYRO_CONFIG_FSR_SHIFT); 426 st->chip_config.fsr = i;
424 result = inv_mpu6050_write_reg(st, st->reg->gyro_config, d); 427 return 0;
425 if (result) 428 }
426 return result; 429 }
427 st->chip_config.fsr = fsr;
428 430
429 return 0; 431 return -EINVAL;
430} 432}
431 433
432static int inv_mpu6050_write_accel_fs(struct inv_mpu6050_state *st, int fs) 434static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val)
433{ 435{
434 int result; 436 int result, i;
435 u8 d; 437 u8 d;
436 438
437 if (fs < 0 || fs > INV_MPU6050_MAX_ACCL_FS_PARAM) 439 for (i = 0; i < ARRAY_SIZE(accel_scale); ++i) {
438 return -EINVAL; 440 if (accel_scale[i] == val) {
439 if (fs == st->chip_config.accl_fs) 441 d = (i << INV_MPU6050_ACCL_CONFIG_FSR_SHIFT);
440 return 0; 442 result = inv_mpu6050_write_reg(st,
443 st->reg->accl_config, d);
444 if (result)
445 return result;
441 446
442 d = (fs << INV_MPU6050_ACCL_CONFIG_FSR_SHIFT); 447 st->chip_config.accl_fs = i;
443 result = inv_mpu6050_write_reg(st, st->reg->accl_config, d); 448 return 0;
444 if (result) 449 }
445 return result; 450 }
446 st->chip_config.accl_fs = fs;
447 451
448 return 0; 452 return -EINVAL;
449} 453}
450 454
451static int inv_mpu6050_write_raw(struct iio_dev *indio_dev, 455static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
@@ -471,10 +475,10 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
471 case IIO_CHAN_INFO_SCALE: 475 case IIO_CHAN_INFO_SCALE:
472 switch (chan->type) { 476 switch (chan->type) {
473 case IIO_ANGL_VEL: 477 case IIO_ANGL_VEL:
474 result = inv_mpu6050_write_fsr(st, val); 478 result = inv_mpu6050_write_gyro_scale(st, val2);
475 break; 479 break;
476 case IIO_ACCEL: 480 case IIO_ACCEL:
477 result = inv_mpu6050_write_accel_fs(st, val); 481 result = inv_mpu6050_write_accel_scale(st, val2);
478 break; 482 break;
479 default: 483 default:
480 result = -EINVAL; 484 result = -EINVAL;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index 0cd306a72a6e..ba27e277511f 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -24,6 +24,16 @@
24#include <linux/poll.h> 24#include <linux/poll.h>
25#include "inv_mpu_iio.h" 25#include "inv_mpu_iio.h"
26 26
27static void inv_clear_kfifo(struct inv_mpu6050_state *st)
28{
29 unsigned long flags;
30
31 /* take the spin lock sem to avoid interrupt kick in */
32 spin_lock_irqsave(&st->time_stamp_lock, flags);
33 kfifo_reset(&st->timestamps);
34 spin_unlock_irqrestore(&st->time_stamp_lock, flags);
35}
36
27int inv_reset_fifo(struct iio_dev *indio_dev) 37int inv_reset_fifo(struct iio_dev *indio_dev)
28{ 38{
29 int result; 39 int result;
@@ -50,6 +60,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev)
50 INV_MPU6050_BIT_FIFO_RST); 60 INV_MPU6050_BIT_FIFO_RST);
51 if (result) 61 if (result)
52 goto reset_fifo_fail; 62 goto reset_fifo_fail;
63
64 /* clear timestamps fifo */
65 inv_clear_kfifo(st);
66
53 /* enable interrupt */ 67 /* enable interrupt */
54 if (st->chip_config.accl_fifo_enable || 68 if (st->chip_config.accl_fifo_enable ||
55 st->chip_config.gyro_fifo_enable) { 69 st->chip_config.gyro_fifo_enable) {
@@ -83,16 +97,6 @@ reset_fifo_fail:
83 return result; 97 return result;
84} 98}
85 99
86static void inv_clear_kfifo(struct inv_mpu6050_state *st)
87{
88 unsigned long flags;
89
90 /* take the spin lock sem to avoid interrupt kick in */
91 spin_lock_irqsave(&st->time_stamp_lock, flags);
92 kfifo_reset(&st->timestamps);
93 spin_unlock_irqrestore(&st->time_stamp_lock, flags);
94}
95
96/** 100/**
97 * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. 101 * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt.
98 */ 102 */
@@ -184,7 +188,6 @@ end_session:
184flush_fifo: 188flush_fifo:
185 /* Flush HW and SW FIFOs. */ 189 /* Flush HW and SW FIFOs. */
186 inv_reset_fifo(indio_dev); 190 inv_reset_fifo(indio_dev);
187 inv_clear_kfifo(st);
188 mutex_unlock(&indio_dev->mlock); 191 mutex_unlock(&indio_dev->mlock);
189 iio_trigger_notify_done(indio_dev->trig); 192 iio_trigger_notify_done(indio_dev->trig);
190 193
diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index 5cc3692acf37..b3a36376c719 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -1227,7 +1227,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p)
1227 base = KMX61_MAG_XOUT_L; 1227 base = KMX61_MAG_XOUT_L;
1228 1228
1229 mutex_lock(&data->lock); 1229 mutex_lock(&data->lock);
1230 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 1230 for_each_set_bit(bit, indio_dev->active_scan_mask,
1231 indio_dev->masklength) { 1231 indio_dev->masklength) {
1232 ret = kmx61_read_measurement(data, base, bit); 1232 ret = kmx61_read_measurement(data, base, bit);
1233 if (ret < 0) { 1233 if (ret < 0) {
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index aaba9d3d980e..4df97f650e44 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -847,8 +847,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
847 * @attr_list: List of IIO device attributes 847 * @attr_list: List of IIO device attributes
848 * 848 *
849 * This function frees the memory allocated for each of the IIO device 849 * This function frees the memory allocated for each of the IIO device
850 * attributes in the list. Note: if you want to reuse the list after calling 850 * attributes in the list.
851 * this function you have to reinitialize it using INIT_LIST_HEAD().
852 */ 851 */
853void iio_free_chan_devattr_list(struct list_head *attr_list) 852void iio_free_chan_devattr_list(struct list_head *attr_list)
854{ 853{
@@ -856,6 +855,7 @@ void iio_free_chan_devattr_list(struct list_head *attr_list)
856 855
857 list_for_each_entry_safe(p, n, attr_list, l) { 856 list_for_each_entry_safe(p, n, attr_list, l) {
858 kfree(p->dev_attr.attr.name); 857 kfree(p->dev_attr.attr.name);
858 list_del(&p->l);
859 kfree(p); 859 kfree(p);
860 } 860 }
861} 861}
@@ -936,6 +936,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
936 936
937 iio_free_chan_devattr_list(&indio_dev->channel_attr_list); 937 iio_free_chan_devattr_list(&indio_dev->channel_attr_list);
938 kfree(indio_dev->chan_attr_group.attrs); 938 kfree(indio_dev->chan_attr_group.attrs);
939 indio_dev->chan_attr_group.attrs = NULL;
939} 940}
940 941
941static void iio_dev_release(struct device *device) 942static void iio_dev_release(struct device *device)
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index a4b397048f71..a99692ba91bc 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -500,6 +500,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
500error_free_setup_event_lines: 500error_free_setup_event_lines:
501 iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); 501 iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list);
502 kfree(indio_dev->event_interface); 502 kfree(indio_dev->event_interface);
503 indio_dev->event_interface = NULL;
503 return ret; 504 return ret;
504} 505}
505 506
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 74dff4e4a11a..89fca3a70750 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)
494 494
495 mutex_lock(&data->mutex); 495 mutex_lock(&data->mutex);
496 496
497 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 497 for_each_set_bit(bit, indio_dev->active_scan_mask,
498 indio_dev->masklength) { 498 indio_dev->masklength) {
499 ret = sx9500_read_proximity(data, &indio_dev->channels[bit], 499 ret = sx9500_read_proximity(data, &indio_dev->channels[bit],
500 &val); 500 &val);
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index aec7a6aa2951..8c014b5dab4c 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -99,6 +99,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
99 if (dmasync) 99 if (dmasync)
100 dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs); 100 dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
101 101
102 /*
103 * If the combination of the addr and size requested for this memory
104 * region causes an integer overflow, return error.
105 */
106 if ((PAGE_ALIGN(addr + size) <= size) ||
107 (PAGE_ALIGN(addr + size) <= addr))
108 return ERR_PTR(-EINVAL);
109
102 if (!can_do_mlock()) 110 if (!can_do_mlock())
103 return ERR_PTR(-EPERM); 111 return ERR_PTR(-EPERM);
104 112
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 1bd15ebc01f2..27bcdbc950c9 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1154,10 +1154,28 @@ out:
1154 mutex_unlock(&alps_mutex); 1154 mutex_unlock(&alps_mutex);
1155} 1155}
1156 1156
1157static void alps_report_bare_ps2_packet(struct input_dev *dev, 1157static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
1158 unsigned char packet[], 1158 unsigned char packet[],
1159 bool report_buttons) 1159 bool report_buttons)
1160{ 1160{
1161 struct alps_data *priv = psmouse->private;
1162 struct input_dev *dev;
1163
1164 /* Figure out which device to use to report the bare packet */
1165 if (priv->proto_version == ALPS_PROTO_V2 &&
1166 (priv->flags & ALPS_DUALPOINT)) {
1167 /* On V2 devices the DualPoint Stick reports bare packets */
1168 dev = priv->dev2;
1169 } else if (unlikely(IS_ERR_OR_NULL(priv->dev3))) {
1170 /* Register dev3 mouse if we received PS/2 packet first time */
1171 if (!IS_ERR(priv->dev3))
1172 psmouse_queue_work(psmouse, &priv->dev3_register_work,
1173 0);
1174 return;
1175 } else {
1176 dev = priv->dev3;
1177 }
1178
1161 if (report_buttons) 1179 if (report_buttons)
1162 alps_report_buttons(dev, NULL, 1180 alps_report_buttons(dev, NULL,
1163 packet[0] & 1, packet[0] & 2, packet[0] & 4); 1181 packet[0] & 1, packet[0] & 2, packet[0] & 4);
@@ -1232,8 +1250,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
1232 * de-synchronization. 1250 * de-synchronization.
1233 */ 1251 */
1234 1252
1235 alps_report_bare_ps2_packet(priv->dev2, 1253 alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
1236 &psmouse->packet[3], false); 1254 false);
1237 1255
1238 /* 1256 /*
1239 * Continue with the standard ALPS protocol handling, 1257 * Continue with the standard ALPS protocol handling,
@@ -1289,18 +1307,9 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
1289 * properly we only do this if the device is fully synchronized. 1307 * properly we only do this if the device is fully synchronized.
1290 */ 1308 */
1291 if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { 1309 if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) {
1292
1293 /* Register dev3 mouse if we received PS/2 packet first time */
1294 if (unlikely(!priv->dev3))
1295 psmouse_queue_work(psmouse,
1296 &priv->dev3_register_work, 0);
1297
1298 if (psmouse->pktcnt == 3) { 1310 if (psmouse->pktcnt == 3) {
1299 /* Once dev3 mouse device is registered report data */ 1311 alps_report_bare_ps2_packet(psmouse, psmouse->packet,
1300 if (likely(!IS_ERR_OR_NULL(priv->dev3))) 1312 true);
1301 alps_report_bare_ps2_packet(priv->dev3,
1302 psmouse->packet,
1303 true);
1304 return PSMOUSE_FULL_PACKET; 1313 return PSMOUSE_FULL_PACKET;
1305 } 1314 }
1306 return PSMOUSE_GOOD_DATA; 1315 return PSMOUSE_GOOD_DATA;
@@ -2281,10 +2290,12 @@ static int alps_set_protocol(struct psmouse *psmouse,
2281 priv->set_abs_params = alps_set_abs_params_mt; 2290 priv->set_abs_params = alps_set_abs_params_mt;
2282 priv->nibble_commands = alps_v3_nibble_commands; 2291 priv->nibble_commands = alps_v3_nibble_commands;
2283 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2292 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
2284 priv->x_max = 1360;
2285 priv->y_max = 660;
2286 priv->x_bits = 23; 2293 priv->x_bits = 23;
2287 priv->y_bits = 12; 2294 priv->y_bits = 12;
2295
2296 if (alps_dolphin_get_device_area(psmouse, priv))
2297 return -EIO;
2298
2288 break; 2299 break;
2289 2300
2290 case ALPS_PROTO_V6: 2301 case ALPS_PROTO_V6:
@@ -2303,9 +2314,8 @@ static int alps_set_protocol(struct psmouse *psmouse,
2303 priv->set_abs_params = alps_set_abs_params_mt; 2314 priv->set_abs_params = alps_set_abs_params_mt;
2304 priv->nibble_commands = alps_v3_nibble_commands; 2315 priv->nibble_commands = alps_v3_nibble_commands;
2305 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2316 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
2306 2317 priv->x_max = 0xfff;
2307 if (alps_dolphin_get_device_area(psmouse, priv)) 2318 priv->y_max = 0x7ff;
2308 return -EIO;
2309 2319
2310 if (priv->fw_ver[1] != 0xba) 2320 if (priv->fw_ver[1] != 0xba)
2311 priv->flags |= ALPS_BUTTONPAD; 2321 priv->flags |= ALPS_BUTTONPAD;
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index dda605836546..3b06c8a360b6 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -154,6 +154,11 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
154 }, 154 },
155 { 155 {
156 (const char * const []){"LEN2006", NULL}, 156 (const char * const []){"LEN2006", NULL},
157 {2691, 2691},
158 1024, 5045, 2457, 4832
159 },
160 {
161 (const char * const []){"LEN2006", NULL},
157 {ANY_BOARD_ID, ANY_BOARD_ID}, 162 {ANY_BOARD_ID, ANY_BOARD_ID},
158 1264, 5675, 1171, 4688 163 1264, 5675, 1171, 4688
159 }, 164 },
@@ -189,7 +194,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
189 "LEN2003", 194 "LEN2003",
190 "LEN2004", /* L440 */ 195 "LEN2004", /* L440 */
191 "LEN2005", 196 "LEN2005",
192 "LEN2006", 197 "LEN2006", /* Edge E440/E540 */
193 "LEN2007", 198 "LEN2007",
194 "LEN2008", 199 "LEN2008",
195 "LEN2009", 200 "LEN2009",
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 596b0a9eee99..9687f8afebff 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -169,7 +169,7 @@ static void its_encode_cmd(struct its_cmd_block *cmd, u8 cmd_nr)
169 169
170static void its_encode_devid(struct its_cmd_block *cmd, u32 devid) 170static void its_encode_devid(struct its_cmd_block *cmd, u32 devid)
171{ 171{
172 cmd->raw_cmd[0] &= ~(0xffffUL << 32); 172 cmd->raw_cmd[0] &= BIT_ULL(32) - 1;
173 cmd->raw_cmd[0] |= ((u64)devid) << 32; 173 cmd->raw_cmd[0] |= ((u64)devid) << 32;
174} 174}
175 175
@@ -802,6 +802,7 @@ static int its_alloc_tables(struct its_node *its)
802 int i; 802 int i;
803 int psz = SZ_64K; 803 int psz = SZ_64K;
804 u64 shr = GITS_BASER_InnerShareable; 804 u64 shr = GITS_BASER_InnerShareable;
805 u64 cache = GITS_BASER_WaWb;
805 806
806 for (i = 0; i < GITS_BASER_NR_REGS; i++) { 807 for (i = 0; i < GITS_BASER_NR_REGS; i++) {
807 u64 val = readq_relaxed(its->base + GITS_BASER + i * 8); 808 u64 val = readq_relaxed(its->base + GITS_BASER + i * 8);
@@ -848,7 +849,7 @@ retry_baser:
848 val = (virt_to_phys(base) | 849 val = (virt_to_phys(base) |
849 (type << GITS_BASER_TYPE_SHIFT) | 850 (type << GITS_BASER_TYPE_SHIFT) |
850 ((entry_size - 1) << GITS_BASER_ENTRY_SIZE_SHIFT) | 851 ((entry_size - 1) << GITS_BASER_ENTRY_SIZE_SHIFT) |
851 GITS_BASER_WaWb | 852 cache |
852 shr | 853 shr |
853 GITS_BASER_VALID); 854 GITS_BASER_VALID);
854 855
@@ -874,9 +875,12 @@ retry_baser:
874 * Shareability didn't stick. Just use 875 * Shareability didn't stick. Just use
875 * whatever the read reported, which is likely 876 * whatever the read reported, which is likely
876 * to be the only thing this redistributor 877 * to be the only thing this redistributor
877 * supports. 878 * supports. If that's zero, make it
879 * non-cacheable as well.
878 */ 880 */
879 shr = tmp & GITS_BASER_SHAREABILITY_MASK; 881 shr = tmp & GITS_BASER_SHAREABILITY_MASK;
882 if (!shr)
883 cache = GITS_BASER_nC;
880 goto retry_baser; 884 goto retry_baser;
881 } 885 }
882 886
@@ -980,16 +984,39 @@ static void its_cpu_init_lpis(void)
980 tmp = readq_relaxed(rbase + GICR_PROPBASER); 984 tmp = readq_relaxed(rbase + GICR_PROPBASER);
981 985
982 if ((tmp ^ val) & GICR_PROPBASER_SHAREABILITY_MASK) { 986 if ((tmp ^ val) & GICR_PROPBASER_SHAREABILITY_MASK) {
987 if (!(tmp & GICR_PROPBASER_SHAREABILITY_MASK)) {
988 /*
989 * The HW reports non-shareable, we must
990 * remove the cacheability attributes as
991 * well.
992 */
993 val &= ~(GICR_PROPBASER_SHAREABILITY_MASK |
994 GICR_PROPBASER_CACHEABILITY_MASK);
995 val |= GICR_PROPBASER_nC;
996 writeq_relaxed(val, rbase + GICR_PROPBASER);
997 }
983 pr_info_once("GIC: using cache flushing for LPI property table\n"); 998 pr_info_once("GIC: using cache flushing for LPI property table\n");
984 gic_rdists->flags |= RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING; 999 gic_rdists->flags |= RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING;
985 } 1000 }
986 1001
987 /* set PENDBASE */ 1002 /* set PENDBASE */
988 val = (page_to_phys(pend_page) | 1003 val = (page_to_phys(pend_page) |
989 GICR_PROPBASER_InnerShareable | 1004 GICR_PENDBASER_InnerShareable |
990 GICR_PROPBASER_WaWb); 1005 GICR_PENDBASER_WaWb);
991 1006
992 writeq_relaxed(val, rbase + GICR_PENDBASER); 1007 writeq_relaxed(val, rbase + GICR_PENDBASER);
1008 tmp = readq_relaxed(rbase + GICR_PENDBASER);
1009
1010 if (!(tmp & GICR_PENDBASER_SHAREABILITY_MASK)) {
1011 /*
1012 * The HW reports non-shareable, we must remove the
1013 * cacheability attributes as well.
1014 */
1015 val &= ~(GICR_PENDBASER_SHAREABILITY_MASK |
1016 GICR_PENDBASER_CACHEABILITY_MASK);
1017 val |= GICR_PENDBASER_nC;
1018 writeq_relaxed(val, rbase + GICR_PENDBASER);
1019 }
993 1020
994 /* Enable LPIs */ 1021 /* Enable LPIs */
995 val = readl_relaxed(rbase + GICR_CTLR); 1022 val = readl_relaxed(rbase + GICR_CTLR);
@@ -1026,7 +1053,7 @@ static void its_cpu_init_collection(void)
1026 * This ITS wants a linear CPU number. 1053 * This ITS wants a linear CPU number.
1027 */ 1054 */
1028 target = readq_relaxed(gic_data_rdist_rd_base() + GICR_TYPER); 1055 target = readq_relaxed(gic_data_rdist_rd_base() + GICR_TYPER);
1029 target = GICR_TYPER_CPU_NUMBER(target); 1056 target = GICR_TYPER_CPU_NUMBER(target) << 16;
1030 } 1057 }
1031 1058
1032 /* Perform collection mapping */ 1059 /* Perform collection mapping */
@@ -1422,14 +1449,26 @@ static int its_probe(struct device_node *node, struct irq_domain *parent)
1422 1449
1423 writeq_relaxed(baser, its->base + GITS_CBASER); 1450 writeq_relaxed(baser, its->base + GITS_CBASER);
1424 tmp = readq_relaxed(its->base + GITS_CBASER); 1451 tmp = readq_relaxed(its->base + GITS_CBASER);
1425 writeq_relaxed(0, its->base + GITS_CWRITER);
1426 writel_relaxed(GITS_CTLR_ENABLE, its->base + GITS_CTLR);
1427 1452
1428 if ((tmp ^ baser) & GITS_BASER_SHAREABILITY_MASK) { 1453 if ((tmp ^ baser) & GITS_CBASER_SHAREABILITY_MASK) {
1454 if (!(tmp & GITS_CBASER_SHAREABILITY_MASK)) {
1455 /*
1456 * The HW reports non-shareable, we must
1457 * remove the cacheability attributes as
1458 * well.
1459 */
1460 baser &= ~(GITS_CBASER_SHAREABILITY_MASK |
1461 GITS_CBASER_CACHEABILITY_MASK);
1462 baser |= GITS_CBASER_nC;
1463 writeq_relaxed(baser, its->base + GITS_CBASER);
1464 }
1429 pr_info("ITS: using cache flushing for cmd queue\n"); 1465 pr_info("ITS: using cache flushing for cmd queue\n");
1430 its->flags |= ITS_FLAGS_CMDQ_NEEDS_FLUSHING; 1466 its->flags |= ITS_FLAGS_CMDQ_NEEDS_FLUSHING;
1431 } 1467 }
1432 1468
1469 writeq_relaxed(0, its->base + GITS_CWRITER);
1470 writel_relaxed(GITS_CTLR_ENABLE, its->base + GITS_CTLR);
1471
1433 if (of_property_read_bool(its->msi_chip.of_node, "msi-controller")) { 1472 if (of_property_read_bool(its->msi_chip.of_node, "msi-controller")) {
1434 its->domain = irq_domain_add_tree(NULL, &its_domain_ops, its); 1473 its->domain = irq_domain_add_tree(NULL, &its_domain_ops, its);
1435 if (!its->domain) { 1474 if (!its->domain) {
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index a7a9271f64b1..ce5f7f9cff06 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2729,16 +2729,11 @@ static int mvneta_stop(struct net_device *dev)
2729static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2729static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2730{ 2730{
2731 struct mvneta_port *pp = netdev_priv(dev); 2731 struct mvneta_port *pp = netdev_priv(dev);
2732 int ret;
2733 2732
2734 if (!pp->phy_dev) 2733 if (!pp->phy_dev)
2735 return -ENOTSUPP; 2734 return -ENOTSUPP;
2736 2735
2737 ret = phy_mii_ioctl(pp->phy_dev, ifr, cmd); 2736 return phy_mii_ioctl(pp->phy_dev, ifr, cmd);
2738 if (!ret)
2739 mvneta_adjust_link(dev);
2740
2741 return ret;
2742} 2737}
2743 2738
2744/* Ethtool methods */ 2739/* Ethtool methods */
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 06993ea9e6ba..f0fbb4ade85d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -725,7 +725,8 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
725 * on the host, we deprecate the error message for this 725 * on the host, we deprecate the error message for this
726 * specific command/input_mod/opcode_mod/fw-status to be debug. 726 * specific command/input_mod/opcode_mod/fw-status to be debug.
727 */ 727 */
728 if (op == MLX4_CMD_SET_PORT && in_modifier == 1 && 728 if (op == MLX4_CMD_SET_PORT &&
729 (in_modifier == 1 || in_modifier == 2) &&
729 op_modifier == MLX4_SET_PORT_IB_OPCODE && 730 op_modifier == MLX4_SET_PORT_IB_OPCODE &&
730 context->fw_status == CMD_STAT_BAD_SIZE) 731 context->fw_status == CMD_STAT_BAD_SIZE)
731 mlx4_dbg(dev, "command 0x%x failed: fw status = 0x%x\n", 732 mlx4_dbg(dev, "command 0x%x failed: fw status = 0x%x\n",
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e9b960f0ff32..720aaf6313d2 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1008,8 +1008,7 @@ err:
1008 1008
1009static int xennet_change_mtu(struct net_device *dev, int mtu) 1009static int xennet_change_mtu(struct net_device *dev, int mtu)
1010{ 1010{
1011 int max = xennet_can_sg(dev) ? 1011 int max = xennet_can_sg(dev) ? XEN_NETIF_MAX_TX_SIZE : ETH_DATA_LEN;
1012 XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER : ETH_DATA_LEN;
1013 1012
1014 if (mtu > max) 1013 if (mtu > max)
1015 return -EINVAL; 1014 return -EINVAL;
@@ -1279,8 +1278,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1279 netdev->ethtool_ops = &xennet_ethtool_ops; 1278 netdev->ethtool_ops = &xennet_ethtool_ops;
1280 SET_NETDEV_DEV(netdev, &dev->dev); 1279 SET_NETDEV_DEV(netdev, &dev->dev);
1281 1280
1282 netif_set_gso_max_size(netdev, XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER);
1283
1284 np->netdev = netdev; 1281 np->netdev = netdev;
1285 1282
1286 netif_carrier_off(netdev); 1283 netif_carrier_off(netdev);
diff --git a/drivers/of/address.c b/drivers/of/address.c
index ad2906919d45..78a7dcbec7d8 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -450,12 +450,17 @@ static struct of_bus *of_match_bus(struct device_node *np)
450 return NULL; 450 return NULL;
451} 451}
452 452
453static int of_empty_ranges_quirk(void) 453static int of_empty_ranges_quirk(struct device_node *np)
454{ 454{
455 if (IS_ENABLED(CONFIG_PPC)) { 455 if (IS_ENABLED(CONFIG_PPC)) {
456 /* To save cycles, we cache the result */ 456 /* To save cycles, we cache the result for global "Mac" setting */
457 static int quirk_state = -1; 457 static int quirk_state = -1;
458 458
459 /* PA-SEMI sdc DT bug */
460 if (of_device_is_compatible(np, "1682m-sdc"))
461 return true;
462
463 /* Make quirk cached */
459 if (quirk_state < 0) 464 if (quirk_state < 0)
460 quirk_state = 465 quirk_state =
461 of_machine_is_compatible("Power Macintosh") || 466 of_machine_is_compatible("Power Macintosh") ||
@@ -490,7 +495,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
490 * This code is only enabled on powerpc. --gcl 495 * This code is only enabled on powerpc. --gcl
491 */ 496 */
492 ranges = of_get_property(parent, rprop, &rlen); 497 ranges = of_get_property(parent, rprop, &rlen);
493 if (ranges == NULL && !of_empty_ranges_quirk()) { 498 if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
494 pr_debug("OF: no ranges; cannot translate\n"); 499 pr_debug("OF: no ranges; cannot translate\n");
495 return 1; 500 return 1;
496 } 501 }
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig
index 24183028bd71..6d5b38d69578 100644
--- a/drivers/staging/iio/Kconfig
+++ b/drivers/staging/iio/Kconfig
@@ -38,6 +38,7 @@ config IIO_SIMPLE_DUMMY_EVENTS
38config IIO_SIMPLE_DUMMY_BUFFER 38config IIO_SIMPLE_DUMMY_BUFFER
39 bool "Buffered capture support" 39 bool "Buffered capture support"
40 select IIO_BUFFER 40 select IIO_BUFFER
41 select IIO_TRIGGER
41 select IIO_KFIFO_BUF 42 select IIO_KFIFO_BUF
42 help 43 help
43 Add buffered data capture to the simple dummy driver. 44 Add buffered data capture to the simple dummy driver.
diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c
index fd171d8b38fb..90cc18b703cf 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -592,6 +592,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
592 mutex_init(&data->lock); 592 mutex_init(&data->lock);
593 593
594 indio_dev->dev.parent = dev; 594 indio_dev->dev.parent = dev;
595 indio_dev->name = dev->driver->name;
595 indio_dev->info = &hmc5843_info; 596 indio_dev->info = &hmc5843_info;
596 indio_dev->modes = INDIO_DIRECT_MODE; 597 indio_dev->modes = INDIO_DIRECT_MODE;
597 indio_dev->channels = data->variant->channels; 598 indio_dev->channels = data->variant->channels;
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index b1893f3f88f1..3ad1458bfeb0 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -921,6 +921,9 @@ static void lpuart_setup_watermark(struct lpuart_port *sport)
921 writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE, 921 writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE,
922 sport->port.membase + UARTPFIFO); 922 sport->port.membase + UARTPFIFO);
923 923
924 /* explicitly clear RDRF */
925 readb(sport->port.membase + UARTSR1);
926
924 /* flush Tx and Rx FIFO */ 927 /* flush Tx and Rx FIFO */
925 writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH, 928 writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH,
926 sport->port.membase + UARTCFIFO); 929 sport->port.membase + UARTCFIFO);
@@ -1076,6 +1079,8 @@ static int lpuart_startup(struct uart_port *port)
1076 sport->txfifo_size = 0x1 << (((temp >> UARTPFIFO_TXSIZE_OFF) & 1079 sport->txfifo_size = 0x1 << (((temp >> UARTPFIFO_TXSIZE_OFF) &
1077 UARTPFIFO_FIFOSIZE_MASK) + 1); 1080 UARTPFIFO_FIFOSIZE_MASK) + 1);
1078 1081
1082 sport->port.fifosize = sport->txfifo_size;
1083
1079 sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) & 1084 sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) &
1080 UARTPFIFO_FIFOSIZE_MASK) + 1); 1085 UARTPFIFO_FIFOSIZE_MASK) + 1);
1081 1086
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index af821a908720..cf08876922f1 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -963,6 +963,7 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
963 free_irq(ourport->tx_irq, ourport); 963 free_irq(ourport->tx_irq, ourport);
964 tx_enabled(port) = 0; 964 tx_enabled(port) = 0;
965 ourport->tx_claimed = 0; 965 ourport->tx_claimed = 0;
966 ourport->tx_mode = 0;
966 } 967 }
967 968
968 if (ourport->rx_claimed) { 969 if (ourport->rx_claimed) {
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a7865c4b0498..0827d7c96527 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -387,6 +387,10 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue,
387 status = PORT_PLC; 387 status = PORT_PLC;
388 port_change_bit = "link state"; 388 port_change_bit = "link state";
389 break; 389 break;
390 case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
391 status = PORT_CEC;
392 port_change_bit = "config error";
393 break;
390 default: 394 default:
391 /* Should never happen */ 395 /* Should never happen */
392 return; 396 return;
@@ -588,6 +592,8 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
588 status |= USB_PORT_STAT_C_LINK_STATE << 16; 592 status |= USB_PORT_STAT_C_LINK_STATE << 16;
589 if ((raw_port_status & PORT_WRC)) 593 if ((raw_port_status & PORT_WRC))
590 status |= USB_PORT_STAT_C_BH_RESET << 16; 594 status |= USB_PORT_STAT_C_BH_RESET << 16;
595 if ((raw_port_status & PORT_CEC))
596 status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
591 } 597 }
592 598
593 if (hcd->speed != HCD_USB3) { 599 if (hcd->speed != HCD_USB3) {
@@ -1005,6 +1011,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1005 case USB_PORT_FEAT_C_OVER_CURRENT: 1011 case USB_PORT_FEAT_C_OVER_CURRENT:
1006 case USB_PORT_FEAT_C_ENABLE: 1012 case USB_PORT_FEAT_C_ENABLE:
1007 case USB_PORT_FEAT_C_PORT_LINK_STATE: 1013 case USB_PORT_FEAT_C_PORT_LINK_STATE:
1014 case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
1008 xhci_clear_port_change_bit(xhci, wValue, wIndex, 1015 xhci_clear_port_change_bit(xhci, wValue, wIndex,
1009 port_array[wIndex], temp); 1016 port_array[wIndex], temp);
1010 break; 1017 break;
@@ -1069,7 +1076,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
1069 */ 1076 */
1070 status = bus_state->resuming_ports; 1077 status = bus_state->resuming_ports;
1071 1078
1072 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC; 1079 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
1073 1080
1074 spin_lock_irqsave(&xhci->lock, flags); 1081 spin_lock_irqsave(&xhci->lock, flags);
1075 /* For each port, did anything change? If so, set that bit in buf. */ 1082 /* For each port, did anything change? If so, set that bit in buf. */
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fd53c9ebd662..2af32e26fafc 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -115,6 +115,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
115 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { 115 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
116 xhci->quirks |= XHCI_LPM_SUPPORT; 116 xhci->quirks |= XHCI_LPM_SUPPORT;
117 xhci->quirks |= XHCI_INTEL_HOST; 117 xhci->quirks |= XHCI_INTEL_HOST;
118 xhci->quirks |= XHCI_AVOID_BEI;
118 } 119 }
119 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 120 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
120 pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { 121 pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
@@ -130,7 +131,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
130 * PPT chipsets. 131 * PPT chipsets.
131 */ 132 */
132 xhci->quirks |= XHCI_SPURIOUS_REBOOT; 133 xhci->quirks |= XHCI_SPURIOUS_REBOOT;
133 xhci->quirks |= XHCI_AVOID_BEI;
134 } 134 }
135 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 135 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
136 pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { 136 pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c
index f32c292cc868..3fc4fe770253 100644
--- a/drivers/usb/isp1760/isp1760-udc.c
+++ b/drivers/usb/isp1760/isp1760-udc.c
@@ -1203,7 +1203,7 @@ static int isp1760_udc_start(struct usb_gadget *gadget,
1203 1203
1204 if (udc->driver) { 1204 if (udc->driver) {
1205 dev_err(udc->isp->dev, "UDC already has a gadget driver\n"); 1205 dev_err(udc->isp->dev, "UDC already has a gadget driver\n");
1206 spin_unlock(&udc->lock); 1206 spin_unlock_irqrestore(&udc->lock, flags);
1207 return -EBUSY; 1207 return -EBUSY;
1208 } 1208 }
1209 1209
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 3086dec0ef53..8eb68a31cab6 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -604,6 +604,7 @@ static const struct usb_device_id id_table_combined[] = {
604 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 604 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
605 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), 605 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
606 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 606 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
607 { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
607 /* 608 /*
608 * ELV devices: 609 * ELV devices:
609 */ 610 */
@@ -1883,8 +1884,12 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
1883{ 1884{
1884 struct usb_device *udev = serial->dev; 1885 struct usb_device *udev = serial->dev;
1885 1886
1886 if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) || 1887 if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems"))
1887 (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2"))) 1888 return ftdi_jtag_probe(serial);
1889
1890 if (udev->product &&
1891 (!strcmp(udev->product, "BeagleBone/XDS100V2") ||
1892 !strcmp(udev->product, "SNAP Connect E10")))
1888 return ftdi_jtag_probe(serial); 1893 return ftdi_jtag_probe(serial);
1889 1894
1890 return 0; 1895 return 0;
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 56b1b55c4751..4e4f46f3c89c 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -561,6 +561,12 @@
561 */ 561 */
562#define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ 562#define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */
563 563
564/*
565 * Synapse Wireless product ids (FTDI_VID)
566 * http://www.synapse-wireless.com
567 */
568#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
569
564 570
565/********************************/ 571/********************************/
566/** third-party VID/PID combos **/ 572/** third-party VID/PID combos **/
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index dd97d8b572c3..4f7e072e4e00 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -61,6 +61,7 @@ struct keyspan_pda_private {
61/* For Xircom PGSDB9 and older Entrega version of the same device */ 61/* For Xircom PGSDB9 and older Entrega version of the same device */
62#define XIRCOM_VENDOR_ID 0x085a 62#define XIRCOM_VENDOR_ID 0x085a
63#define XIRCOM_FAKE_ID 0x8027 63#define XIRCOM_FAKE_ID 0x8027
64#define XIRCOM_FAKE_ID_2 0x8025 /* "PGMFHUB" serial */
64#define ENTREGA_VENDOR_ID 0x1645 65#define ENTREGA_VENDOR_ID 0x1645
65#define ENTREGA_FAKE_ID 0x8093 66#define ENTREGA_FAKE_ID 0x8093
66 67
@@ -70,6 +71,7 @@ static const struct usb_device_id id_table_combined[] = {
70#endif 71#endif
71#ifdef XIRCOM 72#ifdef XIRCOM
72 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) }, 73 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
74 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
73 { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) }, 75 { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
74#endif 76#endif
75 { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) }, 77 { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
@@ -93,6 +95,7 @@ static const struct usb_device_id id_table_fake[] = {
93#ifdef XIRCOM 95#ifdef XIRCOM
94static const struct usb_device_id id_table_fake_xircom[] = { 96static const struct usb_device_id id_table_fake_xircom[] = {
95 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) }, 97 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
98 { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
96 { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) }, 99 { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
97 { } 100 { }
98}; 101};
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462083fc..94d96809e686 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -55,6 +55,23 @@ config XEN_BALLOON_MEMORY_HOTPLUG
55 55
56 In that case step 3 should be omitted. 56 In that case step 3 should be omitted.
57 57
58config XEN_BALLOON_MEMORY_HOTPLUG_LIMIT
59 int "Hotplugged memory limit (in GiB) for a PV guest"
60 default 512 if X86_64
61 default 4 if X86_32
62 range 0 64 if X86_32
63 depends on XEN_HAVE_PVMMU
64 depends on XEN_BALLOON_MEMORY_HOTPLUG
65 help
66 Maxmium amount of memory (in GiB) that a PV guest can be
67 expanded to when using memory hotplug.
68
69 A PV guest can have more memory than this limit if is
70 started with a larger maximum.
71
72 This value is used to allocate enough space in internal
73 tables needed for physical memory administration.
74
58config XEN_SCRUB_PAGES 75config XEN_SCRUB_PAGES
59 bool "Scrub pages before returning them to system" 76 bool "Scrub pages before returning them to system"
60 depends on XEN_BALLOON 77 depends on XEN_BALLOON
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 0b52d92cb2e5..fd933695f232 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -229,6 +229,29 @@ static enum bp_state reserve_additional_memory(long credit)
229 balloon_hotplug = round_up(balloon_hotplug, PAGES_PER_SECTION); 229 balloon_hotplug = round_up(balloon_hotplug, PAGES_PER_SECTION);
230 nid = memory_add_physaddr_to_nid(hotplug_start_paddr); 230 nid = memory_add_physaddr_to_nid(hotplug_start_paddr);
231 231
232#ifdef CONFIG_XEN_HAVE_PVMMU
233 /*
234 * add_memory() will build page tables for the new memory so
235 * the p2m must contain invalid entries so the correct
236 * non-present PTEs will be written.
237 *
238 * If a failure occurs, the original (identity) p2m entries
239 * are not restored since this region is now known not to
240 * conflict with any devices.
241 */
242 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
243 unsigned long pfn, i;
244
245 pfn = PFN_DOWN(hotplug_start_paddr);
246 for (i = 0; i < balloon_hotplug; i++) {
247 if (!set_phys_to_machine(pfn + i, INVALID_P2M_ENTRY)) {
248 pr_warn("set_phys_to_machine() failed, no memory added\n");
249 return BP_ECANCELED;
250 }
251 }
252 }
253#endif
254
232 rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); 255 rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT);
233 256
234 if (rc) { 257 if (rc) {
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 4ac7445e6ec7..aa0dc2573374 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -1,6 +1,9 @@
1/* 1/*
2 * fs/cifs/cifsencrypt.c 2 * fs/cifs/cifsencrypt.c
3 * 3 *
4 * Encryption and hashing operations relating to NTLM, NTLMv2. See MS-NLMP
5 * for more detailed information
6 *
4 * Copyright (C) International Business Machines Corp., 2005,2013 7 * Copyright (C) International Business Machines Corp., 2005,2013
5 * Author(s): Steve French (sfrench@us.ibm.com) 8 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 9 *
@@ -515,7 +518,8 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
515 __func__); 518 __func__);
516 return rc; 519 return rc;
517 } 520 }
518 } else if (ses->serverName) { 521 } else {
522 /* We use ses->serverName if no domain name available */
519 len = strlen(ses->serverName); 523 len = strlen(ses->serverName);
520 524
521 server = kmalloc(2 + (len * 2), GFP_KERNEL); 525 server = kmalloc(2 + (len * 2), GFP_KERNEL);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d3aa999ab785..480cf9c81d50 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1599,6 +1599,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1599 pr_warn("CIFS: username too long\n"); 1599 pr_warn("CIFS: username too long\n");
1600 goto cifs_parse_mount_err; 1600 goto cifs_parse_mount_err;
1601 } 1601 }
1602
1603 kfree(vol->username);
1602 vol->username = kstrdup(string, GFP_KERNEL); 1604 vol->username = kstrdup(string, GFP_KERNEL);
1603 if (!vol->username) 1605 if (!vol->username)
1604 goto cifs_parse_mount_err; 1606 goto cifs_parse_mount_err;
@@ -1700,6 +1702,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1700 goto cifs_parse_mount_err; 1702 goto cifs_parse_mount_err;
1701 } 1703 }
1702 1704
1705 kfree(vol->domainname);
1703 vol->domainname = kstrdup(string, GFP_KERNEL); 1706 vol->domainname = kstrdup(string, GFP_KERNEL);
1704 if (!vol->domainname) { 1707 if (!vol->domainname) {
1705 pr_warn("CIFS: no memory for domainname\n"); 1708 pr_warn("CIFS: no memory for domainname\n");
@@ -1731,6 +1734,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1731 } 1734 }
1732 1735
1733 if (strncasecmp(string, "default", 7) != 0) { 1736 if (strncasecmp(string, "default", 7) != 0) {
1737 kfree(vol->iocharset);
1734 vol->iocharset = kstrdup(string, 1738 vol->iocharset = kstrdup(string,
1735 GFP_KERNEL); 1739 GFP_KERNEL);
1736 if (!vol->iocharset) { 1740 if (!vol->iocharset) {
@@ -2913,8 +2917,7 @@ ip_rfc1001_connect(struct TCP_Server_Info *server)
2913 * calling name ends in null (byte 16) from old smb 2917 * calling name ends in null (byte 16) from old smb
2914 * convention. 2918 * convention.
2915 */ 2919 */
2916 if (server->workstation_RFC1001_name && 2920 if (server->workstation_RFC1001_name[0] != 0)
2917 server->workstation_RFC1001_name[0] != 0)
2918 rfc1002mangle(ses_init_buf->trailer. 2921 rfc1002mangle(ses_init_buf->trailer.
2919 session_req.calling_name, 2922 session_req.calling_name,
2920 server->workstation_RFC1001_name, 2923 server->workstation_RFC1001_name,
@@ -3692,6 +3695,12 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
3692#endif /* CIFS_WEAK_PW_HASH */ 3695#endif /* CIFS_WEAK_PW_HASH */
3693 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey, 3696 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey,
3694 bcc_ptr, nls_codepage); 3697 bcc_ptr, nls_codepage);
3698 if (rc) {
3699 cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n",
3700 __func__, rc);
3701 cifs_buf_release(smb_buffer);
3702 return rc;
3703 }
3695 3704
3696 bcc_ptr += CIFS_AUTH_RESP_SIZE; 3705 bcc_ptr += CIFS_AUTH_RESP_SIZE;
3697 if (ses->capabilities & CAP_UNICODE) { 3706 if (ses->capabilities & CAP_UNICODE) {
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index a94b3e673182..ca30c391a894 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1823,6 +1823,7 @@ refind_writable:
1823 cifsFileInfo_put(inv_file); 1823 cifsFileInfo_put(inv_file);
1824 spin_lock(&cifs_file_list_lock); 1824 spin_lock(&cifs_file_list_lock);
1825 ++refind; 1825 ++refind;
1826 inv_file = NULL;
1826 goto refind_writable; 1827 goto refind_writable;
1827 } 1828 }
1828 } 1829 }
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 2d4f37235ed0..3e126d7bb2ea 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -771,6 +771,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
771 cifs_buf_release(srchinf->ntwrk_buf_start); 771 cifs_buf_release(srchinf->ntwrk_buf_start);
772 } 772 }
773 kfree(srchinf); 773 kfree(srchinf);
774 if (rc)
775 goto cgii_exit;
774 } else 776 } else
775 goto cgii_exit; 777 goto cgii_exit;
776 778
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 689f035915cf..22dfdf17d065 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -322,7 +322,7 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
322 322
323 /* return pointer to beginning of data area, ie offset from SMB start */ 323 /* return pointer to beginning of data area, ie offset from SMB start */
324 if ((*off != 0) && (*len != 0)) 324 if ((*off != 0) && (*len != 0))
325 return hdr->ProtocolId + *off; 325 return (char *)(&hdr->ProtocolId[0]) + *off;
326 else 326 else
327 return NULL; 327 return NULL;
328} 328}
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 96b5d40a2ece..eab05e1aa587 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -684,7 +684,8 @@ smb2_clone_range(const unsigned int xid,
684 684
685 /* No need to change MaxChunks since already set to 1 */ 685 /* No need to change MaxChunks since already set to 1 */
686 chunk_sizes_updated = true; 686 chunk_sizes_updated = true;
687 } 687 } else
688 goto cchunk_out;
688 } 689 }
689 690
690cchunk_out: 691cchunk_out:
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 3417340bf89e..65cd7a84c8bc 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1218,7 +1218,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1218 struct smb2_ioctl_req *req; 1218 struct smb2_ioctl_req *req;
1219 struct smb2_ioctl_rsp *rsp; 1219 struct smb2_ioctl_rsp *rsp;
1220 struct TCP_Server_Info *server; 1220 struct TCP_Server_Info *server;
1221 struct cifs_ses *ses = tcon->ses; 1221 struct cifs_ses *ses;
1222 struct kvec iov[2]; 1222 struct kvec iov[2];
1223 int resp_buftype; 1223 int resp_buftype;
1224 int num_iovecs; 1224 int num_iovecs;
@@ -1233,6 +1233,11 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1233 if (plen) 1233 if (plen)
1234 *plen = 0; 1234 *plen = 0;
1235 1235
1236 if (tcon)
1237 ses = tcon->ses;
1238 else
1239 return -EIO;
1240
1236 if (ses && (ses->server)) 1241 if (ses && (ses->server))
1237 server = ses->server; 1242 server = ses->server;
1238 else 1243 else
@@ -1296,14 +1301,12 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1296 rsp = (struct smb2_ioctl_rsp *)iov[0].iov_base; 1301 rsp = (struct smb2_ioctl_rsp *)iov[0].iov_base;
1297 1302
1298 if ((rc != 0) && (rc != -EINVAL)) { 1303 if ((rc != 0) && (rc != -EINVAL)) {
1299 if (tcon) 1304 cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
1300 cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
1301 goto ioctl_exit; 1305 goto ioctl_exit;
1302 } else if (rc == -EINVAL) { 1306 } else if (rc == -EINVAL) {
1303 if ((opcode != FSCTL_SRV_COPYCHUNK_WRITE) && 1307 if ((opcode != FSCTL_SRV_COPYCHUNK_WRITE) &&
1304 (opcode != FSCTL_SRV_COPYCHUNK)) { 1308 (opcode != FSCTL_SRV_COPYCHUNK)) {
1305 if (tcon) 1309 cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
1306 cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
1307 goto ioctl_exit; 1310 goto ioctl_exit;
1308 } 1311 }
1309 } 1312 }
@@ -1629,7 +1632,7 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1629 1632
1630 rc = SendReceive2(xid, ses, iov, 1, &resp_buftype, 0); 1633 rc = SendReceive2(xid, ses, iov, 1, &resp_buftype, 0);
1631 1634
1632 if ((rc != 0) && tcon) 1635 if (rc != 0)
1633 cifs_stats_fail_inc(tcon, SMB2_FLUSH_HE); 1636 cifs_stats_fail_inc(tcon, SMB2_FLUSH_HE);
1634 1637
1635 free_rsp_buf(resp_buftype, iov[0].iov_base); 1638 free_rsp_buf(resp_buftype, iov[0].iov_base);
@@ -2114,7 +2117,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
2114 struct kvec iov[2]; 2117 struct kvec iov[2];
2115 int rc = 0; 2118 int rc = 0;
2116 int len; 2119 int len;
2117 int resp_buftype; 2120 int resp_buftype = CIFS_NO_BUFFER;
2118 unsigned char *bufptr; 2121 unsigned char *bufptr;
2119 struct TCP_Server_Info *server; 2122 struct TCP_Server_Info *server;
2120 struct cifs_ses *ses = tcon->ses; 2123 struct cifs_ses *ses = tcon->ses;
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 781974afff9f..ffbc034c8810 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -126,8 +126,23 @@
126#define GICR_PROPBASER_WaWb (5U << 7) 126#define GICR_PROPBASER_WaWb (5U << 7)
127#define GICR_PROPBASER_RaWaWt (6U << 7) 127#define GICR_PROPBASER_RaWaWt (6U << 7)
128#define GICR_PROPBASER_RaWaWb (7U << 7) 128#define GICR_PROPBASER_RaWaWb (7U << 7)
129#define GICR_PROPBASER_CACHEABILITY_MASK (7U << 7)
129#define GICR_PROPBASER_IDBITS_MASK (0x1f) 130#define GICR_PROPBASER_IDBITS_MASK (0x1f)
130 131
132#define GICR_PENDBASER_NonShareable (0U << 10)
133#define GICR_PENDBASER_InnerShareable (1U << 10)
134#define GICR_PENDBASER_OuterShareable (2U << 10)
135#define GICR_PENDBASER_SHAREABILITY_MASK (3UL << 10)
136#define GICR_PENDBASER_nCnB (0U << 7)
137#define GICR_PENDBASER_nC (1U << 7)
138#define GICR_PENDBASER_RaWt (2U << 7)
139#define GICR_PENDBASER_RaWb (3U << 7)
140#define GICR_PENDBASER_WaWt (4U << 7)
141#define GICR_PENDBASER_WaWb (5U << 7)
142#define GICR_PENDBASER_RaWaWt (6U << 7)
143#define GICR_PENDBASER_RaWaWb (7U << 7)
144#define GICR_PENDBASER_CACHEABILITY_MASK (7U << 7)
145
131/* 146/*
132 * Re-Distributor registers, offsets from SGI_base 147 * Re-Distributor registers, offsets from SGI_base
133 */ 148 */
@@ -182,6 +197,7 @@
182#define GITS_CBASER_WaWb (5UL << 59) 197#define GITS_CBASER_WaWb (5UL << 59)
183#define GITS_CBASER_RaWaWt (6UL << 59) 198#define GITS_CBASER_RaWaWt (6UL << 59)
184#define GITS_CBASER_RaWaWb (7UL << 59) 199#define GITS_CBASER_RaWaWb (7UL << 59)
200#define GITS_CBASER_CACHEABILITY_MASK (7UL << 59)
185#define GITS_CBASER_NonShareable (0UL << 10) 201#define GITS_CBASER_NonShareable (0UL << 10)
186#define GITS_CBASER_InnerShareable (1UL << 10) 202#define GITS_CBASER_InnerShareable (1UL << 10)
187#define GITS_CBASER_OuterShareable (2UL << 10) 203#define GITS_CBASER_OuterShareable (2UL << 10)
@@ -198,6 +214,7 @@
198#define GITS_BASER_WaWb (5UL << 59) 214#define GITS_BASER_WaWb (5UL << 59)
199#define GITS_BASER_RaWaWt (6UL << 59) 215#define GITS_BASER_RaWaWt (6UL << 59)
200#define GITS_BASER_RaWaWb (7UL << 59) 216#define GITS_BASER_RaWaWb (7UL << 59)
217#define GITS_BASER_CACHEABILITY_MASK (7UL << 59)
201#define GITS_BASER_TYPE_SHIFT (56) 218#define GITS_BASER_TYPE_SHIFT (56)
202#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7) 219#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7)
203#define GITS_BASER_ENTRY_SIZE_SHIFT (48) 220#define GITS_BASER_ENTRY_SIZE_SHIFT (48)
diff --git a/include/linux/lcm.h b/include/linux/lcm.h
index 7bf01d779b45..1ce79a7f1daa 100644
--- a/include/linux/lcm.h
+++ b/include/linux/lcm.h
@@ -4,5 +4,6 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__; 6unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__;
7unsigned long lcm_not_zero(unsigned long a, unsigned long b) __attribute_const__;
7 8
8#endif /* _LCM_H */ 9#endif /* _LCM_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a710d22b174f..41bf58a2b936 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2182,6 +2182,12 @@ void netdev_freemem(struct net_device *dev);
2182void synchronize_net(void); 2182void synchronize_net(void);
2183int init_dummy_netdev(struct net_device *dev); 2183int init_dummy_netdev(struct net_device *dev);
2184 2184
2185DECLARE_PER_CPU(int, xmit_recursion);
2186static inline int dev_recursion_level(void)
2187{
2188 return this_cpu_read(xmit_recursion);
2189}
2190
2185struct net_device *dev_get_by_index(struct net *net, int ifindex); 2191struct net_device *dev_get_by_index(struct net *net, int ifindex);
2186struct net_device *__dev_get_by_index(struct net *net, int ifindex); 2192struct net_device *__dev_get_by_index(struct net *net, int ifindex);
2187struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 2193struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
diff --git a/include/net/ip.h b/include/net/ip.h
index d0808a323763..69cd9cb8400c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -455,22 +455,6 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
455 455
456#endif 456#endif
457 457
458static inline int sk_mc_loop(struct sock *sk)
459{
460 if (!sk)
461 return 1;
462 switch (sk->sk_family) {
463 case AF_INET:
464 return inet_sk(sk)->mc_loop;
465#if IS_ENABLED(CONFIG_IPV6)
466 case AF_INET6:
467 return inet6_sk(sk)->mc_loop;
468#endif
469 }
470 WARN_ON(1);
471 return 1;
472}
473
474bool ip_call_ra_chain(struct sk_buff *skb); 458bool ip_call_ra_chain(struct sk_buff *skb);
475 459
476/* 460/*
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 1d09b46c1e48..eda131d179d9 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -174,7 +174,8 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
174 174
175static inline int ip6_skb_dst_mtu(struct sk_buff *skb) 175static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
176{ 176{
177 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 177 struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
178 inet6_sk(skb->sk) : NULL;
178 179
179 return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ? 180 return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ?
180 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 181 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
diff --git a/include/net/sock.h b/include/net/sock.h
index 3f9b8ce56948..bd6f523f2251 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1762,6 +1762,8 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1762 1762
1763struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1763struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1764 1764
1765bool sk_mc_loop(struct sock *sk);
1766
1765static inline bool sk_can_gso(const struct sock *sk) 1767static inline bool sk_can_gso(const struct sock *sk)
1766{ 1768{
1767 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1769 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index b0a813079852..2f62ab2d7bf9 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -973,7 +973,8 @@ struct input_keymap_entry {
973 */ 973 */
974#define MT_TOOL_FINGER 0 974#define MT_TOOL_FINGER 0
975#define MT_TOOL_PEN 1 975#define MT_TOOL_PEN 1
976#define MT_TOOL_MAX 1 976#define MT_TOOL_PALM 2
977#define MT_TOOL_MAX 2
977 978
978/* 979/*
979 * Values describing the status of a force-feedback effect 980 * Values describing the status of a force-feedback effect
diff --git a/lib/lcm.c b/lib/lcm.c
index e97dbd51e756..03d7fcb420b5 100644
--- a/lib/lcm.c
+++ b/lib/lcm.c
@@ -12,3 +12,14 @@ unsigned long lcm(unsigned long a, unsigned long b)
12 return 0; 12 return 0;
13} 13}
14EXPORT_SYMBOL_GPL(lcm); 14EXPORT_SYMBOL_GPL(lcm);
15
16unsigned long lcm_not_zero(unsigned long a, unsigned long b)
17{
18 unsigned long l = lcm(a, b);
19
20 if (l)
21 return l;
22
23 return (b ? : a);
24}
25EXPORT_SYMBOL_GPL(lcm_not_zero);
diff --git a/net/core/dev.c b/net/core/dev.c
index 26622d614f81..3b3965288f52 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2870,7 +2870,9 @@ static void skb_update_prio(struct sk_buff *skb)
2870#define skb_update_prio(skb) 2870#define skb_update_prio(skb)
2871#endif 2871#endif
2872 2872
2873static DEFINE_PER_CPU(int, xmit_recursion); 2873DEFINE_PER_CPU(int, xmit_recursion);
2874EXPORT_SYMBOL(xmit_recursion);
2875
2874#define RECURSION_LIMIT 10 2876#define RECURSION_LIMIT 10
2875 2877
2876/** 2878/**
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 68ea6950cad1..9a12668f7d62 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -165,9 +165,9 @@ void fib_rules_unregister(struct fib_rules_ops *ops)
165 165
166 spin_lock(&net->rules_mod_lock); 166 spin_lock(&net->rules_mod_lock);
167 list_del_rcu(&ops->list); 167 list_del_rcu(&ops->list);
168 fib_rules_cleanup_ops(ops);
169 spin_unlock(&net->rules_mod_lock); 168 spin_unlock(&net->rules_mod_lock);
170 169
170 fib_rules_cleanup_ops(ops);
171 kfree_rcu(ops, rcu); 171 kfree_rcu(ops, rcu);
172} 172}
173EXPORT_SYMBOL_GPL(fib_rules_unregister); 173EXPORT_SYMBOL_GPL(fib_rules_unregister);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index ce6396a75b8b..e7345d9031df 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -198,8 +198,10 @@ static int __peernet2id(struct net *net, struct net *peer, bool alloc)
198 */ 198 */
199int peernet2id(struct net *net, struct net *peer) 199int peernet2id(struct net *net, struct net *peer)
200{ 200{
201 int id = __peernet2id(net, peer, true); 201 bool alloc = atomic_read(&peer->count) == 0 ? false : true;
202 int id;
202 203
204 id = __peernet2id(net, peer, alloc);
203 return id >= 0 ? id : NETNSA_NSID_NOT_ASSIGNED; 205 return id >= 0 ? id : NETNSA_NSID_NOT_ASSIGNED;
204} 206}
205EXPORT_SYMBOL(peernet2id); 207EXPORT_SYMBOL(peernet2id);
@@ -338,7 +340,7 @@ static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */
338static void cleanup_net(struct work_struct *work) 340static void cleanup_net(struct work_struct *work)
339{ 341{
340 const struct pernet_operations *ops; 342 const struct pernet_operations *ops;
341 struct net *net, *tmp, *peer; 343 struct net *net, *tmp;
342 struct list_head net_kill_list; 344 struct list_head net_kill_list;
343 LIST_HEAD(net_exit_list); 345 LIST_HEAD(net_exit_list);
344 346
@@ -354,6 +356,14 @@ static void cleanup_net(struct work_struct *work)
354 list_for_each_entry(net, &net_kill_list, cleanup_list) { 356 list_for_each_entry(net, &net_kill_list, cleanup_list) {
355 list_del_rcu(&net->list); 357 list_del_rcu(&net->list);
356 list_add_tail(&net->exit_list, &net_exit_list); 358 list_add_tail(&net->exit_list, &net_exit_list);
359 for_each_net(tmp) {
360 int id = __peernet2id(tmp, net, false);
361
362 if (id >= 0)
363 idr_remove(&tmp->netns_ids, id);
364 }
365 idr_destroy(&net->netns_ids);
366
357 } 367 }
358 rtnl_unlock(); 368 rtnl_unlock();
359 369
@@ -379,26 +389,12 @@ static void cleanup_net(struct work_struct *work)
379 */ 389 */
380 rcu_barrier(); 390 rcu_barrier();
381 391
382 rtnl_lock();
383 /* Finally it is safe to free my network namespace structure */ 392 /* Finally it is safe to free my network namespace structure */
384 list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) { 393 list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
385 /* Unreference net from all peers (no need to loop over
386 * net_exit_list because idr_destroy() will be called for each
387 * element of this list.
388 */
389 for_each_net(peer) {
390 int id = __peernet2id(peer, net, false);
391
392 if (id >= 0)
393 idr_remove(&peer->netns_ids, id);
394 }
395 idr_destroy(&net->netns_ids);
396
397 list_del_init(&net->exit_list); 394 list_del_init(&net->exit_list);
398 put_user_ns(net->user_ns); 395 put_user_ns(net->user_ns);
399 net_drop_ns(net); 396 net_drop_ns(net);
400 } 397 }
401 rtnl_unlock();
402} 398}
403static DECLARE_WORK(net_cleanup_work, cleanup_net); 399static DECLARE_WORK(net_cleanup_work, cleanup_net);
404 400
diff --git a/net/core/sock.c b/net/core/sock.c
index 119ae464b44a..654e38a99759 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -653,6 +653,25 @@ static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
653 sock_reset_flag(sk, bit); 653 sock_reset_flag(sk, bit);
654} 654}
655 655
656bool sk_mc_loop(struct sock *sk)
657{
658 if (dev_recursion_level())
659 return false;
660 if (!sk)
661 return true;
662 switch (sk->sk_family) {
663 case AF_INET:
664 return inet_sk(sk)->mc_loop;
665#if IS_ENABLED(CONFIG_IPV6)
666 case AF_INET6:
667 return inet6_sk(sk)->mc_loop;
668#endif
669 }
670 WARN_ON(1);
671 return true;
672}
673EXPORT_SYMBOL(sk_mc_loop);
674
656/* 675/*
657 * This is meant for all protocols to use and covers goings on 676 * This is meant for all protocols to use and covers goings on
658 * at the socket level. Everything here is generic. 677 * at the socket level. Everything here is generic.
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index faf7cc3483fe..9d66a0f72f90 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -248,7 +248,9 @@ void __init dn_fib_rules_init(void)
248 248
249void __exit dn_fib_rules_cleanup(void) 249void __exit dn_fib_rules_cleanup(void)
250{ 250{
251 rtnl_lock();
251 fib_rules_unregister(dn_fib_rules_ops); 252 fib_rules_unregister(dn_fib_rules_ops);
253 rtnl_unlock();
252 rcu_barrier(); 254 rcu_barrier();
253} 255}
254 256
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 899772108ee3..5eaadabe23a1 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -513,12 +513,10 @@ static struct net_device *dev_to_net_device(struct device *dev)
513#ifdef CONFIG_OF 513#ifdef CONFIG_OF
514static int dsa_of_setup_routing_table(struct dsa_platform_data *pd, 514static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
515 struct dsa_chip_data *cd, 515 struct dsa_chip_data *cd,
516 int chip_index, 516 int chip_index, int port_index,
517 struct device_node *link) 517 struct device_node *link)
518{ 518{
519 int ret;
520 const __be32 *reg; 519 const __be32 *reg;
521 int link_port_addr;
522 int link_sw_addr; 520 int link_sw_addr;
523 struct device_node *parent_sw; 521 struct device_node *parent_sw;
524 int len; 522 int len;
@@ -531,6 +529,10 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
531 if (!reg || (len != sizeof(*reg) * 2)) 529 if (!reg || (len != sizeof(*reg) * 2))
532 return -EINVAL; 530 return -EINVAL;
533 531
532 /*
533 * Get the destination switch number from the second field of its 'reg'
534 * property, i.e. for "reg = <0x19 1>" sw_addr is '1'.
535 */
534 link_sw_addr = be32_to_cpup(reg + 1); 536 link_sw_addr = be32_to_cpup(reg + 1);
535 537
536 if (link_sw_addr >= pd->nr_chips) 538 if (link_sw_addr >= pd->nr_chips)
@@ -547,20 +549,9 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
547 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8)); 549 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8));
548 } 550 }
549 551
550 reg = of_get_property(link, "reg", NULL); 552 cd->rtable[link_sw_addr] = port_index;
551 if (!reg) {
552 ret = -EINVAL;
553 goto out;
554 }
555
556 link_port_addr = be32_to_cpup(reg);
557
558 cd->rtable[link_sw_addr] = link_port_addr;
559 553
560 return 0; 554 return 0;
561out:
562 kfree(cd->rtable);
563 return ret;
564} 555}
565 556
566static void dsa_of_free_platform_data(struct dsa_platform_data *pd) 557static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
@@ -670,7 +661,7 @@ static int dsa_of_probe(struct device *dev)
670 if (!strcmp(port_name, "dsa") && link && 661 if (!strcmp(port_name, "dsa") && link &&
671 pd->nr_chips > 1) { 662 pd->nr_chips > 1) {
672 ret = dsa_of_setup_routing_table(pd, cd, 663 ret = dsa_of_setup_routing_table(pd, cd,
673 chip_index, link); 664 chip_index, port_index, link);
674 if (ret) 665 if (ret)
675 goto out_free_chip; 666 goto out_free_chip;
676 } 667 }
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 2166d2bf1562..872494e6e6eb 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1175,13 +1175,11 @@ static void ip_fib_net_exit(struct net *net)
1175 unsigned int i; 1175 unsigned int i;
1176 1176
1177 rtnl_lock(); 1177 rtnl_lock();
1178
1179#ifdef CONFIG_IP_MULTIPLE_TABLES 1178#ifdef CONFIG_IP_MULTIPLE_TABLES
1180 RCU_INIT_POINTER(net->ipv4.fib_local, NULL); 1179 RCU_INIT_POINTER(net->ipv4.fib_local, NULL);
1181 RCU_INIT_POINTER(net->ipv4.fib_main, NULL); 1180 RCU_INIT_POINTER(net->ipv4.fib_main, NULL);
1182 RCU_INIT_POINTER(net->ipv4.fib_default, NULL); 1181 RCU_INIT_POINTER(net->ipv4.fib_default, NULL);
1183#endif 1182#endif
1184
1185 for (i = 0; i < FIB_TABLE_HASHSZ; i++) { 1183 for (i = 0; i < FIB_TABLE_HASHSZ; i++) {
1186 struct hlist_head *head = &net->ipv4.fib_table_hash[i]; 1184 struct hlist_head *head = &net->ipv4.fib_table_hash[i];
1187 struct hlist_node *tmp; 1185 struct hlist_node *tmp;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index c204b728bbc1..5f17d0e78071 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -276,11 +276,13 @@ static void __net_exit ipmr_rules_exit(struct net *net)
276{ 276{
277 struct mr_table *mrt, *next; 277 struct mr_table *mrt, *next;
278 278
279 rtnl_lock();
279 list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) { 280 list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) {
280 list_del(&mrt->list); 281 list_del(&mrt->list);
281 ipmr_free_table(mrt); 282 ipmr_free_table(mrt);
282 } 283 }
283 fib_rules_unregister(net->ipv4.mr_rules_ops); 284 fib_rules_unregister(net->ipv4.mr_rules_ops);
285 rtnl_unlock();
284} 286}
285#else 287#else
286#define ipmr_for_each_table(mrt, net) \ 288#define ipmr_for_each_table(mrt, net) \
@@ -306,7 +308,10 @@ static int __net_init ipmr_rules_init(struct net *net)
306 308
307static void __net_exit ipmr_rules_exit(struct net *net) 309static void __net_exit ipmr_rules_exit(struct net *net)
308{ 310{
311 rtnl_lock();
309 ipmr_free_table(net->ipv4.mrt); 312 ipmr_free_table(net->ipv4.mrt);
313 net->ipv4.mrt = NULL;
314 rtnl_unlock();
310} 315}
311#endif 316#endif
312 317
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index df7e7fa12733..c1ce304ba8d2 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3105,10 +3105,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
3105 if (!first_ackt.v64) 3105 if (!first_ackt.v64)
3106 first_ackt = last_ackt; 3106 first_ackt = last_ackt;
3107 3107
3108 if (!(sacked & TCPCB_SACKED_ACKED)) 3108 if (!(sacked & TCPCB_SACKED_ACKED)) {
3109 reord = min(pkts_acked, reord); 3109 reord = min(pkts_acked, reord);
3110 if (!after(scb->end_seq, tp->high_seq)) 3110 if (!after(scb->end_seq, tp->high_seq))
3111 flag |= FLAG_ORIG_SACK_ACKED; 3111 flag |= FLAG_ORIG_SACK_ACKED;
3112 }
3112 } 3113 }
3113 3114
3114 if (sacked & TCPCB_SACKED_ACKED) 3115 if (sacked & TCPCB_SACKED_ACKED)
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 61fb184b818d..2367a16eae58 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -315,7 +315,9 @@ out_fib6_rules_ops:
315 315
316static void __net_exit fib6_rules_net_exit(struct net *net) 316static void __net_exit fib6_rules_net_exit(struct net *net)
317{ 317{
318 rtnl_lock();
318 fib_rules_unregister(net->ipv6.fib6_rules_ops); 319 fib_rules_unregister(net->ipv6.fib6_rules_ops);
320 rtnl_unlock();
319} 321}
320 322
321static struct pernet_operations fib6_rules_net_ops = { 323static struct pernet_operations fib6_rules_net_ops = {
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 84c58da10f5c..654f245aa930 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -542,7 +542,8 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
542{ 542{
543 struct sk_buff *frag; 543 struct sk_buff *frag;
544 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); 544 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
545 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 545 struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
546 inet6_sk(skb->sk) : NULL;
546 struct ipv6hdr *tmp_hdr; 547 struct ipv6hdr *tmp_hdr;
547 struct frag_hdr *fh; 548 struct frag_hdr *fh;
548 unsigned int mtu, hlen, left, len; 549 unsigned int mtu, hlen, left, len;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 26456037bdfc..8493a22e74eb 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -265,8 +265,8 @@ static void __net_exit ip6mr_rules_exit(struct net *net)
265 list_del(&mrt->list); 265 list_del(&mrt->list);
266 ip6mr_free_table(mrt); 266 ip6mr_free_table(mrt);
267 } 267 }
268 rtnl_unlock();
269 fib_rules_unregister(net->ipv6.mr6_rules_ops); 268 fib_rules_unregister(net->ipv6.mr6_rules_ops);
269 rtnl_unlock();
270} 270}
271#else 271#else
272#define ip6mr_for_each_table(mrt, net) \ 272#define ip6mr_for_each_table(mrt, net) \
@@ -334,7 +334,7 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id)
334 334
335static void ip6mr_free_table(struct mr6_table *mrt) 335static void ip6mr_free_table(struct mr6_table *mrt)
336{ 336{
337 del_timer(&mrt->ipmr_expire_timer); 337 del_timer_sync(&mrt->ipmr_expire_timer);
338 mroute_clean_tables(mrt); 338 mroute_clean_tables(mrt);
339 kfree(mrt); 339 kfree(mrt);
340} 340}
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 895348e44c7d..a29a504492af 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1871,6 +1871,7 @@ static int __init l2tp_init(void)
1871 l2tp_wq = alloc_workqueue("l2tp", WQ_UNBOUND, 0); 1871 l2tp_wq = alloc_workqueue("l2tp", WQ_UNBOUND, 0);
1872 if (!l2tp_wq) { 1872 if (!l2tp_wq) {
1873 pr_err("alloc_workqueue failed\n"); 1873 pr_err("alloc_workqueue failed\n");
1874 unregister_pernet_device(&l2tp_net_ops);
1874 rc = -ENOMEM; 1875 rc = -ENOMEM;
1875 goto out; 1876 goto out;
1876 } 1877 }