xref: /linux/arch/arm/mm/tlb-v4.S (revision 4853f1f6ace32c68a04287353e428c4cfc3fa8ed)
1d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds *  linux/arch/arm/mm/tlbv4.S
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds *  Copyright (C) 1997-2002 Russell King
61da177e4SLinus Torvalds *
71da177e4SLinus Torvalds *  ARM architecture version 4 TLB handling functions.
81da177e4SLinus Torvalds *  These assume a split I/D TLBs, and no write buffer.
91da177e4SLinus Torvalds *
101da177e4SLinus Torvalds * Processors: ARM720T
111da177e4SLinus Torvalds */
121da177e4SLinus Torvalds#include <linux/linkage.h>
131da177e4SLinus Torvalds#include <linux/init.h>
14*6b0ef279SArd Biesheuvel#include <linux/cfi_types.h>
156ebbf2ceSRussell King#include <asm/assembler.h>
16e6ae744dSSam Ravnborg#include <asm/asm-offsets.h>
171da177e4SLinus Torvalds#include <asm/tlbflush.h>
181da177e4SLinus Torvalds#include "proc-macros.S"
191da177e4SLinus Torvalds
201da177e4SLinus Torvalds	.align	5
211da177e4SLinus Torvalds/*
221da177e4SLinus Torvalds *	v4_flush_user_tlb_range(start, end, mm)
231da177e4SLinus Torvalds *
241da177e4SLinus Torvalds *	Invalidate a range of TLB entries in the specified user address space.
251da177e4SLinus Torvalds *
261da177e4SLinus Torvalds *	- start - range start address
271da177e4SLinus Torvalds *	- end   - range end address
281da177e4SLinus Torvalds *	- mm    - mm_struct describing address space
291da177e4SLinus Torvalds */
301da177e4SLinus Torvalds	.align	5
31*6b0ef279SArd BiesheuvelSYM_TYPED_FUNC_START(v4_flush_user_tlb_range)
321da177e4SLinus Torvalds	vma_vm_mm ip, r2
331da177e4SLinus Torvalds	act_mm	r3				@ get current->active_mm
341da177e4SLinus Torvalds	eors	r3, ip, r3				@ == mm ?
356ebbf2ceSRussell King	retne	lr				@ no, we dont do anything
361da177e4SLinus Torvalds.v4_flush_kern_tlb_range:
371da177e4SLinus Torvalds	bic	r0, r0, #0x0ff
381da177e4SLinus Torvalds	bic	r0, r0, #0xf00
391da177e4SLinus Torvalds1:	mcr	p15, 0, r0, c8, c7, 1		@ invalidate TLB entry
401da177e4SLinus Torvalds	add	r0, r0, #PAGE_SZ
411da177e4SLinus Torvalds	cmp	r0, r1
421da177e4SLinus Torvalds	blo	1b
436ebbf2ceSRussell King	ret	lr
44*6b0ef279SArd BiesheuvelSYM_FUNC_END(v4_flush_user_tlb_range)
451da177e4SLinus Torvalds
461da177e4SLinus Torvalds/*
471da177e4SLinus Torvalds *	v4_flush_kern_tlb_range(start, end)
481da177e4SLinus Torvalds *
491da177e4SLinus Torvalds *	Invalidate a range of TLB entries in the specified kernel
501da177e4SLinus Torvalds *	address range.
511da177e4SLinus Torvalds *
521da177e4SLinus Torvalds *	- start - virtual address (may not be aligned)
531da177e4SLinus Torvalds *	- end   - virtual address (may not be aligned)
541da177e4SLinus Torvalds */
55*6b0ef279SArd Biesheuvel#ifdef CONFIG_CFI_CLANG
56*6b0ef279SArd BiesheuvelSYM_TYPED_FUNC_START(v4_flush_kern_tlb_range)
57*6b0ef279SArd Biesheuvel	b	.v4_flush_kern_tlb_range
58*6b0ef279SArd BiesheuvelSYM_FUNC_END(v4_flush_kern_tlb_range)
59*6b0ef279SArd Biesheuvel#else
601da177e4SLinus Torvalds.globl v4_flush_kern_tlb_range
611da177e4SLinus Torvalds.equ v4_flush_kern_tlb_range, .v4_flush_kern_tlb_range
62*6b0ef279SArd Biesheuvel#endif
63