1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mm/copypage-feroceon.S
5 * Copyright (C) 2008 Marvell Semiconductors
7 * This handles copy_user_highpage and clear_user_page on Feroceon
8 * more optimally than the generic implementations.
10 #include <linux/init.h>
11 #include <linux/highmem.h>
13 static void feroceon_copy_user_page(void *kto
, const void *kfrom
)
19 1: ldmia %1!, {r2 - r7, ip, lr} \n\
27 stmia %0, {r2 - r7, ip, lr} \n\
28 ldmia %1!, {r2 - r7, ip, lr} \n\
29 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
31 stmia %0, {r2 - r7, ip, lr} \n\
32 ldmia %1!, {r2 - r7, ip, lr} \n\
33 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
35 stmia %0, {r2 - r7, ip, lr} \n\
36 ldmia %1!, {r2 - r7, ip, lr} \n\
37 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
39 stmia %0, {r2 - r7, ip, lr} \n\
40 ldmia %1!, {r2 - r7, ip, lr} \n\
41 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
43 stmia %0, {r2 - r7, ip, lr} \n\
44 ldmia %1!, {r2 - r7, ip, lr} \n\
45 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
47 stmia %0, {r2 - r7, ip, lr} \n\
48 ldmia %1!, {r2 - r7, ip, lr} \n\
49 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
51 stmia %0, {r2 - r7, ip, lr} \n\
52 ldmia %1!, {r2 - r7, ip, lr} \n\
53 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
55 stmia %0, {r2 - r7, ip, lr} \n\
56 subs %2, %2, #(32 * 8) \n\
57 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
60 mcr p15, 0, %2, c7, c10, 4 @ drain WB"
61 : "+&r" (kto
), "+&r" (kfrom
), "=&r" (tmp
)
63 : "r2", "r3", "r4", "r5", "r6", "r7", "ip", "lr");
66 void feroceon_copy_user_highpage(struct page
*to
, struct page
*from
,
67 unsigned long vaddr
, struct vm_area_struct
*vma
)
71 kto
= kmap_atomic(to
);
72 kfrom
= kmap_atomic(from
);
73 flush_cache_page(vma
, vaddr
, page_to_pfn(from
));
74 feroceon_copy_user_page(kto
, kfrom
);
79 void feroceon_clear_user_highpage(struct page
*page
, unsigned long vaddr
)
81 void *ptr
, *kaddr
= kmap_atomic(page
);
92 1: stmia %0, {r2-r7, ip, lr} \n\
94 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
97 mcr p15, 0, r1, c7, c10, 4 @ drain WB"
99 : "0" (kaddr
), "I" (PAGE_SIZE
/ 32)
100 : "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ip", "lr");
101 kunmap_atomic(kaddr
);
104 struct cpu_user_fns feroceon_user_fns __initdata
= {
105 .cpu_clear_user_highpage
= feroceon_clear_user_highpage
,
106 .cpu_copy_user_highpage
= feroceon_copy_user_highpage
,