1d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */ 21da177e4SLinus Torvalds/* 31da177e4SLinus Torvalds * linux/arch/arm/mm/tlbv4wbi.S 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Copyright (C) 1997-2002 Russell King 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * ARM architecture version 4 and version 5 TLB handling functions. 81da177e4SLinus Torvalds * These assume a split I/D TLBs, with a write buffer. 91da177e4SLinus Torvalds * 101da177e4SLinus Torvalds * Processors: ARM920 ARM922 ARM925 ARM926 XScale 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/* 211da177e4SLinus Torvalds * v4wb_flush_user_tlb_range(start, end, mm) 221da177e4SLinus Torvalds * 231da177e4SLinus Torvalds * Invalidate a range of TLB entries in the specified address space. 241da177e4SLinus Torvalds * 251da177e4SLinus Torvalds * - start - range start address 261da177e4SLinus Torvalds * - end - range end address 271da177e4SLinus Torvalds * - mm - mm_struct describing address space 281da177e4SLinus Torvalds */ 291da177e4SLinus Torvalds .align 5 30*6b0ef279SArd BiesheuvelSYM_TYPED_FUNC_START(v4wbi_flush_user_tlb_range) 311da177e4SLinus Torvalds vma_vm_mm ip, r2 321da177e4SLinus Torvalds act_mm r3 @ get current->active_mm 331da177e4SLinus Torvalds eors r3, ip, r3 @ == mm ? 346ebbf2ceSRussell King retne lr @ no, we dont do anything 351da177e4SLinus Torvalds mov r3, #0 361da177e4SLinus Torvalds mcr p15, 0, r3, c7, c10, 4 @ drain WB 371da177e4SLinus Torvalds vma_vm_flags r2, r2 381da177e4SLinus Torvalds bic r0, r0, #0x0ff 391da177e4SLinus Torvalds bic r0, r0, #0xf00 401da177e4SLinus Torvalds1: tst r2, #VM_EXEC 411da177e4SLinus Torvalds mcrne p15, 0, r0, c8, c5, 1 @ invalidate I TLB entry 421da177e4SLinus Torvalds mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry 431da177e4SLinus Torvalds add r0, r0, #PAGE_SZ 441da177e4SLinus Torvalds cmp r0, r1 451da177e4SLinus Torvalds blo 1b 466ebbf2ceSRussell King ret lr 47*6b0ef279SArd BiesheuvelSYM_FUNC_END(v4wbi_flush_user_tlb_range) 481da177e4SLinus Torvalds 49*6b0ef279SArd BiesheuvelSYM_TYPED_FUNC_START(v4wbi_flush_kern_tlb_range) 501da177e4SLinus Torvalds mov r3, #0 511da177e4SLinus Torvalds mcr p15, 0, r3, c7, c10, 4 @ drain WB 521da177e4SLinus Torvalds bic r0, r0, #0x0ff 531da177e4SLinus Torvalds bic r0, r0, #0xf00 541da177e4SLinus Torvalds1: mcr p15, 0, r0, c8, c5, 1 @ invalidate I TLB entry 551da177e4SLinus Torvalds mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry 561da177e4SLinus Torvalds add r0, r0, #PAGE_SZ 571da177e4SLinus Torvalds cmp r0, r1 581da177e4SLinus Torvalds blo 1b 596ebbf2ceSRussell King ret lr 60*6b0ef279SArd BiesheuvelSYM_FUNC_END(v4wbi_flush_kern_tlb_range) 61