2019-05-27 08:55:01 +02:00
/* SPDX-License-Identifier: GPL-2.0-or-later */
2005-04-16 15:20:36 -07:00
/ *
* vDSO p r o v i d e d c a c h e f l u s h r o u t i n e s
*
* Copyright ( C ) 2 0 0 4 B e n j a m i n H e r r e n s c h m u i d t ( b e n h @kernel.crashing.org),
* IBM C o r p .
* /
# include < a s m / p r o c e s s o r . h >
# include < a s m / p p c _ a s m . h >
# include < a s m / v d s o . h >
2019-12-02 07:57:30 +00:00
# include < a s m / v d s o _ d a t a p a g e . h >
2005-09-09 20:57:26 +02:00
# include < a s m / a s m - o f f s e t s . h >
2019-12-02 07:57:31 +00:00
# include < a s m / c a c h e . h >
2005-04-16 15:20:36 -07:00
.text
/ *
* Default " g e n e r i c " v e r s i o n o f _ _ k e r n e l _ s y n c _ d i c a c h e .
*
* void _ _ k e r n e l _ s y n c _ d i c a c h e ( u n s i g n e d l o n g s t a r t , u n s i g n e d l o n g e n d )
*
* Flushes t h e d a t a c a c h e & i n v a l i d a t e t h e i n s t r u c t i o n c a c h e f o r t h e
* provided r a n g e [ s t a r t , e n d [
* /
V_ F U N C T I O N _ B E G I N ( _ _ k e r n e l _ s y n c _ d i c a c h e )
.cfi_startproc
2020-09-27 09:16:35 +00:00
BEGIN_ F T R _ S E C T I O N
b 3 f
END_ F T R _ S E C T I O N _ I F S E T ( C P U _ F T R _ C O H E R E N T _ I C A C H E )
2019-12-02 07:57:31 +00:00
# ifdef C O N F I G _ P P C 6 4
2007-11-20 12:24:45 +11:00
mflr r12
.cfi_register lr,r12
2020-09-27 09:16:32 +00:00
get_ d a t a p a g e r10
2007-11-20 12:24:45 +11:00
mtlr r12
2020-09-27 09:16:35 +00:00
.cfi_restore lr
2019-12-02 07:57:31 +00:00
# endif
2007-11-20 12:24:45 +11:00
2019-12-02 07:57:31 +00:00
# ifdef C O N F I G _ P P C 6 4
2007-11-20 12:24:45 +11:00
lwz r7 ,C F G _ D C A C H E _ B L O C K S Z ( r10 )
addi r5 ,r7 ,- 1
2019-12-02 07:57:31 +00:00
# else
li r5 , L 1 _ C A C H E _ B Y T E S - 1
# endif
2019-12-02 07:57:30 +00:00
andc r6 ,r3 ,r5 / * r o u n d l o w t o l i n e b d y * /
2005-04-16 15:20:36 -07:00
subf r8 ,r6 ,r4 / * c o m p u t e l e n g t h * /
add r8 ,r8 ,r5 / * e n s u r e w e g e t e n o u g h * /
2019-12-02 07:57:31 +00:00
# ifdef C O N F I G _ P P C 6 4
2007-11-20 12:24:45 +11:00
lwz r9 ,C F G _ D C A C H E _ L O G B L O C K S Z ( r10 )
srw. r8 ,r8 ,r9 / * c o m p u t e l i n e c o u n t * /
2019-12-02 07:57:31 +00:00
# else
srwi. r8 , r8 , L 1 _ C A C H E _ S H I F T
mr r7 , r6
# endif
2005-11-16 13:54:32 +11:00
crclr c r0 * 4 + s o
2005-04-16 15:20:36 -07:00
beqlr / * n o t h i n g t o d o ? * /
mtctr r8
2007-11-20 12:24:45 +11:00
1 : dcbst 0 ,r6
2019-12-02 07:57:31 +00:00
# ifdef C O N F I G _ P P C 6 4
2007-11-20 12:24:45 +11:00
add r6 ,r6 ,r7
2019-12-02 07:57:31 +00:00
# else
addi r6 , r6 , L 1 _ C A C H E _ B Y T E S
# endif
2005-04-16 15:20:36 -07:00
bdnz 1 b
sync
2007-11-20 12:24:45 +11:00
/* Now invalidate the instruction cache */
2019-12-02 07:57:31 +00:00
# ifdef C O N F I G _ P P C 6 4
2007-11-20 12:24:45 +11:00
lwz r7 ,C F G _ I C A C H E _ B L O C K S Z ( r10 )
addi r5 ,r7 ,- 1
2019-12-02 07:57:30 +00:00
andc r6 ,r3 ,r5 / * r o u n d l o w t o l i n e b d y * /
2007-11-20 12:24:45 +11:00
subf r8 ,r6 ,r4 / * c o m p u t e l e n g t h * /
add r8 ,r8 ,r5
lwz r9 ,C F G _ I C A C H E _ L O G B L O C K S Z ( r10 )
srw. r8 ,r8 ,r9 / * c o m p u t e l i n e c o u n t * /
crclr c r0 * 4 + s o
beqlr / * n o t h i n g t o d o ? * /
2019-12-02 07:57:31 +00:00
# endif
2005-04-16 15:20:36 -07:00
mtctr r8
2019-12-02 07:57:31 +00:00
# ifdef C O N F I G _ P P C 6 4
2007-11-20 12:24:45 +11:00
2 : icbi 0 ,r6
add r6 ,r6 ,r7
2019-12-02 07:57:31 +00:00
# else
2 : icbi 0 , r7
addi r7 , r7 , L 1 _ C A C H E _ B Y T E S
# endif
2007-11-20 12:24:45 +11:00
bdnz 2 b
2005-04-16 15:20:36 -07:00
isync
2005-04-27 18:04:45 -07:00
li r3 ,0
2005-04-16 15:20:36 -07:00
blr
2020-09-27 09:16:35 +00:00
3 :
2005-11-16 13:54:32 +11:00
crclr c r0 * 4 + s o
2005-04-16 15:20:36 -07:00
sync
isync
2005-04-27 18:04:45 -07:00
li r3 ,0
2005-04-16 15:20:36 -07:00
blr
.cfi_endproc
2020-09-27 09:16:35 +00:00
V_ F U N C T I O N _ E N D ( _ _ k e r n e l _ s y n c _ d i c a c h e )