2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / m m / t l b - v6 . S
*
* Copyright ( C ) 1 9 9 7 - 2 0 0 2 R u s s e l l K i n g
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
*
* ARM a r c h i t e c t u r e v e r s i o n 6 T L B h a n d l i n g f u n c t i o n s .
* These a s s u m e a s p l i t I / D T L B .
* /
2009-04-27 22:02:22 +04:00
# include < l i n u x / i n i t . h >
2005-04-17 02:20:36 +04:00
# include < l i n u x / l i n k a g e . h >
2005-09-09 23:08:59 +04:00
# include < a s m / a s m - o f f s e t s . h >
2014-06-30 19:29:12 +04:00
# include < a s m / a s s e m b l e r . h >
2005-04-17 02:20:36 +04:00
# include < a s m / p a g e . h >
# include < a s m / t l b f l u s h . h >
# include " p r o c - m a c r o s . S "
# define H A R V A R D _ T L B
/ *
* v6 w b i _ f l u s h _ u s e r _ t l b _ r a n g e ( s t a r t , e n d , v m a )
*
* Invalidate a r a n g e o f T L B e n t r i e s i n t h e s p e c i f i e d a d d r e s s s p a c e .
*
* - start - s t a r t a d d r e s s ( m a y n o t b e a l i g n e d )
* - end - e n d a d d r e s s ( e x c l u s i v e , m a y n o t b e a l i g n e d )
* - vma - v m a _ s t r u c t d e s c r i b i n g a d d r e s s r a n g e
*
* It i s a s s u m e d t h a t :
* - the " I n v a l i d a t e s i n g l e e n t r y " i n s t r u c t i o n w i l l i n v a l i d a t e
* both t h e I a n d t h e D T L B s o n H a r v a r d - s t y l e T L B s
* /
ENTRY( v6 w b i _ f l u s h _ u s e r _ t l b _ r a n g e )
vma_ v m _ m m r3 , r2 @ get vma->vm_mm
mov i p , #0
mmid r3 , r3 @ get vm_mm->context.id
mcr p15 , 0 , i p , c7 , c10 , 4 @ drain write buffer
mov r0 , r0 , l s r #P A G E _ S H I F T @ a l i g n a d d r e s s
mov r1 , r1 , l s r #P A G E _ S H I F T
asid r3 , r3 @ mask ASID
orr r0 , r3 , r0 , l s l #P A G E _ S H I F T @ C r e a t e i n i t i a l M V A
mov r1 , r1 , l s l #P A G E _ S H I F T
vma_ v m _ f l a g s r2 , r2 @ get vma->vm_flags
1 :
# ifdef H A R V A R D _ T L B
mcr p15 , 0 , r0 , c8 , c6 , 1 @ TLB invalidate D MVA (was 1)
tst r2 , #V M _ E X E C @ E x e c u t a b l e a r e a ?
mcrne p15 , 0 , r0 , c8 , c5 , 1 @ TLB invalidate I MVA (was 1)
# else
mcr p15 , 0 , r0 , c8 , c7 , 1 @ TLB invalidate MVA (was 1)
# endif
add r0 , r0 , #P A G E _ S Z
cmp r0 , r1
blo 1 b
2007-02-05 16:47:51 +03:00
mcr p15 , 0 , i p , c7 , c10 , 4 @ data synchronization barrier
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
/ *
* v6 w b i _ f l u s h _ k e r n _ t l b _ r a n g e ( s t a r t ,e n d )
*
* Invalidate a r a n g e o f k e r n e l T L B e n t r i e s
*
* - start - s t a r t a d d r e s s ( m a y n o t b e a l i g n e d )
* - end - e n d a d d r e s s ( e x c l u s i v e , m a y n o t b e a l i g n e d )
* /
ENTRY( v6 w b i _ f l u s h _ k e r n _ t l b _ r a n g e )
mov r2 , #0
mcr p15 , 0 , r2 , c7 , c10 , 4 @ drain write buffer
mov r0 , r0 , l s r #P A G E _ S H I F T @ a l i g n a d d r e s s
mov r1 , r1 , l s r #P A G E _ S H I F T
mov r0 , r0 , l s l #P A G E _ S H I F T
mov r1 , r1 , l s l #P A G E _ S H I F T
1 :
# ifdef H A R V A R D _ T L B
mcr p15 , 0 , r0 , c8 , c6 , 1 @ TLB invalidate D MVA
mcr p15 , 0 , r0 , c8 , c5 , 1 @ TLB invalidate I MVA
# else
mcr p15 , 0 , r0 , c8 , c7 , 1 @ TLB invalidate MVA
# endif
add r0 , r0 , #P A G E _ S Z
cmp r0 , r1
blo 1 b
2006-03-07 17:42:27 +03:00
mcr p15 , 0 , r2 , c7 , c10 , 4 @ data synchronization barrier
2011-07-05 12:01:13 +04:00
mcr p15 , 0 , r2 , c7 , c5 , 4 @ prefetch flush (isb)
2014-06-30 19:29:12 +04:00
ret l r
2005-04-17 02:20:36 +04:00
2009-04-27 22:02:22 +04:00
_ _ INIT
2005-04-17 02:20:36 +04:00
2011-06-23 20:31:01 +04:00
/* define struct cpu_tlb_fns (see <asm/tlbflush.h> and proc-macros.S) */
define_ t l b _ f u n c t i o n s v6 w b i , v6 w b i _ t l b _ f l a g s