--- /dev/null
+From 6f024978e74bda616b27183adee029b65eb27032 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Date: Wed, 11 Mar 2015 11:13:57 +0100
+Subject: ARM: EXYNOS: Fix failed second suspend on Exynos4
+
+From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+
+commit 6f024978e74bda616b27183adee029b65eb27032 upstream.
+
+On Exynos4412 boards (Trats2, Odroid U3) after enabling L2 cache in
+56b60b8bce4a ("ARM: 8265/1: dts: exynos4: Add nodes for L2 cache
+controller") the second suspend to RAM failed. First suspend worked fine
+but the next one hang just after powering down of secondary CPUs (system
+consumed energy as it would be running but was not responsive).
+
+The issue was caused by enabling delayed reset assertion for CPU0 just
+after issuing power down of cores. This was introduced for Exynos4 in
+13cfa6c4f7fa ("ARM: EXYNOS: Fix CPU idle clock down after CPU off").
+
+The whole behavior is not well documented but after checking with vendor
+code this should be done like this (on Exynos4):
+1. Enable delayed reset assertion when system is running (for all CPUs).
+2. Disable delayed reset assertion before suspending the system.
+ This can be done after powering off secondary CPUs.
+3. Re-enable the delayed reset assertion when system is resumed.
+
+Fixes: 13cfa6c4f7fa ("ARM: EXYNOS: Fix CPU idle clock down after CPU off")
+Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Tested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Kukjin Kim <kgene@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-exynos/common.h | 2 ++
+ arch/arm/mach-exynos/exynos.c | 27 +++++++++++++++++++++++++++
+ arch/arm/mach-exynos/platsmp.c | 39 ++-------------------------------------
+ arch/arm/mach-exynos/suspend.c | 3 +++
+ 4 files changed, 34 insertions(+), 37 deletions(-)
+
+--- a/arch/arm/mach-exynos/common.h
++++ b/arch/arm/mach-exynos/common.h
+@@ -153,6 +153,8 @@ extern void exynos_enter_aftr(void);
+
+ extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data;
+
++extern void exynos_set_delayed_reset_assertion(bool enable);
++
+ extern void s5p_init_cpu(void __iomem *cpuid_addr);
+ extern unsigned int samsung_rev(void);
+ extern void __iomem *cpu_boot_reg_base(void);
+--- a/arch/arm/mach-exynos/exynos.c
++++ b/arch/arm/mach-exynos/exynos.c
+@@ -166,6 +166,33 @@ static void __init exynos_init_io(void)
+ exynos_map_io();
+ }
+
++/*
++ * Set or clear the USE_DELAYED_RESET_ASSERTION option. Used by smp code
++ * and suspend.
++ *
++ * This is necessary only on Exynos4 SoCs. When system is running
++ * USE_DELAYED_RESET_ASSERTION should be set so the ARM CLK clock down
++ * feature could properly detect global idle state when secondary CPU is
++ * powered down.
++ *
++ * However this should not be set when such system is going into suspend.
++ */
++void exynos_set_delayed_reset_assertion(bool enable)
++{
++ if (soc_is_exynos4()) {
++ unsigned int tmp, core_id;
++
++ for (core_id = 0; core_id < num_possible_cpus(); core_id++) {
++ tmp = pmu_raw_readl(EXYNOS_ARM_CORE_OPTION(core_id));
++ if (enable)
++ tmp |= S5P_USE_DELAYED_RESET_ASSERTION;
++ else
++ tmp &= ~(S5P_USE_DELAYED_RESET_ASSERTION);
++ pmu_raw_writel(tmp, EXYNOS_ARM_CORE_OPTION(core_id));
++ }
++ }
++}
++
+ static const struct of_device_id exynos_dt_pmu_match[] = {
+ { .compatible = "samsung,exynos3250-pmu" },
+ { .compatible = "samsung,exynos4210-pmu" },
+--- a/arch/arm/mach-exynos/platsmp.c
++++ b/arch/arm/mach-exynos/platsmp.c
+@@ -34,30 +34,6 @@
+
+ extern void exynos4_secondary_startup(void);
+
+-/*
+- * Set or clear the USE_DELAYED_RESET_ASSERTION option, set on Exynos4 SoCs
+- * during hot-(un)plugging CPUx.
+- *
+- * The feature can be cleared safely during first boot of secondary CPU.
+- *
+- * Exynos4 SoCs require setting USE_DELAYED_RESET_ASSERTION during powering
+- * down a CPU so the CPU idle clock down feature could properly detect global
+- * idle state when CPUx is off.
+- */
+-static void exynos_set_delayed_reset_assertion(u32 core_id, bool enable)
+-{
+- if (soc_is_exynos4()) {
+- unsigned int tmp;
+-
+- tmp = pmu_raw_readl(EXYNOS_ARM_CORE_OPTION(core_id));
+- if (enable)
+- tmp |= S5P_USE_DELAYED_RESET_ASSERTION;
+- else
+- tmp &= ~(S5P_USE_DELAYED_RESET_ASSERTION);
+- pmu_raw_writel(tmp, EXYNOS_ARM_CORE_OPTION(core_id));
+- }
+-}
+-
+ #ifdef CONFIG_HOTPLUG_CPU
+ static inline void cpu_leave_lowpower(u32 core_id)
+ {
+@@ -73,8 +49,6 @@ static inline void cpu_leave_lowpower(u3
+ : "=&r" (v)
+ : "Ir" (CR_C), "Ir" (0x40)
+ : "cc");
+-
+- exynos_set_delayed_reset_assertion(core_id, false);
+ }
+
+ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
+@@ -87,14 +61,6 @@ static inline void platform_do_lowpower(
+ /* Turn the CPU off on next WFI instruction. */
+ exynos_cpu_power_down(core_id);
+
+- /*
+- * Exynos4 SoCs require setting
+- * USE_DELAYED_RESET_ASSERTION so the CPU idle
+- * clock down feature could properly detect
+- * global idle state when CPUx is off.
+- */
+- exynos_set_delayed_reset_assertion(core_id, true);
+-
+ wfi();
+
+ if (pen_release == core_id) {
+@@ -354,9 +320,6 @@ static int exynos_boot_secondary(unsigne
+ udelay(10);
+ }
+
+- /* No harm if this is called during first boot of secondary CPU */
+- exynos_set_delayed_reset_assertion(core_id, false);
+-
+ /*
+ * now the secondary core is starting up let it run its
+ * calibrations, then wait for it to finish
+@@ -403,6 +366,8 @@ static void __init exynos_smp_prepare_cp
+
+ exynos_sysram_init();
+
++ exynos_set_delayed_reset_assertion(true);
++
+ if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
+ scu_enable(scu_base_addr());
+
+--- a/arch/arm/mach-exynos/suspend.c
++++ b/arch/arm/mach-exynos/suspend.c
+@@ -235,6 +235,8 @@ static void exynos_pm_enter_sleep_mode(v
+
+ static void exynos_pm_prepare(void)
+ {
++ exynos_set_delayed_reset_assertion(false);
++
+ /* Set wake-up mask registers */
+ exynos_pm_set_wakeup_mask();
+
+@@ -383,6 +385,7 @@ early_wakeup:
+
+ /* Clear SLEEP mode set in INFORM1 */
+ pmu_raw_writel(0x0, S5P_INFORM1);
++ exynos_set_delayed_reset_assertion(true);
+ }
+
+ static void exynos3250_pm_resume(void)
--- /dev/null
+From 15bf722e6f6c0b884521a0363204532e849deb7f Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <sokolov@7pikes.com>
+Date: Tue, 2 Jun 2015 11:49:30 +0300
+Subject: cdc-acm: Add support of ATOL FPrint fiscal printers
+
+From: Alexey Sokolov <sokolov@7pikes.com>
+
+commit 15bf722e6f6c0b884521a0363204532e849deb7f upstream.
+
+ATOL FPrint fiscal printers require usb_clear_halt to be executed
+to work properly. Add quirk to fix the issue.
+
+Signed-off-by: Alexey Sokolov <sokolov@7pikes.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/class/cdc-acm.c | 9 +++++++++
+ drivers/usb/class/cdc-acm.h | 1 +
+ 2 files changed, 10 insertions(+)
+
+--- a/drivers/usb/class/cdc-acm.c
++++ b/drivers/usb/class/cdc-acm.c
+@@ -1468,6 +1468,11 @@ skip_countries:
+ goto alloc_fail8;
+ }
+
++ if (quirks & CLEAR_HALT_CONDITIONS) {
++ usb_clear_halt(usb_dev, usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress));
++ usb_clear_halt(usb_dev, usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress));
++ }
++
+ return 0;
+ alloc_fail8:
+ if (acm->country_codes) {
+@@ -1747,6 +1752,10 @@ static const struct usb_device_id acm_id
+ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
+ },
+
++ { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */
++ .driver_info = CLEAR_HALT_CONDITIONS,
++ },
++
+ /* Nokia S60 phones expose two ACM channels. The first is
+ * a modem and is picked up by the standard AT-command
+ * information below. The second is 'vendor-specific' but
+--- a/drivers/usb/class/cdc-acm.h
++++ b/drivers/usb/class/cdc-acm.h
+@@ -133,3 +133,4 @@ struct acm {
+ #define NO_DATA_INTERFACE BIT(4)
+ #define IGNORE_DEVICE BIT(5)
+ #define QUIRK_CONTROL_LINE_STATE BIT(6)
++#define CLEAR_HALT_CONDITIONS BIT(7)
--- /dev/null
+From 3a1407559a593d4360af12dd2df5296bf8eb0d28 Mon Sep 17 00:00:00 2001
+From: Junichi Nomura <j-nomura@ce.jp.nec.com>
+Date: Wed, 27 May 2015 04:22:07 +0000
+Subject: dm: fix NULL pointer when clone_and_map_rq returns !DM_MAPIO_REMAPPED
+
+From: Junichi Nomura <j-nomura@ce.jp.nec.com>
+
+commit 3a1407559a593d4360af12dd2df5296bf8eb0d28 upstream.
+
+When stacking request-based DM on blk_mq device, request cloning and
+remapping are done in a single call to target's clone_and_map_rq().
+The clone is allocated and valid only if clone_and_map_rq() returns
+DM_MAPIO_REMAPPED.
+
+The "IS_ERR(clone)" check in map_request() does not cover all the
+!DM_MAPIO_REMAPPED cases that are possible (E.g. if underlying devices
+are not ready or unavailable, clone_and_map_rq() may return
+DM_MAPIO_REQUEUE without ever having established an ERR_PTR). Fix this
+by explicitly checking for a return that is not DM_MAPIO_REMAPPED in
+map_request().
+
+Without this fix, DM core may call setup_clone() for a NULL clone
+and oops like this:
+
+ BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
+ IP: [<ffffffff81227525>] blk_rq_prep_clone+0x7d/0x137
+ ...
+ CPU: 2 PID: 5793 Comm: kdmwork-253:3 Not tainted 4.0.0-nm #1
+ ...
+ Call Trace:
+ [<ffffffffa01d1c09>] map_tio_request+0xa9/0x258 [dm_mod]
+ [<ffffffff81071de9>] kthread_worker_fn+0xfd/0x150
+ [<ffffffff81071cec>] ? kthread_parkme+0x24/0x24
+ [<ffffffff81071cec>] ? kthread_parkme+0x24/0x24
+ [<ffffffff81071fdd>] kthread+0xe6/0xee
+ [<ffffffff81093a59>] ? put_lock_stats+0xe/0x20
+ [<ffffffff81071ef7>] ? __init_kthread_worker+0x5b/0x5b
+ [<ffffffff814c2d98>] ret_from_fork+0x58/0x90
+ [<ffffffff81071ef7>] ? __init_kthread_worker+0x5b/0x5b
+
+Fixes: e5863d9ad ("dm: allocate requests in target when stacking on blk-mq devices")
+Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
+Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/md/dm.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -1889,8 +1889,8 @@ static int map_request(struct dm_target
+ dm_kill_unmapped_request(rq, r);
+ return r;
+ }
+- if (IS_ERR(clone))
+- return DM_MAPIO_REQUEUE;
++ if (r != DM_MAPIO_REMAPPED)
++ return r;
+ if (setup_clone(clone, rq, tio, GFP_KERNEL)) {
+ /* -ENOMEM */
+ ti->type->release_clone_rq(clone);
--- /dev/null
+From 364aece01a2dd748fc36a1e8bf52ef639b0857bd Mon Sep 17 00:00:00 2001
+From: Peter Antoine <peter.antoine@intel.com>
+Date: Mon, 11 May 2015 08:50:45 +0100
+Subject: drm/i915: Avoid GPU hang when coming out of s3 or s4
+
+From: Peter Antoine <peter.antoine@intel.com>
+
+commit 364aece01a2dd748fc36a1e8bf52ef639b0857bd upstream.
+
+This patch fixes a timing issue that causes a GPU hang when the system
+comes out of power saving.
+
+During pm_resume, We are submitting batchbuffers before enabling
+Interrupts this is causing us to miss the context switch interrupt,
+and in consequence intel_execlists_handle_ctx_events is not triggered.
+
+This patch is based on a patch from Deepak S <deepak.s@intel.com>
+from another platform.
+
+The patch fixes an issue introduced by:
+ commit e7778be1eab918274f79603d7c17b3ec8be77386
+ drm/i915: Fix startup failure in LRC mode after recent init changes
+
+The above patch added a call to init_context() to fix an issue introduced
+by a previous patch. But, it then opened up a small timing window for the
+batches being added by the init_context (basically setting up the context)
+to complete before the interrupts have been turned on, thus hanging the
+GPU.
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89600
+Cc: stable@vger.kernel.org # 4.0+
+Signed-off-by: Peter Antoine <peter.antoine@intel.com>
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+[Jani: fixed typo in subject, massaged the comments a bit]
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/i915_drv.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/i915/i915_drv.c
++++ b/drivers/gpu/drm/i915/i915_drv.c
+@@ -693,6 +693,16 @@ static int i915_drm_resume(struct drm_de
+ intel_init_pch_refclk(dev);
+ drm_mode_config_reset(dev);
+
++ /*
++ * Interrupts have to be enabled before any batches are run.
++ * If not the GPU will hang. i915_gem_init_hw() will initiate
++ * batches to update/restore the context.
++ *
++ * Modeset enabling in intel_modeset_init_hw() also needs
++ * working interrupts.
++ */
++ intel_runtime_pm_enable_interrupts(dev_priv);
++
+ mutex_lock(&dev->struct_mutex);
+ if (i915_gem_init_hw(dev)) {
+ DRM_ERROR("failed to re-initialize GPU, declaring wedged!\n");
+@@ -700,9 +710,6 @@ static int i915_drm_resume(struct drm_de
+ }
+ mutex_unlock(&dev->struct_mutex);
+
+- /* We need working interrupts for modeset enabling ... */
+- intel_runtime_pm_enable_interrupts(dev_priv);
+-
+ intel_modeset_init_hw(dev);
+
+ spin_lock_irq(&dev_priv->irq_lock);
--- /dev/null
+From c80e5c0c23ce2282476fdc64c4b5e3d3a40723fd Mon Sep 17 00:00:00 2001
+From: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
+Date: Tue, 17 Mar 2015 19:09:18 +0900
+Subject: kprobes/x86: Return correct length in __copy_instruction()
+
+From: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
+
+commit c80e5c0c23ce2282476fdc64c4b5e3d3a40723fd upstream.
+
+On x86-64, __copy_instruction() always returns 0 (error) if the
+instruction uses %rip-relative addressing. This is because
+kernel_insn_init() is called the second time for 'insn' instance
+in such cases and sets all its fields to 0.
+
+Because of this, trying to place a kprobe on such instruction
+will fail, register_kprobe() will return -EINVAL.
+
+This patch fixes the problem.
+
+Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
+Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
+Link: http://lkml.kernel.org/r/20150317100918.28349.94654.stgit@localhost.localdomain
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/kprobes/core.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/kprobes/core.c
++++ b/arch/x86/kernel/kprobes/core.c
+@@ -354,6 +354,7 @@ int __copy_instruction(u8 *dest, u8 *src
+ {
+ struct insn insn;
+ kprobe_opcode_t buf[MAX_INSN_SIZE];
++ int length;
+ unsigned long recovered_insn =
+ recover_probed_instruction(buf, (unsigned long)src);
+
+@@ -361,16 +362,18 @@ int __copy_instruction(u8 *dest, u8 *src
+ return 0;
+ kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE);
+ insn_get_length(&insn);
++ length = insn.length;
++
+ /* Another subsystem puts a breakpoint, failed to recover */
+ if (insn.opcode.bytes[0] == BREAKPOINT_INSTRUCTION)
+ return 0;
+- memcpy(dest, insn.kaddr, insn.length);
++ memcpy(dest, insn.kaddr, length);
+
+ #ifdef CONFIG_X86_64
+ if (insn_rip_relative(&insn)) {
+ s64 newdisp;
+ u8 *disp;
+- kernel_insn_init(&insn, dest, insn.length);
++ kernel_insn_init(&insn, dest, length);
+ insn_get_displacement(&insn);
+ /*
+ * The copied instruction uses the %rip-relative addressing
+@@ -394,7 +397,7 @@ int __copy_instruction(u8 *dest, u8 *src
+ *(s32 *) disp = (s32) newdisp;
+ }
+ #endif
+- return insn.length;
++ return length;
+ }
+
+ static int arch_copy_kprobe(struct kprobe *p)
--- /dev/null
+From 0aab3747091db309b8a484cfd382a41644552aa3 Mon Sep 17 00:00:00 2001
+From: Sam Bobroff <sam.bobroff@au1.ibm.com>
+Date: Fri, 1 May 2015 16:50:34 +1000
+Subject: powerpc/powernv: Restore non-volatile CRs after nap
+
+From: Sam Bobroff <sam.bobroff@au1.ibm.com>
+
+commit 0aab3747091db309b8a484cfd382a41644552aa3 upstream.
+
+Patches 7cba160ad "powernv/cpuidle: Redesign idle states management"
+and 77b54e9f2 "powernv/powerpc: Add winkle support for offline cpus"
+use non-volatile condition registers (cr2, cr3 and cr4) early in the system
+reset interrupt handler (system_reset_pSeries()) before it has been determined
+if state loss has occurred. If state loss has not occurred, control returns via
+the power7_wakeup_noloss() path which does not restore those condition
+registers, leaving them corrupted.
+
+Fix this by restoring the condition registers in the power7_wakeup_noloss()
+case.
+
+This is apparent when running a KVM guest on hardware that does not
+support winkle or sleep and the guest makes use of secondary threads. In
+practice this means Power7 machines, though some early unreleased Power8
+machines may also be susceptible.
+
+The secondary CPUs are taken off line before the guest is started and
+they call pnv_smp_cpu_kill_self(). This checks support for sleep
+states (in this case there is no support) and power7_nap() is called.
+
+When the CPU is woken, power7_nap() returns and because the CPU is
+still off line, the main while loop executes again. The sleep states
+support test is executed again, but because the tested values cannot
+have changed, the compiler has optimized the test away and instead we
+rely on the result of the first test, which has been left in cr3
+and/or cr4. With the result overwritten, the wrong branch is taken and
+power7_winkle() is called on a CPU that does not support it, leading
+to it stalling.
+
+Fixes: 7cba160ad789 ("powernv/cpuidle: Redesign idle states management")
+Fixes: 77b54e9f213f ("powernv/powerpc: Add winkle support for offline cpus")
+[mpe: Massage change log a bit more]
+Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/idle_power7.S | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/powerpc/kernel/idle_power7.S
++++ b/arch/powerpc/kernel/idle_power7.S
+@@ -500,9 +500,11 @@ BEGIN_FTR_SECTION
+ CHECK_HMI_INTERRUPT
+ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+ ld r1,PACAR1(r13)
++ ld r6,_CCR(r1)
+ ld r4,_MSR(r1)
+ ld r5,_NIP(r1)
+ addi r1,r1,INT_FRAME_SIZE
++ mtcr r6
+ mtspr SPRN_SRR1,r4
+ mtspr SPRN_SRR0,r5
+ rfid
ath3k-add-support-of-0489-e076-ar3012-device.patch
ath3k-add-support-of-13d3-3474-ar3012-device.patch
b43-fix-support-for-14e4-4321-pci-dev-with-bcm4321-chipset.patch
+cdc-acm-add-support-of-atol-fprint-fiscal-printers.patch
+arm-exynos-fix-failed-second-suspend-on-exynos4.patch
+kprobes-x86-return-correct-length-in-__copy_instruction.patch
+dm-fix-null-pointer-when-clone_and_map_rq-returns-dm_mapio_remapped.patch
+drm-i915-avoid-gpu-hang-when-coming-out-of-s3-or-s4.patch
+powerpc-powernv-restore-non-volatile-crs-after-nap.patch