2019-06-04 10:11:33 +02:00
/* SPDX-License-Identifier: GPL-2.0-only */
2007-05-18 11:25:31 +01:00
/ *
* linux/ a r c h / a r m / m m / t l b - v7 . S
*
* Copyright ( C ) 1 9 9 7 - 2 0 0 2 R u s s e l l K i n g
* Modified f o r A R M v7 b y C a t a l i n M a r i n a s
*
* 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 14:02:22 -04:00
# include < l i n u x / i n i t . h >
2007-05-18 11:25:31 +01:00
# include < l i n u x / l i n k a g e . h >
2010-09-04 10:47:48 +01:00
# include < a s m / a s s e m b l e r . h >
2007-05-18 11:25:31 +01:00
# include < a s m / a s m - o f f s e t s . h >
# 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 "
ARM: 9263/1: use .arch directives instead of assembler command line flags
Similar to commit a6c30873ee4a ("ARM: 8989/1: use .fpu assembler
directives instead of assembler arguments").
GCC and GNU binutils support setting the "sub arch" via -march=,
-Wa,-march, target function attribute, and .arch assembler directive.
Clang was missing support for -Wa,-march=, but this was implemented in
clang-13.
The behavior of both GCC and Clang is to
prefer -Wa,-march= over -march= for assembler and assembler-with-cpp
sources, but Clang will warn about the -march= being unused.
clang: warning: argument unused during compilation: '-march=armv6k'
[-Wunused-command-line-argument]
Since most assembler is non-conditionally assembled with one sub arch
(modulo arch/arm/delay-loop.S which conditionally is assembled as armv4
based on CONFIG_ARCH_RPC, and arch/arm/mach-at91/pm-suspend.S which is
conditionally assembled as armv7-a based on CONFIG_CPU_V7), prefer the
.arch assembler directive.
Add a few more instances found in compile testing as found by Arnd and
Nathan.
Link: https://github.com/llvm/llvm-project/commit/1d51c699b9e2ebc5bcfdbe85c74cc871426333d4
Link: https://bugs.llvm.org/show_bug.cgi?id=48894
Link: https://github.com/ClangBuiltLinux/linux/issues/1195
Link: https://github.com/ClangBuiltLinux/linux/issues/1315
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-10-24 20:44:41 +01:00
.arch armv7 - a
2007-05-18 11:25:31 +01:00
/ *
* v7 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 )
2021-06-28 19:39:56 -07:00
* - vma - v m _ a r e 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
2007-05-18 11:25:31 +01:00
*
* 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( v7 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
mmid r3 , r3 @ get vm_mm->context.id
2013-05-13 12:01:12 +01:00
dsb i s h
2007-05-18 11:25:31 +01:00
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
2012-08-10 19:13:36 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 2 0 7 8 9
ALT_ S M P ( W ( m o v ) r3 , #0 )
ALT_ U P ( W ( n o p ) )
2012-07-20 18:24:55 +01:00
# endif
2007-05-18 11:25:31 +01:00
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
1 :
2012-07-20 18:24:55 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 2 0 7 8 9
ALT_ S M P ( m c r p15 , 0 , r0 , c8 , c3 , 3 ) @ TLB invalidate U MVA all ASID (shareable)
# else
2010-09-04 10:47:48 +01:00
ALT_ S M P ( m c r p15 , 0 , r0 , c8 , c3 , 1 ) @ TLB invalidate U MVA (shareable)
2012-07-20 18:24:55 +01:00
# endif
2010-09-04 10:47:48 +01:00
ALT_ U P ( m c r p15 , 0 , r0 , c8 , c7 , 1 ) @ TLB invalidate U MVA
2007-05-18 11:25:31 +01:00
add r0 , r0 , #P A G E _ S Z
cmp r0 , r1
blo 1 b
2013-05-13 12:01:12 +01:00
dsb i s h
2014-06-30 16:29:12 +01:00
ret l r
2008-08-28 11:22:32 +01:00
ENDPROC( v7 w b i _ f l u s h _ u s e r _ t l b _ r a n g e )
2007-05-18 11:25:31 +01:00
/ *
* v7 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( v7 w b i _ f l u s h _ k e r n _ t l b _ r a n g e )
2013-05-13 12:01:12 +01:00
dsb i s h
2007-05-18 11:25:31 +01:00
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 :
2012-07-20 18:24:55 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 7 2 0 7 8 9
ALT_ S M P ( m c r p15 , 0 , r0 , c8 , c3 , 3 ) @ TLB invalidate U MVA all ASID (shareable)
# else
2010-09-04 10:47:48 +01:00
ALT_ S M P ( m c r p15 , 0 , r0 , c8 , c3 , 1 ) @ TLB invalidate U MVA (shareable)
2012-07-20 18:24:55 +01:00
# endif
2010-09-04 10:47:48 +01:00
ALT_ U P ( m c r p15 , 0 , r0 , c8 , c7 , 1 ) @ TLB invalidate U MVA
2007-05-18 11:25:31 +01:00
add r0 , r0 , #P A G E _ S Z
cmp r0 , r1
blo 1 b
2013-05-13 12:01:12 +01:00
dsb i s h
2007-05-18 11:25:31 +01:00
isb
2014-06-30 16:29:12 +01:00
ret l r
2008-08-28 11:22:32 +01:00
ENDPROC( v7 w b i _ f l u s h _ k e r n _ t l b _ r a n g e )
2007-05-18 11:25:31 +01:00
2009-04-27 14:02:22 -04:00
_ _ INIT
2007-05-18 11:25:31 +01:00
2011-06-23 17:31:16 +01: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 v7 w b i , v7 w b i _ t l b _ f l a g s _ u p , f l a g s _ s m p =v7wbi_tlb_flags_smp