--- /dev/null
+From 9c413e25d95fd3c0abe23eadad66191b22baa549 Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Wed, 8 May 2013 17:01:12 +0100
+Subject: arm64: debug: clear mdscr_el1 instead of taking the OS lock
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 9c413e25d95fd3c0abe23eadad66191b22baa549 upstream.
+
+During boot, we take the debug OS lock before interrupts are enabled.
+This is required to prevent clearing of PSTATE.D on the interrupt entry
+path, which could result in spurious debug exceptions before we've got
+round to resetting things like the hardware breakpoints registers to a
+sane state.
+
+A problem with this approach is that taking the OS lock prevents an
+external JTAG debugger from debugging the system, which is especially
+irritating during boot, where JTAG debugging can be most useful.
+
+This patch clears mdscr_el1 rather than taking the lock, clearing the
+MDE and KDE bits and preventing self-hosted hardware debug exceptions
+from occurring.
+
+Tested-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/debug-monitors.c | 2 --
+ arch/arm64/mm/proc.S | 3 +--
+ 2 files changed, 1 insertion(+), 4 deletions(-)
+
+--- a/arch/arm64/kernel/debug-monitors.c
++++ b/arch/arm64/kernel/debug-monitors.c
+@@ -136,8 +136,6 @@ void disable_debug_monitors(enum debug_e
+ */
+ static void clear_os_lock(void *unused)
+ {
+- asm volatile("msr mdscr_el1, %0" : : "r" (0));
+- isb();
+ asm volatile("msr oslar_el1, %0" : : "r" (0));
+ isb();
+ }
+--- a/arch/arm64/mm/proc.S
++++ b/arch/arm64/mm/proc.S
+@@ -119,8 +119,7 @@ ENTRY(__cpu_setup)
+
+ mov x0, #3 << 20
+ msr cpacr_el1, x0 // Enable FP/ASIMD
+- mov x0, #1
+- msr oslar_el1, x0 // Set the debug OS lock
++ msr mdscr_el1, xzr // Reset mdscr_el1
+ tlbi vmalle1is // invalidate I + D TLBs
+ /*
+ * Memory region attributes for LPAE:
--- /dev/null
+From b4fed0796841b5293b9c9427a5391b7bb20ef2d9 Mon Sep 17 00:00:00 2001
+From: Sukanto Ghosh <sghosh@apm.com>
+Date: Tue, 14 May 2013 10:26:54 +0100
+Subject: arm64: mm: Fix operands of clz in __flush_dcache_all
+
+From: Sukanto Ghosh <sghosh@apm.com>
+
+commit b4fed0796841b5293b9c9427a5391b7bb20ef2d9 upstream.
+
+The format of the lower 32-bits of the 64-bit operand to 'dc cisw' is
+unchanged from ARMv7 architecture and the upper bits are RES0. This
+implies that the 'way' field of the operand of 'dc cisw' occupies the
+bit-positions [31 .. (32-A)]. Due to the use of 64-bit extended operands
+to 'clz', the existing implementation of __flush_dcache_all is incorrectly
+placing the 'way' field in the bit-positions [63 .. (64-A)].
+
+Signed-off-by: Sukanto Ghosh <sghosh@apm.com>
+Tested-by: Anup Patel <anup.patel@linaro.org>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/mm/cache.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/mm/cache.S
++++ b/arch/arm64/mm/cache.S
+@@ -52,7 +52,7 @@ loop1:
+ add x2, x2, #4 // add 4 (line length offset)
+ mov x4, #0x3ff
+ and x4, x4, x1, lsr #3 // find maximum number on the way size
+- clz x5, x4 // find bit position of way size increment
++ clz w5, w4 // find bit position of way size increment
+ mov x7, #0x7fff
+ and x7, x7, x1, lsr #13 // extract max number of the index size
+ loop2:
--- /dev/null
+From 03b71c6ca6286625d8f1ed44aabab9b5bf5dac10 Mon Sep 17 00:00:00 2001
+From: Gabriel de Perthuis <g2p.code@gmail.com>
+Date: Mon, 6 May 2013 17:40:18 +0000
+Subject: btrfs: don't stop searching after encountering the wrong item
+
+From: Gabriel de Perthuis <g2p.code@gmail.com>
+
+commit 03b71c6ca6286625d8f1ed44aabab9b5bf5dac10 upstream.
+
+The search ioctl skips items that are too large for a result buffer, but
+inline items of a certain size occuring before any search result is
+found would trigger an overflow and stop the search entirely.
+
+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=57641
+
+Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
+Signed-off-by: Josef Bacik <jbacik@fusionio.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/ioctl.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -1796,7 +1796,11 @@ static noinline int copy_to_sk(struct bt
+ item_off = btrfs_item_ptr_offset(leaf, i);
+ item_len = btrfs_item_size_nr(leaf, i);
+
+- if (item_len > BTRFS_SEARCH_ARGS_BUFSIZE)
++ btrfs_item_key_to_cpu(leaf, key, i);
++ if (!key_in_sk(key, sk))
++ continue;
++
++ if (sizeof(sh) + item_len > BTRFS_SEARCH_ARGS_BUFSIZE)
+ item_len = 0;
+
+ if (sizeof(sh) + item_len + *sk_offset >
+@@ -1805,10 +1809,6 @@ static noinline int copy_to_sk(struct bt
+ goto overflow;
+ }
+
+- btrfs_item_key_to_cpu(leaf, key, i);
+- if (!key_in_sk(key, sk))
+- continue;
+-
+ sh.objectid = key->objectid;
+ sh.offset = key->offset;
+ sh.type = key->type;
--- /dev/null
+arm64-debug-clear-mdscr_el1-instead-of-taking-the-os-lock.patch
+arm64-mm-fix-operands-of-clz-in-__flush_dcache_all.patch
+btrfs-don-t-stop-searching-after-encountering-the-wrong-item.patch