2019-06-04 16:11:33 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2008-08-02 17:55:55 +08:00
|
|
|
* arch/arm/include/asm/tlb.h
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Russell King
|
|
|
|
*
|
|
|
|
* 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 05:41:25 +08:00
|
|
|
|
|
|
|
#ifndef CONFIG_MMU
|
|
|
|
|
|
|
|
#include <linux/pagemap.h>
|
2011-02-20 20:27:49 +08:00
|
|
|
|
|
|
|
#define tlb_flush(tlb) ((void) tlb)
|
|
|
|
|
2006-02-25 05:41:25 +08:00
|
|
|
#include <asm-generic/tlb.h>
|
|
|
|
|
|
|
|
#else /* !CONFIG_MMU */
|
|
|
|
|
2011-02-20 20:16:45 +08:00
|
|
|
#include <linux/swap.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/pgalloc.h>
|
2011-02-20 20:16:45 +08:00
|
|
|
#include <asm/tlbflush.h>
|
|
|
|
|
2014-10-10 06:29:18 +08:00
|
|
|
static inline void __tlb_remove_table(void *_table)
|
|
|
|
{
|
|
|
|
free_page_and_swap_cache((struct page *)_table);
|
|
|
|
}
|
|
|
|
|
2018-09-04 20:09:30 +08:00
|
|
|
#include <asm-generic/tlb.h>
|
2014-10-10 06:29:18 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static inline void
|
2018-09-04 20:09:30 +08:00
|
|
|
__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
|
2011-02-20 20:16:45 +08:00
|
|
|
{
|
2019-09-26 07:49:46 +08:00
|
|
|
pgtable_pte_page_dtor(pte);
|
2012-01-25 18:54:22 +08:00
|
|
|
|
2018-09-04 20:09:30 +08:00
|
|
|
#ifndef CONFIG_ARM_LPAE
|
2012-01-25 18:54:22 +08:00
|
|
|
/*
|
|
|
|
* With the classic ARM MMU, a pte page has two corresponding pmd
|
|
|
|
* entries, each covering 1MB.
|
|
|
|
*/
|
2018-09-04 20:09:30 +08:00
|
|
|
addr = (addr & PMD_MASK) + SZ_1M;
|
|
|
|
__tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE);
|
2012-08-24 22:23:06 +08:00
|
|
|
#endif
|
2012-01-25 18:54:22 +08:00
|
|
|
|
2018-09-04 20:09:30 +08:00
|
|
|
tlb_remove_table(tlb, pte);
|
2011-11-23 01:30:29 +08:00
|
|
|
}
|
|
|
|
|
2012-07-25 21:39:26 +08:00
|
|
|
static inline void
|
2018-09-04 20:09:30 +08:00
|
|
|
__pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
|
2016-12-13 08:42:40 +08:00
|
|
|
{
|
2018-09-04 20:09:30 +08:00
|
|
|
#ifdef CONFIG_ARM_LPAE
|
|
|
|
struct page *page = virt_to_page(pmdp);
|
2018-07-25 17:55:57 +08:00
|
|
|
|
2018-09-04 20:09:30 +08:00
|
|
|
tlb_remove_table(tlb, page);
|
|
|
|
#endif
|
2018-07-25 17:55:57 +08:00
|
|
|
}
|
|
|
|
|
2006-02-25 05:41:25 +08:00
|
|
|
#endif /* CONFIG_MMU */
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|