aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-19 13:51:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-19 13:51:45 -0400
commit92b944170d67fec75ec20e1362fd8ecff078e7d1 (patch)
tree51fa38b11a60b830fac3e2c24c10a61b132e1951 /arch
parentc4222e4635c6d6a689bf69e982f19c9d1ba261e1 (diff)
parente3a920afc3482e954834a4ed95908c4bc5e4c000 (diff)
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas: "These are primarily bug fixes with a performance improvement patch for the GHASH crypto algorithm (which went in during this merging window) and dts/defconfig/Kconfig updates. - ftrace_return_addr() macro fix for arm (introduced earlier via the arm64 tree) - stack alignment exception entry code fix - GHASH crypto algorithm fix and performance improvement - CMA buffer limited to 32-bit (until a better way to describe the system topology in DT) - UAPI sigcontext.h build fix - __kernel_old_{gid,uid}_t definitions fix (affecting 32-bit LTP) - ptrace fixes (kernel fault and 32-bit arm core dump) - pte_mknotpresent() fix - dts updates (APM SoC) - defconfig and Kconfig update" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: mm: remove broken &= operator from pmd_mknotpresent arm64: fix build error in sigcontext.h arm64: dts: Add more serial port nodes in APM X-Gene device tree arm64/dma: Removing ARCH_HAS_DMA_GET_REQUIRED_MASK macro arm64: ptrace: fix empty registers set in prstatus of aarch32 process core arm64: uid16: fix __kernel_old_{gid,uid}_t definitions arm64: ptrace: change fs when passing kernel pointer to regset code arm64: Limit the CMA buffer to 32-bit if ZONE_DMA arm/ftrace: fix ftrace_return_addr() to ftrace_return_address() arm64/crypto: improve performance of GHASH algorithm arm64/crypto: fix data corruption bug in GHASH algorithm arm64: defconfig update for LTP arm64: ftrace: Fix comment typo 'CONFIG_FUNCTION_GRAPH_FP_TEST' arm64: add ARCH_HAS_OPP to allow enabling OPP library arm64: restore alphabetic order in Kconfig arm64: Bug fix in stack alignment exception
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/ftrace.h2
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts4
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi36
-rw-r--r--arch/arm64/configs/defconfig15
-rw-r--r--arch/arm64/crypto/ghash-ce-core.S92
-rw-r--r--arch/arm64/crypto/ghash-ce-glue.c5
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/dma-mapping.h2
-rw-r--r--arch/arm64/include/asm/pgtable.h2
-rw-r--r--arch/arm64/include/uapi/asm/posix_types.h10
-rw-r--r--arch/arm64/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/arm64/kernel/entry-ftrace.S2
-rw-r--r--arch/arm64/kernel/entry.S1
-rw-r--r--arch/arm64/kernel/ptrace.c32
-rw-r--r--arch/arm64/mm/init.c10
16 files changed, 142 insertions, 77 deletions
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index eb577f4f5f70..39eb16b0066f 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -52,7 +52,7 @@ extern inline void *return_address(unsigned int level)
52 52
53#endif 53#endif
54 54
55#define ftrace_return_addr(n) return_address(n) 55#define ftrace_return_address(n) return_address(n)
56 56
57#endif /* ifndef __ASSEMBLY__ */ 57#endif /* ifndef __ASSEMBLY__ */
58 58
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7295419165e1..a474de346be6 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,8 +1,9 @@
1config ARM64 1config ARM64
2 def_bool y 2 def_bool y
3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4 select ARCH_USE_CMPXCHG_LOCKREF 4 select ARCH_HAS_OPP
5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
6 select ARCH_USE_CMPXCHG_LOCKREF
6 select ARCH_WANT_OPTIONAL_GPIOLIB 7 select ARCH_WANT_OPTIONAL_GPIOLIB
7 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 8 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
8 select ARCH_WANT_FRAME_POINTERS 9 select ARCH_WANT_FRAME_POINTERS
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
index 1247ca1200b1..6541962f5d70 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -24,3 +24,7 @@
24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ 24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */
25 }; 25 };
26}; 26};
27
28&serial0 {
29 status = "ok";
30};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index c5f0a47a1375..40aa96ce13c4 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -273,8 +273,9 @@
273 }; 273 };
274 274
275 serial0: serial@1c020000 { 275 serial0: serial@1c020000 {
276 status = "disabled";
276 device_type = "serial"; 277 device_type = "serial";
277 compatible = "ns16550"; 278 compatible = "ns16550a";
278 reg = <0 0x1c020000 0x0 0x1000>; 279 reg = <0 0x1c020000 0x0 0x1000>;
279 reg-shift = <2>; 280 reg-shift = <2>;
280 clock-frequency = <10000000>; /* Updated by bootloader */ 281 clock-frequency = <10000000>; /* Updated by bootloader */
@@ -282,6 +283,39 @@
282 interrupts = <0x0 0x4c 0x4>; 283 interrupts = <0x0 0x4c 0x4>;
283 }; 284 };
284 285
286 serial1: serial@1c021000 {
287 status = "disabled";
288 device_type = "serial";
289 compatible = "ns16550a";
290 reg = <0 0x1c021000 0x0 0x1000>;
291 reg-shift = <2>;
292 clock-frequency = <10000000>; /* Updated by bootloader */
293 interrupt-parent = <&gic>;
294 interrupts = <0x0 0x4d 0x4>;
295 };
296
297 serial2: serial@1c022000 {
298 status = "disabled";
299 device_type = "serial";
300 compatible = "ns16550a";
301 reg = <0 0x1c022000 0x0 0x1000>;
302 reg-shift = <2>;
303 clock-frequency = <10000000>; /* Updated by bootloader */
304 interrupt-parent = <&gic>;
305 interrupts = <0x0 0x4e 0x4>;
306 };
307
308 serial3: serial@1c023000 {
309 status = "disabled";
310 device_type = "serial";
311 compatible = "ns16550a";
312 reg = <0 0x1c023000 0x0 0x1000>;
313 reg-shift = <2>;
314 clock-frequency = <10000000>; /* Updated by bootloader */
315 interrupt-parent = <&gic>;
316 interrupts = <0x0 0x4f 0x4>;
317 };
318
285 phy1: phy@1f21a000 { 319 phy1: phy@1f21a000 {
286 compatible = "apm,xgene-phy"; 320 compatible = "apm,xgene-phy";
287 reg = <0x0 0x1f21a000 0x0 0x100>; 321 reg = <0x0 0x1f21a000 0x0 0x100>;
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 157e1d8d9a47..3421f316f5dc 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -6,9 +6,18 @@ CONFIG_NO_HZ_IDLE=y
6CONFIG_HIGH_RES_TIMERS=y 6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y 7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y 8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_TASKSTATS=y
10CONFIG_TASK_DELAY_ACCT=y
11CONFIG_TASK_XACCT=y
12CONFIG_TASK_IO_ACCOUNTING=y
9CONFIG_IKCONFIG=y 13CONFIG_IKCONFIG=y
10CONFIG_IKCONFIG_PROC=y 14CONFIG_IKCONFIG_PROC=y
11CONFIG_LOG_BUF_SHIFT=14 15CONFIG_LOG_BUF_SHIFT=14
16CONFIG_RESOURCE_COUNTERS=y
17CONFIG_MEMCG=y
18CONFIG_MEMCG_SWAP=y
19CONFIG_MEMCG_KMEM=y
20CONFIG_CGROUP_HUGETLB=y
12# CONFIG_UTS_NS is not set 21# CONFIG_UTS_NS is not set
13# CONFIG_IPC_NS is not set 22# CONFIG_IPC_NS is not set
14# CONFIG_PID_NS is not set 23# CONFIG_PID_NS is not set
@@ -27,6 +36,7 @@ CONFIG_ARCH_VEXPRESS=y
27CONFIG_ARCH_XGENE=y 36CONFIG_ARCH_XGENE=y
28CONFIG_SMP=y 37CONFIG_SMP=y
29CONFIG_PREEMPT=y 38CONFIG_PREEMPT=y
39CONFIG_KSM=y
30CONFIG_TRANSPARENT_HUGEPAGE=y 40CONFIG_TRANSPARENT_HUGEPAGE=y
31CONFIG_CMA=y 41CONFIG_CMA=y
32CONFIG_CMDLINE="console=ttyAMA0" 42CONFIG_CMDLINE="console=ttyAMA0"
@@ -45,6 +55,7 @@ CONFIG_IP_PNP_BOOTP=y
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 55CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46CONFIG_DEVTMPFS=y 56CONFIG_DEVTMPFS=y
47CONFIG_DMA_CMA=y 57CONFIG_DMA_CMA=y
58CONFIG_BLK_DEV_LOOP=y
48CONFIG_VIRTIO_BLK=y 59CONFIG_VIRTIO_BLK=y
49# CONFIG_SCSI_PROC_FS is not set 60# CONFIG_SCSI_PROC_FS is not set
50CONFIG_BLK_DEV_SD=y 61CONFIG_BLK_DEV_SD=y
@@ -53,6 +64,7 @@ CONFIG_ATA=y
53CONFIG_PATA_PLATFORM=y 64CONFIG_PATA_PLATFORM=y
54CONFIG_PATA_OF_PLATFORM=y 65CONFIG_PATA_OF_PLATFORM=y
55CONFIG_NETDEVICES=y 66CONFIG_NETDEVICES=y
67CONFIG_TUN=y
56CONFIG_SMC91X=y 68CONFIG_SMC91X=y
57CONFIG_SMSC911X=y 69CONFIG_SMSC911X=y
58# CONFIG_WLAN is not set 70# CONFIG_WLAN is not set
@@ -85,6 +97,8 @@ CONFIG_EXT3_FS=y
85# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 97# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
86# CONFIG_EXT3_FS_XATTR is not set 98# CONFIG_EXT3_FS_XATTR is not set
87CONFIG_EXT4_FS=y 99CONFIG_EXT4_FS=y
100CONFIG_FANOTIFY=y
101CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
88CONFIG_FUSE_FS=y 102CONFIG_FUSE_FS=y
89CONFIG_CUSE=y 103CONFIG_CUSE=y
90CONFIG_VFAT_FS=y 104CONFIG_VFAT_FS=y
@@ -104,6 +118,7 @@ CONFIG_DEBUG_KERNEL=y
104CONFIG_LOCKUP_DETECTOR=y 118CONFIG_LOCKUP_DETECTOR=y
105# CONFIG_SCHED_DEBUG is not set 119# CONFIG_SCHED_DEBUG is not set
106# CONFIG_FTRACE is not set 120# CONFIG_FTRACE is not set
121CONFIG_SECURITY=y
107CONFIG_CRYPTO_ANSI_CPRNG=y 122CONFIG_CRYPTO_ANSI_CPRNG=y
108CONFIG_ARM64_CRYPTO=y 123CONFIG_ARM64_CRYPTO=y
109CONFIG_CRYPTO_SHA1_ARM64_CE=y 124CONFIG_CRYPTO_SHA1_ARM64_CE=y
diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S
index b9e6eaf41c9b..dc457015884e 100644
--- a/arch/arm64/crypto/ghash-ce-core.S
+++ b/arch/arm64/crypto/ghash-ce-core.S
@@ -3,14 +3,6 @@
3 * 3 *
4 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> 4 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
5 * 5 *
6 * Based on arch/x86/crypto/ghash-pmullni-intel_asm.S
7 *
8 * Copyright (c) 2009 Intel Corp.
9 * Author: Huang Ying <ying.huang@intel.com>
10 * Vinodh Gopal
11 * Erdinc Ozturk
12 * Deniz Karakoyunlu
13 *
14 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
16 * by the Free Software Foundation. 8 * by the Free Software Foundation.
@@ -19,13 +11,15 @@
19#include <linux/linkage.h> 11#include <linux/linkage.h>
20#include <asm/assembler.h> 12#include <asm/assembler.h>
21 13
22 DATA .req v0 14 SHASH .req v0
23 SHASH .req v1 15 SHASH2 .req v1
24 IN1 .req v2
25 T1 .req v2 16 T1 .req v2
26 T2 .req v3 17 T2 .req v3
27 T3 .req v4 18 MASK .req v4
28 VZR .req v5 19 XL .req v5
20 XM .req v6
21 XH .req v7
22 IN1 .req v7
29 23
30 .text 24 .text
31 .arch armv8-a+crypto 25 .arch armv8-a+crypto
@@ -35,61 +29,51 @@
35 * struct ghash_key const *k, const char *head) 29 * struct ghash_key const *k, const char *head)
36 */ 30 */
37ENTRY(pmull_ghash_update) 31ENTRY(pmull_ghash_update)
38 ld1 {DATA.16b}, [x1]
39 ld1 {SHASH.16b}, [x3] 32 ld1 {SHASH.16b}, [x3]
40 eor VZR.16b, VZR.16b, VZR.16b 33 ld1 {XL.16b}, [x1]
34 movi MASK.16b, #0xe1
35 ext SHASH2.16b, SHASH.16b, SHASH.16b, #8
36 shl MASK.2d, MASK.2d, #57
37 eor SHASH2.16b, SHASH2.16b, SHASH.16b
41 38
42 /* do the head block first, if supplied */ 39 /* do the head block first, if supplied */
43 cbz x4, 0f 40 cbz x4, 0f
44 ld1 {IN1.2d}, [x4] 41 ld1 {T1.2d}, [x4]
45 b 1f 42 b 1f
46 43
470: ld1 {IN1.2d}, [x2], #16 440: ld1 {T1.2d}, [x2], #16
48 sub w0, w0, #1 45 sub w0, w0, #1
491: ext IN1.16b, IN1.16b, IN1.16b, #8
50CPU_LE( rev64 IN1.16b, IN1.16b )
51 eor DATA.16b, DATA.16b, IN1.16b
52 46
53 /* multiply DATA by SHASH in GF(2^128) */ 471: /* multiply XL by SHASH in GF(2^128) */
54 ext T2.16b, DATA.16b, DATA.16b, #8 48CPU_LE( rev64 T1.16b, T1.16b )
55 ext T3.16b, SHASH.16b, SHASH.16b, #8
56 eor T2.16b, T2.16b, DATA.16b
57 eor T3.16b, T3.16b, SHASH.16b
58 49
59 pmull2 T1.1q, SHASH.2d, DATA.2d // a1 * b1 50 ext T2.16b, XL.16b, XL.16b, #8
60 pmull DATA.1q, SHASH.1d, DATA.1d // a0 * b0 51 ext IN1.16b, T1.16b, T1.16b, #8
61 pmull T2.1q, T2.1d, T3.1d // (a1 + a0)(b1 + b0) 52 eor T1.16b, T1.16b, T2.16b
62 eor T2.16b, T2.16b, T1.16b // (a0 * b1) + (a1 * b0) 53 eor XL.16b, XL.16b, IN1.16b
63 eor T2.16b, T2.16b, DATA.16b
64 54
65 ext T3.16b, VZR.16b, T2.16b, #8 55 pmull2 XH.1q, SHASH.2d, XL.2d // a1 * b1
66 ext T2.16b, T2.16b, VZR.16b, #8 56 eor T1.16b, T1.16b, XL.16b
67 eor DATA.16b, DATA.16b, T3.16b 57 pmull XL.1q, SHASH.1d, XL.1d // a0 * b0
68 eor T1.16b, T1.16b, T2.16b // <T1:DATA> is result of 58 pmull XM.1q, SHASH2.1d, T1.1d // (a1 + a0)(b1 + b0)
69 // carry-less multiplication
70 59
71 /* first phase of the reduction */ 60 ext T1.16b, XL.16b, XH.16b, #8
72 shl T3.2d, DATA.2d, #1 61 eor T2.16b, XL.16b, XH.16b
73 eor T3.16b, T3.16b, DATA.16b 62 eor XM.16b, XM.16b, T1.16b
74 shl T3.2d, T3.2d, #5 63 eor XM.16b, XM.16b, T2.16b
75 eor T3.16b, T3.16b, DATA.16b 64 pmull T2.1q, XL.1d, MASK.1d
76 shl T3.2d, T3.2d, #57
77 ext T2.16b, VZR.16b, T3.16b, #8
78 ext T3.16b, T3.16b, VZR.16b, #8
79 eor DATA.16b, DATA.16b, T2.16b
80 eor T1.16b, T1.16b, T3.16b
81 65
82 /* second phase of the reduction */ 66 mov XH.d[0], XM.d[1]
83 ushr T2.2d, DATA.2d, #5 67 mov XM.d[1], XL.d[0]
84 eor T2.16b, T2.16b, DATA.16b 68
85 ushr T2.2d, T2.2d, #1 69 eor XL.16b, XM.16b, T2.16b
86 eor T2.16b, T2.16b, DATA.16b 70 ext T2.16b, XL.16b, XL.16b, #8
87 ushr T2.2d, T2.2d, #1 71 pmull XL.1q, XL.1d, MASK.1d
88 eor T1.16b, T1.16b, T2.16b 72 eor T2.16b, T2.16b, XH.16b
89 eor DATA.16b, DATA.16b, T1.16b 73 eor XL.16b, XL.16b, T2.16b
90 74
91 cbnz w0, 0b 75 cbnz w0, 0b
92 76
93 st1 {DATA.16b}, [x1] 77 st1 {XL.16b}, [x1]
94 ret 78 ret
95ENDPROC(pmull_ghash_update) 79ENDPROC(pmull_ghash_update)
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index b92baf3f68c7..833ec1e3f3e9 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -67,11 +67,12 @@ static int ghash_update(struct shash_desc *desc, const u8 *src,
67 blocks = len / GHASH_BLOCK_SIZE; 67 blocks = len / GHASH_BLOCK_SIZE;
68 len %= GHASH_BLOCK_SIZE; 68 len %= GHASH_BLOCK_SIZE;
69 69
70 kernel_neon_begin_partial(6); 70 kernel_neon_begin_partial(8);
71 pmull_ghash_update(blocks, ctx->digest, src, key, 71 pmull_ghash_update(blocks, ctx->digest, src, key,
72 partial ? ctx->buf : NULL); 72 partial ? ctx->buf : NULL);
73 kernel_neon_end(); 73 kernel_neon_end();
74 src += blocks * GHASH_BLOCK_SIZE; 74 src += blocks * GHASH_BLOCK_SIZE;
75 partial = 0;
75 } 76 }
76 if (len) 77 if (len)
77 memcpy(ctx->buf + partial, src, len); 78 memcpy(ctx->buf + partial, src, len);
@@ -88,7 +89,7 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)
88 89
89 memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial); 90 memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial);
90 91
91 kernel_neon_begin_partial(6); 92 kernel_neon_begin_partial(8);
92 pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL); 93 pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL);
93 kernel_neon_end(); 94 kernel_neon_end();
94 } 95 }
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 42c7eecd2bb6..0b3fcf86e6ba 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -30,7 +30,6 @@ generic-y += msgbuf.h
30generic-y += mutex.h 30generic-y += mutex.h
31generic-y += pci.h 31generic-y += pci.h
32generic-y += poll.h 32generic-y += poll.h
33generic-y += posix_types.h
34generic-y += preempt.h 33generic-y += preempt.h
35generic-y += resource.h 34generic-y += resource.h
36generic-y += rwsem.h 35generic-y += rwsem.h
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 3a4572ec3273..dc82e52acdb3 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -26,8 +26,6 @@
26#include <xen/xen.h> 26#include <xen/xen.h>
27#include <asm/xen/hypervisor.h> 27#include <asm/xen/hypervisor.h>
28 28
29#define ARCH_HAS_DMA_GET_REQUIRED_MASK
30
31#define DMA_ERROR_CODE (~(dma_addr_t)0) 29#define DMA_ERROR_CODE (~(dma_addr_t)0)
32extern struct dma_map_ops *dma_ops; 30extern struct dma_map_ops *dma_ops;
33extern struct dma_map_ops coherent_swiotlb_dma_ops; 31extern struct dma_map_ops coherent_swiotlb_dma_ops;
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 598cc384fc1c..579702086488 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -246,7 +246,7 @@ static inline pmd_t pte_pmd(pte_t pte)
246#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) 246#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
247#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) 247#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
248#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd))) 248#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
249#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) &= ~PMD_TYPE_MASK)) 249#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) & ~PMD_TYPE_MASK))
250 250
251#define __HAVE_ARCH_PMD_WRITE 251#define __HAVE_ARCH_PMD_WRITE
252#define pmd_write(pmd) pte_write(pmd_pte(pmd)) 252#define pmd_write(pmd) pte_write(pmd_pte(pmd))
diff --git a/arch/arm64/include/uapi/asm/posix_types.h b/arch/arm64/include/uapi/asm/posix_types.h
new file mode 100644
index 000000000000..7985ff60ca3f
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/posix_types.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_POSIX_TYPES_H
2#define __ASM_POSIX_TYPES_H
3
4typedef unsigned short __kernel_old_uid_t;
5typedef unsigned short __kernel_old_gid_t;
6#define __kernel_old_uid_t __kernel_old_uid_t
7
8#include <asm-generic/posix_types.h>
9
10#endif /* __ASM_POSIX_TYPES_H */
diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index b72cf405b3fe..ee469be1ae1d 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -58,7 +58,7 @@ struct fpsimd_context {
58 58
59struct esr_context { 59struct esr_context {
60 struct _aarch64_ctx head; 60 struct _aarch64_ctx head;
61 u64 esr; 61 __u64 esr;
62}; 62};
63 63
64#endif /* _UAPI__ASM_SIGCONTEXT_H */ 64#endif /* _UAPI__ASM_SIGCONTEXT_H */
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index b051871f2965..aa5f9fcbf9ee 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -205,7 +205,7 @@ ENDPROC(ftrace_graph_caller)
205 * 205 *
206 * Run ftrace_return_to_handler() before going back to parent. 206 * Run ftrace_return_to_handler() before going back to parent.
207 * @fp is checked against the value passed by ftrace_graph_caller() 207 * @fp is checked against the value passed by ftrace_graph_caller()
208 * only when CONFIG_FUNCTION_GRAPH_FP_TEST is enabled. 208 * only when CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST is enabled.
209 */ 209 */
210ENTRY(return_to_handler) 210ENTRY(return_to_handler)
211 str x0, [sp, #-16]! 211 str x0, [sp, #-16]!
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index bf017f4ffb4f..9ce04ba6bcb0 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -279,7 +279,6 @@ el1_sp_pc:
279 */ 279 */
280 mrs x0, far_el1 280 mrs x0, far_el1
281 enable_dbg 281 enable_dbg
282 mov x1, x25
283 mov x2, sp 282 mov x2, sp
284 b do_sp_pc_abort 283 b do_sp_pc_abort
285el1_undef: 284el1_undef:
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 3e926b9c0641..9fde010c945f 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -655,11 +655,16 @@ static int compat_gpr_get(struct task_struct *target,
655 reg = task_pt_regs(target)->regs[idx]; 655 reg = task_pt_regs(target)->regs[idx];
656 } 656 }
657 657
658 ret = copy_to_user(ubuf, &reg, sizeof(reg)); 658 if (kbuf) {
659 if (ret) 659 memcpy(kbuf, &reg, sizeof(reg));
660 break; 660 kbuf += sizeof(reg);
661 661 } else {
662 ubuf += sizeof(reg); 662 ret = copy_to_user(ubuf, &reg, sizeof(reg));
663 if (ret)
664 break;
665
666 ubuf += sizeof(reg);
667 }
663 } 668 }
664 669
665 return ret; 670 return ret;
@@ -689,11 +694,16 @@ static int compat_gpr_set(struct task_struct *target,
689 unsigned int idx = start + i; 694 unsigned int idx = start + i;
690 compat_ulong_t reg; 695 compat_ulong_t reg;
691 696
692 ret = copy_from_user(&reg, ubuf, sizeof(reg)); 697 if (kbuf) {
693 if (ret) 698 memcpy(&reg, kbuf, sizeof(reg));
694 return ret; 699 kbuf += sizeof(reg);
700 } else {
701 ret = copy_from_user(&reg, ubuf, sizeof(reg));
702 if (ret)
703 return ret;
695 704
696 ubuf += sizeof(reg); 705 ubuf += sizeof(reg);
706 }
697 707
698 switch (idx) { 708 switch (idx) {
699 case 15: 709 case 15:
@@ -827,6 +837,7 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
827 compat_ulong_t val) 837 compat_ulong_t val)
828{ 838{
829 int ret; 839 int ret;
840 mm_segment_t old_fs = get_fs();
830 841
831 if (off & 3 || off >= COMPAT_USER_SZ) 842 if (off & 3 || off >= COMPAT_USER_SZ)
832 return -EIO; 843 return -EIO;
@@ -834,10 +845,13 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
834 if (off >= sizeof(compat_elf_gregset_t)) 845 if (off >= sizeof(compat_elf_gregset_t))
835 return 0; 846 return 0;
836 847
848 set_fs(KERNEL_DS);
837 ret = copy_regset_from_user(tsk, &user_aarch32_view, 849 ret = copy_regset_from_user(tsk, &user_aarch32_view,
838 REGSET_COMPAT_GPR, off, 850 REGSET_COMPAT_GPR, off,
839 sizeof(compat_ulong_t), 851 sizeof(compat_ulong_t),
840 &val); 852 &val);
853 set_fs(old_fs);
854
841 return ret; 855 return ret;
842} 856}
843 857
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 091d428d64ac..f43db8a69262 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -71,7 +71,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
71 /* 4GB maximum for 32-bit only capable devices */ 71 /* 4GB maximum for 32-bit only capable devices */
72 if (IS_ENABLED(CONFIG_ZONE_DMA)) { 72 if (IS_ENABLED(CONFIG_ZONE_DMA)) {
73 unsigned long max_dma_phys = 73 unsigned long max_dma_phys =
74 (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1); 74 (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1);
75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); 75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
76 zone_size[ZONE_DMA] = max_dma - min; 76 zone_size[ZONE_DMA] = max_dma - min;
77 } 77 }
@@ -126,6 +126,8 @@ static void arm64_memory_present(void)
126 126
127void __init arm64_memblock_init(void) 127void __init arm64_memblock_init(void)
128{ 128{
129 phys_addr_t dma_phys_limit = 0;
130
129 /* Register the kernel text, kernel data and initrd with memblock */ 131 /* Register the kernel text, kernel data and initrd with memblock */
130 memblock_reserve(__pa(_text), _end - _text); 132 memblock_reserve(__pa(_text), _end - _text);
131#ifdef CONFIG_BLK_DEV_INITRD 133#ifdef CONFIG_BLK_DEV_INITRD
@@ -141,7 +143,11 @@ void __init arm64_memblock_init(void)
141 memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); 143 memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE);
142 144
143 early_init_fdt_scan_reserved_mem(); 145 early_init_fdt_scan_reserved_mem();
144 dma_contiguous_reserve(0); 146
147 /* 4GB maximum for 32-bit only capable devices */
148 if (IS_ENABLED(CONFIG_ZONE_DMA))
149 dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1;
150 dma_contiguous_reserve(dma_phys_limit);
145 151
146 memblock_allow_resize(); 152 memblock_allow_resize();
147 memblock_dump_all(); 153 memblock_dump_all();