2 * Cache flushing routines.
4 * Copyright (C) 1999-2001, 2005 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
7 * 05/28/05 Zoltan Menyhart Dynamic stride size
10 #include <asm/asmmacro.h>
11 #include <asm/export.h>
15 * flush_icache_range(start,end)
17 * Make i-cache(s) coherent with d-caches.
19 * Must deal with range from start to end-1 but nothing else (need to
20 * be careful not to touch addresses that may be unmapped).
22 * Note: "in0" and "in1" are preserved for debugging purposes.
24 .section .kprobes.text,"ax"
25 GLOBAL_ENTRY(flush_icache_range)
28 alloc r2=ar.pfs,2,0,0,0
29 movl r3=ia64_i_cache_stride_shift
32 ld8 r20=[r3] // r20: stride shift
33 sub r22=in1,r0,1 // last byte address
35 shr.u r23=in0,r20 // start / (stride size)
36 shr.u r22=r22,r20 // (last byte address) / (stride size)
37 shl r21=r21,r20 // r21: stride size of the i-cache(s)
39 sub r8=r22,r23 // number of strides - 1
40 shl r24=r23,r20 // r24: addresses for "fc.i" =
41 // "start" rounded down to stride boundary
43 mov r3=ar.lc // save ar.lc
50 * 32 byte aligned loop, even number of (actually 2) bundles
52 .Loop: fc.i r24 // issuable on M0 only
53 add r24=r21,r24 // we flush "stride size" bytes per iteration
55 br.cloop.sptk.few .Loop
61 mov ar.lc=r3 // restore ar.lc
63 END(flush_icache_range)
64 EXPORT_SYMBOL_GPL(flush_icache_range)
67 * clflush_cache_range(start,size)
69 * Flush cache lines from start to start+size-1.
71 * Must deal with range from start to start+size-1 but nothing else
72 * (need to be careful not to touch addresses that may be
75 * Note: "in0" and "in1" are preserved for debugging purposes.
77 .section .kprobes.text,"ax"
78 GLOBAL_ENTRY(clflush_cache_range)
81 alloc r2=ar.pfs,2,0,0,0
82 movl r3=ia64_cache_stride_shift
86 ld8 r20=[r3] // r20: stride shift
87 sub r22=r22,r0,1 // last byte address
89 shr.u r23=in0,r20 // start / (stride size)
90 shr.u r22=r22,r20 // (last byte address) / (stride size)
91 shl r21=r21,r20 // r21: stride size of the i-cache(s)
93 sub r8=r22,r23 // number of strides - 1
94 shl r24=r23,r20 // r24: addresses for "fc" =
95 // "start" rounded down to stride
98 mov r3=ar.lc // save ar.lc
105 * 32 byte aligned loop, even number of (actually 2) bundles
108 fc r24 // issuable on M0 only
109 add r24=r21,r24 // we flush "stride size" bytes per iteration
111 br.cloop.sptk.few .Loop_fc
117 mov ar.lc=r3 // restore ar.lc
119 END(clflush_cache_range)