2005-04-17 05:20:36 +07:00
|
|
|
/*
|
2008-08-02 16:55:55 +07:00
|
|
|
* arch/arm/include/asm/tlb.h
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Copyright (C) 2002 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.
|
|
|
|
*
|
|
|
|
* Experimentation shows that on a StrongARM, it appears to be faster
|
|
|
|
* to use the "invalidate whole tlb" rather than "invalidate single
|
|
|
|
* tlb" for this.
|
|
|
|
*
|
|
|
|
* This appears true for both the process fork+exit case, as well as
|
|
|
|
* the munmap-large-area case.
|
|
|
|
*/
|
|
|
|
#ifndef __ASMARM_TLB_H
|
|
|
|
#define __ASMARM_TLB_H
|
|
|
|
|
|
|
|
#include <asm/cacheflush.h>
|
2006-02-25 04:41:25 +07:00
|
|
|
|
|
|
|
#ifndef CONFIG_MMU
|
|
|
|
|
|
|
|
#include <linux/pagemap.h>
|
2011-02-20 19:27:49 +07:00
|
|
|
|
|
|
|
#define tlb_flush(tlb) ((void) tlb)
|
|
|
|
|
2006-02-25 04:41:25 +07:00
|
|
|
#include <asm-generic/tlb.h>
|
|
|
|
|
|
|
|
#else /* !CONFIG_MMU */
|
|
|
|
|
2011-02-20 19:16:45 +07:00
|
|
|
#include <linux/swap.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <asm/pgalloc.h>
|
2011-02-20 19:16:45 +07:00
|
|
|
#include <asm/tlbflush.h>
|
|
|
|
|
2014-10-10 05:29:18 +07:00
|
|
|
static inline void __tlb_remove_table(void *_table)
|
|
|
|
{
|
|
|
|
free_page_and_swap_cache((struct page *)_table);
|
|
|
|
}
|
|
|
|
|
2018-09-04 19:09:30 +07:00
|
|
|
#include <asm-generic/tlb.h>
|
2014-10-10 05:29:18 +07:00
|
|
|
|
2018-09-04 19:09:30 +07:00
|
|
|
#ifndef CONFIG_HAVE_RCU_TABLE_FREE
|
|
|
|
#define tlb_remove_table(tlb, entry) tlb_remove_page(tlb, entry)
|
2014-10-10 05:29:18 +07:00
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
static inline void
|
2018-09-04 19:09:30 +07:00
|
|
|
__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
|
2011-02-20 19:16:45 +07:00
|
|
|
{
|
|
|
|
pgtable_page_dtor(pte);
|
2012-01-25 17:54:22 +07:00
|
|
|
|
2018-09-04 19:09:30 +07:00
|
|
|
#ifndef CONFIG_ARM_LPAE
|
2012-01-25 17:54:22 +07:00
|
|
|
/*
|
|
|
|
* With the classic ARM MMU, a pte page has two corresponding pmd
|
|
|
|
* entries, each covering 1MB.
|
|
|
|
*/
|
2018-09-04 19:09:30 +07:00
|
|
|
addr = (addr & PMD_MASK) + SZ_1M;
|
|
|
|
__tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE);
|
2012-08-24 21:23:06 +07:00
|
|
|
#endif
|
2012-01-25 17:54:22 +07:00
|
|
|
|
2018-09-04 19:09:30 +07:00
|
|
|
tlb_remove_table(tlb, pte);
|
2011-11-23 00:30:29 +07:00
|
|
|
}
|
|
|
|
|
2012-07-25 20:39:26 +07:00
|
|
|
static inline void
|
2018-09-04 19:09:30 +07:00
|
|
|
__pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
|
2016-12-13 07:42:40 +07:00
|
|
|
{
|
2018-09-04 19:09:30 +07:00
|
|
|
#ifdef CONFIG_ARM_LPAE
|
|
|
|
struct page *page = virt_to_page(pmdp);
|
2018-07-25 16:55:57 +07:00
|
|
|
|
2018-09-04 19:09:30 +07:00
|
|
|
tlb_remove_table(tlb, page);
|
|
|
|
#endif
|
2018-07-25 16:55:57 +07:00
|
|
|
}
|
|
|
|
|
2006-02-25 04:41:25 +07:00
|
|
|
#endif /* CONFIG_MMU */
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|