]> xenbits.xensource.com Git - xen.git/commitdiff
xen: arm64: optimised clear_page
authorIan Campbell <ian.campbell@citrix.com>
Wed, 19 Mar 2014 17:19:56 +0000 (17:19 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 3 Apr 2014 16:15:44 +0000 (17:15 +0100)
Taken from Linux v3.14-rc7.

The clear_page header now needs to be within the !__ASSEMBLY__

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Julien Grall <julien.grall@linaro.org>
xen/arch/arm/arm64/lib/Makefile
xen/arch/arm/arm64/lib/clear_page.S [new file with mode: 0644]
xen/include/asm-arm/arm32/page.h
xen/include/asm-arm/arm64/page.h
xen/include/asm-arm/page.h

index 9f3b2360b776f59d2fd15b5c567ce28f7093b04d..b895afa00943a85ce2e3d6421e2b70fe5fd00e7c 100644 (file)
@@ -1,3 +1,4 @@
 obj-y += memcpy.o memmove.o memset.o memchr.o
+obj-y += clear_page.o
 obj-y += bitops.o find_next_bit.o
 obj-y += strchr.o strrchr.o
diff --git a/xen/arch/arm/arm64/lib/clear_page.S b/xen/arch/arm/arm64/lib/clear_page.S
new file mode 100644 (file)
index 0000000..8d5cadb
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <xen/config.h>
+
+/*
+ * Clear page @dest
+ *
+ * Parameters:
+ *     x0 - dest
+ */
+ENTRY(clear_page)
+       mrs     x1, dczid_el0
+       and     w1, w1, #0xf
+       mov     x2, #4
+       lsl     x1, x2, x1
+
+1:     dc      zva, x0
+       add     x0, x0, x1
+       tst     x0, #(PAGE_SIZE - 1)
+       b.ne    1b
+       ret
+ENDPROC(clear_page)
index 3f2bdc90a1e9cebeb999542d687879d3c7de69aa..4abb281aae2f68789ee11abd196526ed9a837147 100644 (file)
@@ -108,6 +108,8 @@ static inline uint64_t gva_to_ipa_par(vaddr_t va)
     return par;
 }
 
+#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ARM_ARM32_PAGE_H__ */
index d7ee2fcf293d0c71770348fca55f6bb05ef99ca6..713baf6da1859a666a8f3c1afec6da4677c5947a 100644 (file)
@@ -103,6 +103,8 @@ static inline uint64_t gva_to_ipa_par(vaddr_t va)
     return par;
 }
 
+extern void clear_page(void *to);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ARM_ARM64_PAGE_H__ */
index 877aa2a085d08d7a8237c9fb99e5dbcbd076b973..0c0fd3774dc75296559bb74dd0b7b41276565480 100644 (file)
@@ -420,8 +420,6 @@ static inline int gva_to_ipa(vaddr_t va, paddr_t *paddr)
 #define third_table_offset(va)  TABLE_OFFSET(third_linear_offset(va))
 #define zeroeth_table_offset(va)  TABLE_OFFSET(zeroeth_linear_offset(va))
 
-#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
-
 #define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
 
 #endif /* __ARM_PAGE_H__ */