diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 21:47:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 21:47:06 -0400 |
commit | 1b246d224e27c62bfd0d658c44cc4374061d956d (patch) | |
tree | 1032919a4c60b958a6179e3d5980a961b3bd1f42 | |
parent | 5cef8c2a2289117b7f65de4313b7157578ec1a71 (diff) | |
parent | 6469a0ee0a06b2ea1f5afbb1d5a3feed017d4c7a (diff) |
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm updates from Ingo Molnar:
- better support (non-atomic) 64-bit readq()/writeq() variants (Andy
Shevchenko)
- __clear_user() micro-optimization (Alexey Dobriyan)
* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/io: Define readq()/writeq() to use 64-bit type
x86/asm/64: Micro-optimize __clear_user() - Use immediate constants
-rw-r--r-- | arch/x86/include/asm/io.h | 8 | ||||
-rw-r--r-- | arch/x86/lib/usercopy_64.c | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index f6e5b9375d8c..6de64840dd22 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -94,10 +94,10 @@ build_mmio_write(__writel, "l", unsigned int, "r", ) | |||
94 | 94 | ||
95 | #ifdef CONFIG_X86_64 | 95 | #ifdef CONFIG_X86_64 |
96 | 96 | ||
97 | build_mmio_read(readq, "q", unsigned long, "=r", :"memory") | 97 | build_mmio_read(readq, "q", u64, "=r", :"memory") |
98 | build_mmio_read(__readq, "q", unsigned long, "=r", ) | 98 | build_mmio_read(__readq, "q", u64, "=r", ) |
99 | build_mmio_write(writeq, "q", unsigned long, "r", :"memory") | 99 | build_mmio_write(writeq, "q", u64, "r", :"memory") |
100 | build_mmio_write(__writeq, "q", unsigned long, "r", ) | 100 | build_mmio_write(__writeq, "q", u64, "r", ) |
101 | 101 | ||
102 | #define readq_relaxed(a) __readq(a) | 102 | #define readq_relaxed(a) __readq(a) |
103 | #define writeq_relaxed(v, a) __writeq(v, a) | 103 | #define writeq_relaxed(v, a) __writeq(v, a) |
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index 75d3776123cc..a624dcc4de10 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c | |||
@@ -23,13 +23,13 @@ unsigned long __clear_user(void __user *addr, unsigned long size) | |||
23 | asm volatile( | 23 | asm volatile( |
24 | " testq %[size8],%[size8]\n" | 24 | " testq %[size8],%[size8]\n" |
25 | " jz 4f\n" | 25 | " jz 4f\n" |
26 | "0: movq %[zero],(%[dst])\n" | 26 | "0: movq $0,(%[dst])\n" |
27 | " addq %[eight],%[dst]\n" | 27 | " addq $8,%[dst]\n" |
28 | " decl %%ecx ; jnz 0b\n" | 28 | " decl %%ecx ; jnz 0b\n" |
29 | "4: movq %[size1],%%rcx\n" | 29 | "4: movq %[size1],%%rcx\n" |
30 | " testl %%ecx,%%ecx\n" | 30 | " testl %%ecx,%%ecx\n" |
31 | " jz 2f\n" | 31 | " jz 2f\n" |
32 | "1: movb %b[zero],(%[dst])\n" | 32 | "1: movb $0,(%[dst])\n" |
33 | " incq %[dst]\n" | 33 | " incq %[dst]\n" |
34 | " decl %%ecx ; jnz 1b\n" | 34 | " decl %%ecx ; jnz 1b\n" |
35 | "2:\n" | 35 | "2:\n" |
@@ -40,8 +40,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size) | |||
40 | _ASM_EXTABLE(0b,3b) | 40 | _ASM_EXTABLE(0b,3b) |
41 | _ASM_EXTABLE(1b,2b) | 41 | _ASM_EXTABLE(1b,2b) |
42 | : [size8] "=&c"(size), [dst] "=&D" (__d0) | 42 | : [size8] "=&c"(size), [dst] "=&D" (__d0) |
43 | : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr), | 43 | : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr)); |
44 | [zero] "r" (0UL), [eight] "r" (8UL)); | ||
45 | clac(); | 44 | clac(); |
46 | return size; | 45 | return size; |
47 | } | 46 | } |