Linux Audio

Check our new training course

Loading...
v3.1
  1#ifndef __ASM_SH_TLB_H
  2#define __ASM_SH_TLB_H
  3
  4#ifdef CONFIG_SUPERH64
  5# include "tlb_64.h"
  6#endif
  7
  8#ifndef __ASSEMBLY__
  9#include <linux/pagemap.h>
 10
 11#ifdef CONFIG_MMU
 12#include <linux/swap.h>
 13#include <asm/pgalloc.h>
 14#include <asm/tlbflush.h>
 15#include <asm/mmu_context.h>
 16
 17/*
 18 * TLB handling.  This allows us to remove pages from the page
 19 * tables, and efficiently handle the TLB issues.
 20 */
 21struct mmu_gather {
 22	struct mm_struct	*mm;
 23	unsigned int		fullmm;
 24	unsigned long		start, end;
 25};
 26
 27static inline void init_tlb_gather(struct mmu_gather *tlb)
 28{
 29	tlb->start = TASK_SIZE;
 30	tlb->end = 0;
 31
 32	if (tlb->fullmm) {
 33		tlb->start = 0;
 34		tlb->end = TASK_SIZE;
 35	}
 36}
 37
 38static inline void
 39tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush)
 40{
 41	tlb->mm = mm;
 42	tlb->fullmm = full_mm_flush;
 
 
 43
 44	init_tlb_gather(tlb);
 45}
 46
 47static inline void
 48tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
 49{
 50	if (tlb->fullmm)
 51		flush_tlb_mm(tlb->mm);
 52
 53	/* keep the page table cache within bounds */
 54	check_pgt_cache();
 55}
 56
 57static inline void
 58tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long address)
 59{
 60	if (tlb->start > address)
 61		tlb->start = address;
 62	if (tlb->end < address + PAGE_SIZE)
 63		tlb->end = address + PAGE_SIZE;
 64}
 65
 
 
 
 66/*
 67 * In the case of tlb vma handling, we can optimise these away in the
 68 * case where we're doing a full MM flush.  When we're doing a munmap,
 69 * the vmas are adjusted to only cover the region to be torn down.
 70 */
 71static inline void
 72tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
 73{
 74	if (!tlb->fullmm)
 75		flush_cache_range(vma, vma->vm_start, vma->vm_end);
 76}
 77
 78static inline void
 79tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
 80{
 81	if (!tlb->fullmm && tlb->end) {
 82		flush_tlb_range(vma, tlb->start, tlb->end);
 83		init_tlb_gather(tlb);
 84	}
 85}
 86
 
 
 
 
 
 
 
 
 87static inline void tlb_flush_mmu(struct mmu_gather *tlb)
 88{
 89}
 90
 91static inline int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
 92{
 93	free_page_and_swap_cache(page);
 94	return 1; /* avoid calling tlb_flush_mmu */
 95}
 96
 97static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
 98{
 99	__tlb_remove_page(tlb, page);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100}
101
102#define pte_free_tlb(tlb, ptep, addr)	pte_free((tlb)->mm, ptep)
103#define pmd_free_tlb(tlb, pmdp, addr)	pmd_free((tlb)->mm, pmdp)
104#define pud_free_tlb(tlb, pudp, addr)	pud_free((tlb)->mm, pudp)
105
106#define tlb_migrate_finish(mm)		do { } while (0)
107
108#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SUPERH64)
109extern void tlb_wire_entry(struct vm_area_struct *, unsigned long, pte_t);
110extern void tlb_unwire_entry(void);
111#else
112static inline void tlb_wire_entry(struct vm_area_struct *vma ,
113				  unsigned long addr, pte_t pte)
114{
115	BUG();
116}
117
118static inline void tlb_unwire_entry(void)
119{
120	BUG();
121}
122#endif
123
124#else /* CONFIG_MMU */
125
126#define tlb_start_vma(tlb, vma)				do { } while (0)
127#define tlb_end_vma(tlb, vma)				do { } while (0)
128#define __tlb_remove_tlb_entry(tlb, pte, address)	do { } while (0)
129#define tlb_flush(tlb)					do { } while (0)
130
131#include <asm-generic/tlb.h>
132
133#endif /* CONFIG_MMU */
134#endif /* __ASSEMBLY__ */
135#endif /* __ASM_SH_TLB_H */
v4.10.11
  1#ifndef __ASM_SH_TLB_H
  2#define __ASM_SH_TLB_H
  3
  4#ifdef CONFIG_SUPERH64
  5# include <asm/tlb_64.h>
  6#endif
  7
  8#ifndef __ASSEMBLY__
  9#include <linux/pagemap.h>
 10
 11#ifdef CONFIG_MMU
 12#include <linux/swap.h>
 13#include <asm/pgalloc.h>
 14#include <asm/tlbflush.h>
 15#include <asm/mmu_context.h>
 16
 17/*
 18 * TLB handling.  This allows us to remove pages from the page
 19 * tables, and efficiently handle the TLB issues.
 20 */
 21struct mmu_gather {
 22	struct mm_struct	*mm;
 23	unsigned int		fullmm;
 24	unsigned long		start, end;
 25};
 26
 27static inline void init_tlb_gather(struct mmu_gather *tlb)
 28{
 29	tlb->start = TASK_SIZE;
 30	tlb->end = 0;
 31
 32	if (tlb->fullmm) {
 33		tlb->start = 0;
 34		tlb->end = TASK_SIZE;
 35	}
 36}
 37
 38static inline void
 39tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
 40{
 41	tlb->mm = mm;
 42	tlb->start = start;
 43	tlb->end = end;
 44	tlb->fullmm = !(start | (end+1));
 45
 46	init_tlb_gather(tlb);
 47}
 48
 49static inline void
 50tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
 51{
 52	if (tlb->fullmm)
 53		flush_tlb_mm(tlb->mm);
 54
 55	/* keep the page table cache within bounds */
 56	check_pgt_cache();
 57}
 58
 59static inline void
 60tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long address)
 61{
 62	if (tlb->start > address)
 63		tlb->start = address;
 64	if (tlb->end < address + PAGE_SIZE)
 65		tlb->end = address + PAGE_SIZE;
 66}
 67
 68#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)	\
 69	tlb_remove_tlb_entry(tlb, ptep, address)
 70
 71/*
 72 * In the case of tlb vma handling, we can optimise these away in the
 73 * case where we're doing a full MM flush.  When we're doing a munmap,
 74 * the vmas are adjusted to only cover the region to be torn down.
 75 */
 76static inline void
 77tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
 78{
 79	if (!tlb->fullmm)
 80		flush_cache_range(vma, vma->vm_start, vma->vm_end);
 81}
 82
 83static inline void
 84tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
 85{
 86	if (!tlb->fullmm && tlb->end) {
 87		flush_tlb_range(vma, tlb->start, tlb->end);
 88		init_tlb_gather(tlb);
 89	}
 90}
 91
 92static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
 93{
 94}
 95
 96static inline void tlb_flush_mmu_free(struct mmu_gather *tlb)
 97{
 98}
 99
100static inline void tlb_flush_mmu(struct mmu_gather *tlb)
101{
102}
103
104static inline int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
105{
106	free_page_and_swap_cache(page);
107	return false; /* avoid calling tlb_flush_mmu */
108}
109
110static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
111{
112	__tlb_remove_page(tlb, page);
113}
114
115static inline bool __tlb_remove_page_size(struct mmu_gather *tlb,
116					  struct page *page, int page_size)
117{
118	return __tlb_remove_page(tlb, page);
119}
120
121static inline void tlb_remove_page_size(struct mmu_gather *tlb,
122					struct page *page, int page_size)
123{
124	return tlb_remove_page(tlb, page);
125}
126
127#define tlb_remove_check_page_size_change tlb_remove_check_page_size_change
128static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
129						     unsigned int page_size)
130{
131}
132
133#define pte_free_tlb(tlb, ptep, addr)	pte_free((tlb)->mm, ptep)
134#define pmd_free_tlb(tlb, pmdp, addr)	pmd_free((tlb)->mm, pmdp)
135#define pud_free_tlb(tlb, pudp, addr)	pud_free((tlb)->mm, pudp)
136
137#define tlb_migrate_finish(mm)		do { } while (0)
138
139#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SUPERH64)
140extern void tlb_wire_entry(struct vm_area_struct *, unsigned long, pte_t);
141extern void tlb_unwire_entry(void);
142#else
143static inline void tlb_wire_entry(struct vm_area_struct *vma ,
144				  unsigned long addr, pte_t pte)
145{
146	BUG();
147}
148
149static inline void tlb_unwire_entry(void)
150{
151	BUG();
152}
153#endif
154
155#else /* CONFIG_MMU */
156
157#define tlb_start_vma(tlb, vma)				do { } while (0)
158#define tlb_end_vma(tlb, vma)				do { } while (0)
159#define __tlb_remove_tlb_entry(tlb, pte, address)	do { } while (0)
160#define tlb_flush(tlb)					do { } while (0)
161
162#include <asm-generic/tlb.h>
163
164#endif /* CONFIG_MMU */
165#endif /* __ASSEMBLY__ */
166#endif /* __ASM_SH_TLB_H */