tlb.h 2.2 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
S
Stephen Rothwell 已提交
2
 *	TLB shootdown specifics for powerpc
L
Linus Torvalds 已提交
3
 *
S
Stephen Rothwell 已提交
4
 * Copyright (C) 2002 Anton Blanchard, IBM Corp.
L
Linus Torvalds 已提交
5 6 7 8 9 10 11
 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
S
Stephen Rothwell 已提交
12 13
#ifndef _ASM_POWERPC_TLB_H
#define _ASM_POWERPC_TLB_H
14
#ifdef __KERNEL__
L
Linus Torvalds 已提交
15

S
Stephen Rothwell 已提交
16
#ifndef __powerpc64__
L
Linus Torvalds 已提交
17
#include <asm/pgtable.h>
S
Stephen Rothwell 已提交
18
#endif
L
Linus Torvalds 已提交
19 20
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
S
Stephen Rothwell 已提交
21
#ifndef __powerpc64__
L
Linus Torvalds 已提交
22 23
#include <asm/page.h>
#include <asm/mmu.h>
S
Stephen Rothwell 已提交
24
#endif
L
Linus Torvalds 已提交
25

26 27
#include <linux/pagemap.h>

S
Stephen Rothwell 已提交
28 29
#define tlb_start_vma(tlb, vma)	do { } while (0)
#define tlb_end_vma(tlb, vma)	do { } while (0)
30
#define __tlb_remove_tlb_entry	__tlb_remove_tlb_entry
31
#define tlb_remove_check_page_size_change tlb_remove_check_page_size_change
S
Stephen Rothwell 已提交
32

L
Linus Torvalds 已提交
33 34 35 36 37 38 39 40 41
extern void tlb_flush(struct mmu_gather *tlb);

/* Get the generic bits... */
#include <asm-generic/tlb.h>

extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep,
			     unsigned long address);

static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
42
					  unsigned long address)
L
Linus Torvalds 已提交
43
{
44
#ifdef CONFIG_PPC_STD_MMU_32
L
Linus Torvalds 已提交
45 46
	if (pte_val(*ptep) & _PAGE_HASHPTE)
		flush_hash_entry(tlb->mm, ptep, address);
47
#endif
L
Linus Torvalds 已提交
48 49
}

50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
						     unsigned int page_size)
{
	if (!tlb->page_size)
		tlb->page_size = page_size;
	else if (tlb->page_size != page_size) {
		tlb_flush_mmu(tlb);
		/*
		 * update the page size after flush for the new
		 * mmu_gather.
		 */
		tlb->page_size = page_size;
	}
}

65 66 67 68 69 70
#ifdef CONFIG_SMP
static inline int mm_is_core_local(struct mm_struct *mm)
{
	return cpumask_subset(mm_cpumask(mm),
			      topology_sibling_cpumask(smp_processor_id()));
}
71 72 73 74 75 76 77

static inline int mm_is_thread_local(struct mm_struct *mm)
{
	return cpumask_equal(mm_cpumask(mm),
			      cpumask_of(smp_processor_id()));
}

78 79 80 81 82
#else
static inline int mm_is_core_local(struct mm_struct *mm)
{
	return 1;
}
83 84 85 86 87

static inline int mm_is_thread_local(struct mm_struct *mm)
{
	return 1;
}
88 89
#endif

90
#endif /* __KERNEL__ */
S
Stephen Rothwell 已提交
91
#endif /* __ASM_POWERPC_TLB_H */