Commit 43ae286b authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Russell King

[ARM] fix a couple clear_user_highpage assembly constraints

In all cases the kaddr is assigned an input register even though it is
modified in the assembly code.  Let's assign a new variable to the
modified value and mark those inline asm with volatile otherwise they
get optimized away because the output variable is otherwise not used.

Also fix a few conversion errors in copypage-feroceon.c and
copypage-v4mc.c.
Signed-off-by: default avatarNicolas Pitre <nico@marvell.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 303c6443
...@@ -81,9 +81,9 @@ void feroceon_copy_user_highpage(struct page *to, struct page *from, ...@@ -81,9 +81,9 @@ void feroceon_copy_user_highpage(struct page *to, struct page *from,
void feroceon_clear_user_highpage(struct page *page, unsigned long vaddr) void feroceon_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm("\ asm volatile ("\
mov r1, %1 \n\ mov r1, %2 \n\
mov r2, #0 \n\ mov r2, #0 \n\
mov r3, #0 \n\ mov r3, #0 \n\
mov r4, #0 \n\ mov r4, #0 \n\
...@@ -95,11 +95,11 @@ void feroceon_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -95,11 +95,11 @@ void feroceon_clear_user_highpage(struct page *page, unsigned long vaddr)
1: stmia %0, {r2-r7, ip, lr} \n\ 1: stmia %0, {r2-r7, ip, lr} \n\
subs r1, r1, #1 \n\ subs r1, r1, #1 \n\
mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\ mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
add r0, r0, #32 \n\ add %0, %0, #32 \n\
bne 1b \n\ bne 1b \n\
mcr p15, 0, r1, c7, c10, 4 @ drain WB" mcr p15, 0, r1, c7, c10, 4 @ drain WB"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 32) : "0" (kaddr), "I" (PAGE_SIZE / 32)
: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ip", "lr"); : "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ip", "lr");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
...@@ -56,9 +56,9 @@ void v3_copy_user_highpage(struct page *to, struct page *from, ...@@ -56,9 +56,9 @@ void v3_copy_user_highpage(struct page *to, struct page *from,
*/ */
void v3_clear_user_highpage(struct page *page, unsigned long vaddr) void v3_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm("\n\ asm volatile("\n\
mov r1, %1 @ 1\n\ mov r1, %2 @ 1\n\
mov r2, #0 @ 1\n\ mov r2, #0 @ 1\n\
mov r3, #0 @ 1\n\ mov r3, #0 @ 1\n\
mov ip, #0 @ 1\n\ mov ip, #0 @ 1\n\
...@@ -69,8 +69,8 @@ void v3_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -69,8 +69,8 @@ void v3_clear_user_highpage(struct page *page, unsigned long vaddr)
stmia %0!, {r2, r3, ip, lr} @ 4\n\ stmia %0!, {r2, r3, ip, lr} @ 4\n\
subs r1, r1, #1 @ 1\n\ subs r1, r1, #1 @ 1\n\
bne 1b @ 1" bne 1b @ 1"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 64) : "0" (kaddr), "I" (PAGE_SIZE / 64)
: "r1", "r2", "r3", "ip", "lr"); : "r1", "r2", "r3", "ip", "lr");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
...@@ -93,9 +93,9 @@ void v4_mc_copy_user_highpage(struct page *from, struct page *to, ...@@ -93,9 +93,9 @@ void v4_mc_copy_user_highpage(struct page *from, struct page *to,
*/ */
void v4_mc_clear_user_highpage(struct page *page, unsigned long vaddr) void v4_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm volatile("\ asm volatile("\
mov r1, %0 @ 1\n\ mov r1, %2 @ 1\n\
mov r2, #0 @ 1\n\ mov r2, #0 @ 1\n\
mov r3, #0 @ 1\n\ mov r3, #0 @ 1\n\
mov ip, #0 @ 1\n\ mov ip, #0 @ 1\n\
...@@ -108,8 +108,8 @@ void v4_mc_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -108,8 +108,8 @@ void v4_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
stmia %0!, {r2, r3, ip, lr} @ 4\n\ stmia %0!, {r2, r3, ip, lr} @ 4\n\
subs r1, r1, #1 @ 1\n\ subs r1, r1, #1 @ 1\n\
bne 1b @ 1" bne 1b @ 1"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 64) : "0" (kaddr), "I" (PAGE_SIZE / 64)
: "r1", "r2", "r3", "ip", "lr"); : "r1", "r2", "r3", "ip", "lr");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
...@@ -66,9 +66,9 @@ void v4wb_copy_user_highpage(struct page *to, struct page *from, ...@@ -66,9 +66,9 @@ void v4wb_copy_user_highpage(struct page *to, struct page *from,
*/ */
void v4wb_clear_user_highpage(struct page *page, unsigned long vaddr) void v4wb_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm("\ asm volatile("\
mov r1, %1 @ 1\n\ mov r1, %2 @ 1\n\
mov r2, #0 @ 1\n\ mov r2, #0 @ 1\n\
mov r3, #0 @ 1\n\ mov r3, #0 @ 1\n\
mov ip, #0 @ 1\n\ mov ip, #0 @ 1\n\
...@@ -82,8 +82,8 @@ void v4wb_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -82,8 +82,8 @@ void v4wb_clear_user_highpage(struct page *page, unsigned long vaddr)
subs r1, r1, #1 @ 1\n\ subs r1, r1, #1 @ 1\n\
bne 1b @ 1\n\ bne 1b @ 1\n\
mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB" mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 64) : "0" (kaddr), "I" (PAGE_SIZE / 64)
: "r1", "r2", "r3", "ip", "lr"); : "r1", "r2", "r3", "ip", "lr");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
...@@ -62,9 +62,9 @@ void v4wt_copy_user_highpage(struct page *to, struct page *from, ...@@ -62,9 +62,9 @@ void v4wt_copy_user_highpage(struct page *to, struct page *from,
*/ */
void v4wt_clear_user_highpage(struct page *page, unsigned long vaddr) void v4wt_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm("\ asm volatile("\
mov r1, %1 @ 1\n\ mov r1, %2 @ 1\n\
mov r2, #0 @ 1\n\ mov r2, #0 @ 1\n\
mov r3, #0 @ 1\n\ mov r3, #0 @ 1\n\
mov ip, #0 @ 1\n\ mov ip, #0 @ 1\n\
...@@ -76,8 +76,8 @@ void v4wt_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -76,8 +76,8 @@ void v4wt_clear_user_highpage(struct page *page, unsigned long vaddr)
subs r1, r1, #1 @ 1\n\ subs r1, r1, #1 @ 1\n\
bne 1b @ 1\n\ bne 1b @ 1\n\
mcr p15, 0, r2, c7, c7, 0 @ flush ID cache" mcr p15, 0, r2, c7, c7, 0 @ flush ID cache"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 64) : "0" (kaddr), "I" (PAGE_SIZE / 64)
: "r1", "r2", "r3", "ip", "lr"); : "r1", "r2", "r3", "ip", "lr");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
...@@ -89,9 +89,9 @@ void xsc3_mc_copy_user_highpage(struct page *to, struct page *from, ...@@ -89,9 +89,9 @@ void xsc3_mc_copy_user_highpage(struct page *to, struct page *from,
*/ */
void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr) void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm("\ asm volatile ("\
mov r1, %1 \n\ mov r1, %2 \n\
mov r2, #0 \n\ mov r2, #0 \n\
mov r3, #0 \n\ mov r3, #0 \n\
1: mcr p15, 0, %0, c7, c6, 1 @ invalidate line\n\ 1: mcr p15, 0, %0, c7, c6, 1 @ invalidate line\n\
...@@ -101,8 +101,8 @@ void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -101,8 +101,8 @@ void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
strd r2, [%0], #8 \n\ strd r2, [%0], #8 \n\
subs r1, r1, #1 \n\ subs r1, r1, #1 \n\
bne 1b" bne 1b"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 32) : "0" (kaddr), "I" (PAGE_SIZE / 32)
: "r1", "r2", "r3"); : "r1", "r2", "r3");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
...@@ -116,9 +116,9 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from, ...@@ -116,9 +116,9 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from,
void void
xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr) xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
{ {
void *kaddr = kmap_atomic(page, KM_USER0); void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
asm volatile( asm volatile(
"mov r1, %1 \n\ "mov r1, %2 \n\
mov r2, #0 \n\ mov r2, #0 \n\
mov r3, #0 \n\ mov r3, #0 \n\
1: mov ip, %0 \n\ 1: mov ip, %0 \n\
...@@ -130,8 +130,8 @@ xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr) ...@@ -130,8 +130,8 @@ xscale_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
subs r1, r1, #1 \n\ subs r1, r1, #1 \n\
mcr p15, 0, ip, c7, c6, 1 @ invalidate D line\n\ mcr p15, 0, ip, c7, c6, 1 @ invalidate D line\n\
bne 1b" bne 1b"
: : "=r" (ptr)
: "r" (kaddr), "I" (PAGE_SIZE / 32) : "0" (kaddr), "I" (PAGE_SIZE / 32)
: "r1", "r2", "r3", "ip"); : "r1", "r2", "r3", "ip");
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment