tlbflush.h 14.9 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
2
 *  arch/arm/include/asm/tlbflush.h
L
Linus Torvalds 已提交
3 4 5 6 7 8 9 10 11 12
 *
 *  Copyright (C) 1999-2003 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef _ASMARM_TLBFLUSH_H
#define _ASMARM_TLBFLUSH_H

13
#ifdef CONFIG_MMU
14

L
Linus Torvalds 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#include <asm/glue.h>

#define TLB_V3_PAGE	(1 << 0)
#define TLB_V4_U_PAGE	(1 << 1)
#define TLB_V4_D_PAGE	(1 << 2)
#define TLB_V4_I_PAGE	(1 << 3)
#define TLB_V6_U_PAGE	(1 << 4)
#define TLB_V6_D_PAGE	(1 << 5)
#define TLB_V6_I_PAGE	(1 << 6)

#define TLB_V3_FULL	(1 << 8)
#define TLB_V4_U_FULL	(1 << 9)
#define TLB_V4_D_FULL	(1 << 10)
#define TLB_V4_I_FULL	(1 << 11)
#define TLB_V6_U_FULL	(1 << 12)
#define TLB_V6_D_FULL	(1 << 13)
#define TLB_V6_I_FULL	(1 << 14)

#define TLB_V6_U_ASID	(1 << 16)
#define TLB_V6_D_ASID	(1 << 17)
#define TLB_V6_I_ASID	(1 << 18)

37 38 39 40 41
/* Unified Inner Shareable TLB operations (ARMv7 MP extensions) */
#define TLB_V7_UIS_PAGE	(1 << 19)
#define TLB_V7_UIS_FULL (1 << 20)
#define TLB_V7_UIS_ASID (1 << 21)

42
#define TLB_BARRIER	(1 << 28)
43
#define TLB_L2CLEAN_FR	(1 << 29)		/* Feroceon */
L
Linus Torvalds 已提交
44 45 46 47 48 49 50 51 52 53 54 55
#define TLB_DCLEAN	(1 << 30)
#define TLB_WB		(1 << 31)

/*
 *	MMU TLB Model
 *	=============
 *
 *	We have the following to choose from:
 *	  v3    - ARMv3
 *	  v4    - ARMv4 without write buffer
 *	  v4wb  - ARMv4 with write buffer without I TLB flush entry instruction
 *	  v4wbi - ARMv4 with write buffer with I TLB flush entry instruction
56
 *	  fr    - Feroceon (v4wbi with non-outer-cacheable page table walks)
57
 *	  fa    - Faraday (v4 with write buffer with UTLB)
L
Linus Torvalds 已提交
58
 *	  v6wbi - ARMv6 with write buffer with I TLB flush entry instruction
59
 *	  v7wbi - identical to v6wbi
L
Linus Torvalds 已提交
60 61 62 63
 */
#undef _TLB
#undef MULTI_TLB

64 65 66 67
#ifdef CONFIG_SMP_ON_UP
#define MULTI_TLB 1
#endif

L
Linus Torvalds 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
#define v3_tlb_flags	(TLB_V3_FULL | TLB_V3_PAGE)

#ifdef CONFIG_CPU_TLB_V3
# define v3_possible_flags	v3_tlb_flags
# define v3_always_flags	v3_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v3
# endif
#else
# define v3_possible_flags	0
# define v3_always_flags	(-1UL)
#endif

#define v4_tlb_flags	(TLB_V4_U_FULL | TLB_V4_U_PAGE)

#ifdef CONFIG_CPU_TLB_V4WT
# define v4_possible_flags	v4_tlb_flags
# define v4_always_flags	v4_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v4
# endif
#else
# define v4_possible_flags	0
# define v4_always_flags	(-1UL)
#endif

98
#define fa_tlb_flags	(TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
P
Paulius Zaleckas 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
			 TLB_V4_U_FULL | TLB_V4_U_PAGE)

#ifdef CONFIG_CPU_TLB_FA
# define fa_possible_flags	fa_tlb_flags
# define fa_always_flags	fa_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB fa
# endif
#else
# define fa_possible_flags	0
# define fa_always_flags	(-1UL)
#endif

L
Linus Torvalds 已提交
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
#define v4wbi_tlb_flags	(TLB_WB | TLB_DCLEAN | \
			 TLB_V4_I_FULL | TLB_V4_D_FULL | \
			 TLB_V4_I_PAGE | TLB_V4_D_PAGE)

#ifdef CONFIG_CPU_TLB_V4WBI
# define v4wbi_possible_flags	v4wbi_tlb_flags
# define v4wbi_always_flags	v4wbi_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v4wbi
# endif
#else
# define v4wbi_possible_flags	0
# define v4wbi_always_flags	(-1UL)
#endif

131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
#define fr_tlb_flags	(TLB_WB | TLB_DCLEAN | TLB_L2CLEAN_FR | \
			 TLB_V4_I_FULL | TLB_V4_D_FULL | \
			 TLB_V4_I_PAGE | TLB_V4_D_PAGE)

#ifdef CONFIG_CPU_TLB_FEROCEON
# define fr_possible_flags	fr_tlb_flags
# define fr_always_flags	fr_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v4wbi
# endif
#else
# define fr_possible_flags	0
# define fr_always_flags	(-1UL)
#endif

L
Linus Torvalds 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
#define v4wb_tlb_flags	(TLB_WB | TLB_DCLEAN | \
			 TLB_V4_I_FULL | TLB_V4_D_FULL | \
			 TLB_V4_D_PAGE)

#ifdef CONFIG_CPU_TLB_V4WB
# define v4wb_possible_flags	v4wb_tlb_flags
# define v4wb_always_flags	v4wb_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v4wb
# endif
#else
# define v4wb_possible_flags	0
# define v4wb_always_flags	(-1UL)
#endif

165
#define v6wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
L
Linus Torvalds 已提交
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
			 TLB_V6_I_FULL | TLB_V6_D_FULL | \
			 TLB_V6_I_PAGE | TLB_V6_D_PAGE | \
			 TLB_V6_I_ASID | TLB_V6_D_ASID)

#ifdef CONFIG_CPU_TLB_V6
# define v6wbi_possible_flags	v6wbi_tlb_flags
# define v6wbi_always_flags	v6wbi_tlb_flags
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v6wbi
# endif
#else
# define v6wbi_possible_flags	0
# define v6wbi_always_flags	(-1UL)
#endif

183
#define v7wbi_tlb_flags_smp	(TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
184
			 TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID)
185
#define v7wbi_tlb_flags_up	(TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
186 187
			 TLB_V6_U_FULL | TLB_V6_U_PAGE | TLB_V6_U_ASID)

188
#ifdef CONFIG_CPU_TLB_V7
189 190 191 192 193 194 195 196 197 198 199

# ifdef CONFIG_SMP_ON_UP
#  define v7wbi_possible_flags	(v7wbi_tlb_flags_smp | v7wbi_tlb_flags_up)
#  define v7wbi_always_flags	(v7wbi_tlb_flags_smp & v7wbi_tlb_flags_up)
# elif defined(CONFIG_SMP)
#  define v7wbi_possible_flags	v7wbi_tlb_flags_smp
#  define v7wbi_always_flags	v7wbi_tlb_flags_smp
# else
#  define v7wbi_possible_flags	v7wbi_tlb_flags_up
#  define v7wbi_always_flags	v7wbi_tlb_flags_up
# endif
200 201 202 203 204 205 206 207 208 209
# ifdef _TLB
#  define MULTI_TLB 1
# else
#  define _TLB v7wbi
# endif
#else
# define v7wbi_possible_flags	0
# define v7wbi_always_flags	(-1UL)
#endif

L
Linus Torvalds 已提交
210 211 212 213 214 215
#ifndef _TLB
#error Unknown TLB model
#endif

#ifndef __ASSEMBLY__

A
Alexey Dobriyan 已提交
216 217
#include <linux/sched.h>

L
Linus Torvalds 已提交
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
struct cpu_tlb_fns {
	void (*flush_user_range)(unsigned long, unsigned long, struct vm_area_struct *);
	void (*flush_kern_range)(unsigned long, unsigned long);
	unsigned long tlb_flags;
};

/*
 * Select the calling method
 */
#ifdef MULTI_TLB

#define __cpu_flush_user_tlb_range	cpu_tlb.flush_user_range
#define __cpu_flush_kern_tlb_range	cpu_tlb.flush_kern_range

#else

#define __cpu_flush_user_tlb_range	__glue(_TLB,_flush_user_tlb_range)
#define __cpu_flush_kern_tlb_range	__glue(_TLB,_flush_kern_tlb_range)

extern void __cpu_flush_user_tlb_range(unsigned long, unsigned long, struct vm_area_struct *);
extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long);

#endif

extern struct cpu_tlb_fns cpu_tlb;

#define __cpu_tlb_flags			cpu_tlb.tlb_flags

/*
 *	TLB Management
 *	==============
 *
 *	The arch/arm/mm/tlb-*.S files implement these methods.
 *
 *	The TLB specific code is expected to perform whatever tests it
 *	needs to determine if it should invalidate the TLB for each
 *	call.  Start addresses are inclusive and end addresses are
 *	exclusive; it is safe to round these addresses down.
 *
 *	flush_tlb_all()
 *
 *		Invalidate the entire TLB.
 *
 *	flush_tlb_mm(mm)
 *
 *		Invalidate all TLB entries in a particular address
 *		space.
 *		- mm	- mm_struct describing address space
 *
 *	flush_tlb_range(mm,start,end)
 *
 *		Invalidate a range of TLB entries in the specified
 *		address space.
 *		- mm	- mm_struct describing address space
 *		- start - start address (may not be aligned)
 *		- end	- end address (exclusive, may not be aligned)
 *
 *	flush_tlb_page(vaddr,vma)
 *
 *		Invalidate the specified page in the specified address range.
 *		- vaddr - virtual address (may not be aligned)
 *		- vma	- vma_struct describing address range
 *
 *	flush_kern_tlb_page(kaddr)
 *
 *		Invalidate the TLB entry for the specified page.  The address
 *		will be in the kernels virtual memory space.  Current uses
 *		only require the D-TLB to be invalidated.
 *		- kaddr - Kernel virtual memory address
 */

/*
 * We optimise the code below by:
 *  - building a set of TLB flags that might be set in __cpu_tlb_flags
 *  - building a set of TLB flags that will always be set in __cpu_tlb_flags
 *  - if we're going to need __cpu_tlb_flags, access it once and only once
 *
 * This allows us to build optimal assembly for the single-CPU type case,
 * and as close to optimal given the compiler constrants for multi-CPU
 * case.  We could do better for the multi-CPU case if the compiler
 * implemented the "%?" method, but this has been discontinued due to too
 * many people getting it wrong.
 */
#define possible_tlb_flags	(v3_possible_flags | \
				 v4_possible_flags | \
				 v4wbi_possible_flags | \
304
				 fr_possible_flags | \
L
Linus Torvalds 已提交
305
				 v4wb_possible_flags | \
P
Paulius Zaleckas 已提交
306
				 fa_possible_flags | \
307 308
				 v6wbi_possible_flags | \
				 v7wbi_possible_flags)
L
Linus Torvalds 已提交
309 310 311 312

#define always_tlb_flags	(v3_always_flags & \
				 v4_always_flags & \
				 v4wbi_always_flags & \
313
				 fr_always_flags & \
L
Linus Torvalds 已提交
314
				 v4wb_always_flags & \
P
Paulius Zaleckas 已提交
315
				 fa_always_flags & \
316 317
				 v6wbi_always_flags & \
				 v7wbi_always_flags)
L
Linus Torvalds 已提交
318 319 320

#define tlb_flag(f)	((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f)))

321
static inline void local_flush_tlb_all(void)
L
Linus Torvalds 已提交
322 323 324 325 326
{
	const int zero = 0;
	const unsigned int __tlb_flag = __cpu_tlb_flags;

	if (tlb_flag(TLB_WB))
327
		dsb();
L
Linus Torvalds 已提交
328 329

	if (tlb_flag(TLB_V3_FULL))
330
		asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
331
	if (tlb_flag(TLB_V4_U_FULL | TLB_V6_U_FULL))
332
		asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
333
	if (tlb_flag(TLB_V4_D_FULL | TLB_V6_D_FULL))
334
		asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
335
	if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL))
336
		asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
337 338
	if (tlb_flag(TLB_V7_UIS_FULL))
		asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc");
339

340
	if (tlb_flag(TLB_BARRIER)) {
341 342 343
		dsb();
		isb();
	}
L
Linus Torvalds 已提交
344 345
}

346
static inline void local_flush_tlb_mm(struct mm_struct *mm)
L
Linus Torvalds 已提交
347 348 349 350 351 352
{
	const int zero = 0;
	const int asid = ASID(mm);
	const unsigned int __tlb_flag = __cpu_tlb_flags;

	if (tlb_flag(TLB_WB))
353
		dsb();
L
Linus Torvalds 已提交
354

355
	if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) {
L
Linus Torvalds 已提交
356
		if (tlb_flag(TLB_V3_FULL))
357
			asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
358
		if (tlb_flag(TLB_V4_U_FULL))
359
			asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
360
		if (tlb_flag(TLB_V4_D_FULL))
361
			asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
362
		if (tlb_flag(TLB_V4_I_FULL))
363
			asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
364
	}
365
	put_cpu();
L
Linus Torvalds 已提交
366 367

	if (tlb_flag(TLB_V6_U_ASID))
368
		asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc");
L
Linus Torvalds 已提交
369
	if (tlb_flag(TLB_V6_D_ASID))
370
		asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc");
L
Linus Torvalds 已提交
371
	if (tlb_flag(TLB_V6_I_ASID))
372
		asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc");
373
	if (tlb_flag(TLB_V7_UIS_ASID))
374 375 376
#ifdef CONFIG_ARM_ERRATA_720789
		asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc");
#else
377
		asm("mcr p15, 0, %0, c8, c3, 2" : : "r" (asid) : "cc");
378
#endif
379

380
	if (tlb_flag(TLB_BARRIER))
381
		dsb();
L
Linus Torvalds 已提交
382 383 384
}

static inline void
385
local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
L
Linus Torvalds 已提交
386 387 388 389 390 391 392
{
	const int zero = 0;
	const unsigned int __tlb_flag = __cpu_tlb_flags;

	uaddr = (uaddr & PAGE_MASK) | ASID(vma->vm_mm);

	if (tlb_flag(TLB_WB))
393
		dsb();
L
Linus Torvalds 已提交
394

395
	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
L
Linus Torvalds 已提交
396
		if (tlb_flag(TLB_V3_PAGE))
397
			asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (uaddr) : "cc");
L
Linus Torvalds 已提交
398
		if (tlb_flag(TLB_V4_U_PAGE))
399
			asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc");
L
Linus Torvalds 已提交
400
		if (tlb_flag(TLB_V4_D_PAGE))
401
			asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
L
Linus Torvalds 已提交
402
		if (tlb_flag(TLB_V4_I_PAGE))
403
			asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
L
Linus Torvalds 已提交
404
		if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
405
			asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
406 407 408
	}

	if (tlb_flag(TLB_V6_U_PAGE))
409
		asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc");
L
Linus Torvalds 已提交
410
	if (tlb_flag(TLB_V6_D_PAGE))
411
		asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
L
Linus Torvalds 已提交
412
	if (tlb_flag(TLB_V6_I_PAGE))
413
		asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
414
	if (tlb_flag(TLB_V7_UIS_PAGE))
415 416 417
#ifdef CONFIG_ARM_ERRATA_720789
		asm("mcr p15, 0, %0, c8, c3, 3" : : "r" (uaddr & PAGE_MASK) : "cc");
#else
418
		asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (uaddr) : "cc");
419
#endif
420

421
	if (tlb_flag(TLB_BARRIER))
422
		dsb();
L
Linus Torvalds 已提交
423 424
}

425
static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
L
Linus Torvalds 已提交
426 427 428 429 430 431 432
{
	const int zero = 0;
	const unsigned int __tlb_flag = __cpu_tlb_flags;

	kaddr &= PAGE_MASK;

	if (tlb_flag(TLB_WB))
433
		dsb();
L
Linus Torvalds 已提交
434 435

	if (tlb_flag(TLB_V3_PAGE))
436
		asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc");
L
Linus Torvalds 已提交
437
	if (tlb_flag(TLB_V4_U_PAGE))
438
		asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc");
L
Linus Torvalds 已提交
439
	if (tlb_flag(TLB_V4_D_PAGE))
440
		asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
L
Linus Torvalds 已提交
441
	if (tlb_flag(TLB_V4_I_PAGE))
442
		asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
L
Linus Torvalds 已提交
443
	if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
444
		asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
L
Linus Torvalds 已提交
445 446

	if (tlb_flag(TLB_V6_U_PAGE))
447
		asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc");
L
Linus Torvalds 已提交
448
	if (tlb_flag(TLB_V6_D_PAGE))
449
		asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
L
Linus Torvalds 已提交
450
	if (tlb_flag(TLB_V6_I_PAGE))
451
		asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
452 453
	if (tlb_flag(TLB_V7_UIS_PAGE))
		asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (kaddr) : "cc");
454

455
	if (tlb_flag(TLB_BARRIER)) {
456 457 458
		dsb();
		isb();
	}
L
Linus Torvalds 已提交
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
}

/*
 *	flush_pmd_entry
 *
 *	Flush a PMD entry (word aligned, or double-word aligned) to
 *	RAM if the TLB for the CPU we are running on requires this.
 *	This is typically used when we are creating PMD entries.
 *
 *	clean_pmd_entry
 *
 *	Clean (but don't drain the write buffer) if the CPU requires
 *	these operations.  This is typically used when we are removing
 *	PMD entries.
 */
static inline void flush_pmd_entry(pmd_t *pmd)
{
	const unsigned int __tlb_flag = __cpu_tlb_flags;

	if (tlb_flag(TLB_DCLEAN))
479 480
		asm("mcr	p15, 0, %0, c7, c10, 1	@ flush_pmd"
			: : "r" (pmd) : "cc");
481 482 483 484 485

	if (tlb_flag(TLB_L2CLEAN_FR))
		asm("mcr	p15, 1, %0, c15, c9, 1  @ L2 flush_pmd"
			: : "r" (pmd) : "cc");

L
Linus Torvalds 已提交
486
	if (tlb_flag(TLB_WB))
487
		dsb();
L
Linus Torvalds 已提交
488 489 490 491 492 493 494
}

static inline void clean_pmd_entry(pmd_t *pmd)
{
	const unsigned int __tlb_flag = __cpu_tlb_flags;

	if (tlb_flag(TLB_DCLEAN))
495 496
		asm("mcr	p15, 0, %0, c7, c10, 1	@ flush_pmd"
			: : "r" (pmd) : "cc");
497 498 499 500

	if (tlb_flag(TLB_L2CLEAN_FR))
		asm("mcr	p15, 1, %0, c15, c9, 1  @ L2 flush_pmd"
			: : "r" (pmd) : "cc");
L
Linus Torvalds 已提交
501 502 503 504 505 506 507 508 509
}

#undef tlb_flag
#undef always_tlb_flags
#undef possible_tlb_flags

/*
 * Convert calls to our calling convention.
 */
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
#define local_flush_tlb_range(vma,start,end)	__cpu_flush_user_tlb_range(start,end,vma)
#define local_flush_tlb_kernel_range(s,e)	__cpu_flush_kern_tlb_range(s,e)

#ifndef CONFIG_SMP
#define flush_tlb_all		local_flush_tlb_all
#define flush_tlb_mm		local_flush_tlb_mm
#define flush_tlb_page		local_flush_tlb_page
#define flush_tlb_kernel_page	local_flush_tlb_kernel_page
#define flush_tlb_range		local_flush_tlb_range
#define flush_tlb_kernel_range	local_flush_tlb_kernel_range
#else
extern void flush_tlb_all(void);
extern void flush_tlb_mm(struct mm_struct *mm);
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr);
extern void flush_tlb_kernel_page(unsigned long kaddr);
extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
#endif
L
Linus Torvalds 已提交
528 529

/*
530
 * If PG_dcache_clean is not set for the page, we need to ensure that any
L
Linus Torvalds 已提交
531
 * cache entries for the kernels virtual memory range are written
532 533
 * back to the page. On ARMv6 and later, the cache coherency is handled via
 * the set_pte_at() function.
L
Linus Torvalds 已提交
534
 */
535
#if __LINUX_ARM_ARCH__ < 6
536 537
extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
	pte_t *ptep);
538 539 540 541 542 543
#else
static inline void update_mmu_cache(struct vm_area_struct *vma,
				    unsigned long addr, pte_t *ptep)
{
}
#endif
L
Linus Torvalds 已提交
544 545 546

#endif

547 548
#endif /* CONFIG_MMU */

L
Linus Torvalds 已提交
549
#endif