direct-io.hg

changeset 11514:9bf0fc041e14

[POWERPC][XEN] Inline clear_page() and use DCBZ to optimize

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Thu Sep 14 01:36:39 2006 -0400 (2006-09-14)
parents 3ee3376a5eb3
children 0cdac06f1a9d
files xen/arch/powerpc/mm.c xen/include/asm-powerpc/page.h
line diff
     1.1 --- a/xen/arch/powerpc/mm.c	Thu Sep 14 01:12:26 2006 -0400
     1.2 +++ b/xen/arch/powerpc/mm.c	Thu Sep 14 01:36:39 2006 -0400
     1.3 @@ -209,16 +209,6 @@ long arch_memory_op(int op, XEN_GUEST_HA
     1.4      return -ENOSYS;
     1.5  }
     1.6  
     1.7 -void clear_page(void *page)
     1.8 -{
     1.9 -    if (on_mambo()) {
    1.10 -        extern void *mambo_memset(void *,int ,__kernel_size_t);
    1.11 -        mambo_memset(page, 0, PAGE_SIZE);
    1.12 -    } else {
    1.13 -        memset(page, 0, PAGE_SIZE);
    1.14 -    }
    1.15 -}
    1.16 -
    1.17  extern void copy_page(void *dp, void *sp)
    1.18  {
    1.19      if (on_mambo()) {
     2.1 --- a/xen/include/asm-powerpc/page.h	Thu Sep 14 01:12:26 2006 -0400
     2.2 +++ b/xen/include/asm-powerpc/page.h	Thu Sep 14 01:36:39 2006 -0400
     2.3 @@ -29,6 +29,7 @@
     2.4  
     2.5  #include <xen/config.h>
     2.6  #include <asm/misc.h>
     2.7 +#include <asm/cache.h>
     2.8  
     2.9  #define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
    2.10  #define PFN_UP(x)     (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
    2.11 @@ -70,7 +71,23 @@ typedef struct { unsigned long l1_lo; } 
    2.12  #define pfn_to_paddr(pfn)   ((paddr_t)(pfn) << PAGE_SHIFT)
    2.13  #define paddr_to_pfn(pa)    ((unsigned long)((pa) >> PAGE_SHIFT))
    2.14  
    2.15 -extern void clear_page(void *p);
    2.16 +static __inline__ void clear_page(void *addr)
    2.17 +{
    2.18 +	unsigned long lines, line_size;
    2.19 +
    2.20 +	line_size = cpu_caches.dline_size;
    2.21 +	lines = cpu_caches.dlines_per_page;
    2.22 +
    2.23 +	__asm__ __volatile__(
    2.24 +	"mtctr	%1	# clear_page\n\
    2.25 +1:      dcbz	0,%0\n\
    2.26 +	add	%0,%0,%3\n\
    2.27 +	bdnz+	1b"
    2.28 +    : "=r" (addr)
    2.29 +    : "r" (lines), "0" (addr), "r" (line_size)
    2.30 +	: "ctr", "memory");
    2.31 +}
    2.32 +
    2.33  extern void copy_page(void *dp, void *sp);
    2.34  
    2.35  #define linear_pg_table linear_l1_table