# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID f4f153f9960314768307e34700be96139b5faa71
# Parent e4698a2378a548a4759e0f1f29febc7a706d2364
[POWERPC][XEN] Inline clear_page() and use DCBZ to optimize
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
xen/arch/powerpc/mm.c | 10 ----------
xen/include/asm-powerpc/page.h | 19 ++++++++++++++++++-
2 files changed, 18 insertions(+), 11 deletions(-)
diff -r e4698a2378a5 -r f4f153f99603 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Thu Sep 14 01:12:26 2006 -0400
+++ b/xen/arch/powerpc/mm.c Thu Sep 14 01:36:39 2006 -0400
@@ -207,16 +207,6 @@ long arch_memory_op(int op, XEN_GUEST_HA
{
printk("%s: no PPC specific memory ops\n", __func__);
return -ENOSYS;
-}
-
-void clear_page(void *page)
-{
- if (on_mambo()) {
- extern void *mambo_memset(void *,int ,__kernel_size_t);
- mambo_memset(page, 0, PAGE_SIZE);
- } else {
- memset(page, 0, PAGE_SIZE);
- }
}
extern void copy_page(void *dp, void *sp)
diff -r e4698a2378a5 -r f4f153f99603 xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.h Thu Sep 14 01:12:26 2006 -0400
+++ b/xen/include/asm-powerpc/page.h Thu Sep 14 01:36:39 2006 -0400
@@ -29,6 +29,7 @@
#include <xen/config.h>
#include <asm/misc.h>
+#include <asm/cache.h>
#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
@@ -70,7 +71,23 @@ typedef struct { unsigned long l1_lo; }
#define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
#define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT))
-extern void clear_page(void *p);
+static __inline__ void clear_page(void *addr)
+{
+ unsigned long lines, line_size;
+
+ line_size = cpu_caches.dline_size;
+ lines = cpu_caches.dlines_per_page;
+
+ __asm__ __volatile__(
+ "mtctr %1 # clear_page\n\
+1: dcbz 0,%0\n\
+ add %0,%0,%3\n\
+ bdnz+ 1b"
+ : "=r" (addr)
+ : "r" (lines), "0" (addr), "r" (line_size)
+ : "ctr", "memory");
+}
+
extern void copy_page(void *dp, void *sp);
#define linear_pg_table linear_l1_table
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|