Root/
Source at commit 694c7fbe86b8a9c91392e505afcb9fcfc91deccc created 12 years 8 months ago. By Maarten ter Huurne, MIPS: JZ4740: Add cpufreq support | |
---|---|
1 | /* |
2 | * MIPS Huge TLB Page Support for Kernel. |
3 | * |
4 | * This file is subject to the terms and conditions of the GNU General Public |
5 | * License. See the file "COPYING" in the main directory of this archive |
6 | * for more details. |
7 | * |
8 | * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com> |
9 | * Copyright 2005, Embedded Alley Solutions, Inc. |
10 | * Matt Porter <mporter@embeddedalley.com> |
11 | * Copyright (C) 2008, 2009 Cavium Networks, Inc. |
12 | */ |
13 | |
14 | #include <linux/init.h> |
15 | #include <linux/fs.h> |
16 | #include <linux/mm.h> |
17 | #include <linux/hugetlb.h> |
18 | #include <linux/pagemap.h> |
19 | #include <linux/err.h> |
20 | #include <linux/sysctl.h> |
21 | #include <asm/mman.h> |
22 | #include <asm/tlb.h> |
23 | #include <asm/tlbflush.h> |
24 | |
25 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, |
26 | unsigned long sz) |
27 | { |
28 | pgd_t *pgd; |
29 | pud_t *pud; |
30 | pte_t *pte = NULL; |
31 | |
32 | pgd = pgd_offset(mm, addr); |
33 | pud = pud_alloc(mm, pgd, addr); |
34 | if (pud) |
35 | pte = (pte_t *)pmd_alloc(mm, pud, addr); |
36 | |
37 | return pte; |
38 | } |
39 | |
40 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) |
41 | { |
42 | pgd_t *pgd; |
43 | pud_t *pud; |
44 | pmd_t *pmd = NULL; |
45 | |
46 | pgd = pgd_offset(mm, addr); |
47 | if (pgd_present(*pgd)) { |
48 | pud = pud_offset(pgd, addr); |
49 | if (pud_present(*pud)) |
50 | pmd = pmd_offset(pud, addr); |
51 | } |
52 | return (pte_t *) pmd; |
53 | } |
54 | |
55 | int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) |
56 | { |
57 | return 0; |
58 | } |
59 | |
60 | /* |
61 | * This function checks for proper alignment of input addr and len parameters. |
62 | */ |
63 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len) |
64 | { |
65 | if (len & ~HPAGE_MASK) |
66 | return -EINVAL; |
67 | if (addr & ~HPAGE_MASK) |
68 | return -EINVAL; |
69 | return 0; |
70 | } |
71 | |
72 | struct page * |
73 | follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) |
74 | { |
75 | return ERR_PTR(-EINVAL); |
76 | } |
77 | |
78 | int pmd_huge(pmd_t pmd) |
79 | { |
80 | return (pmd_val(pmd) & _PAGE_HUGE) != 0; |
81 | } |
82 | |
83 | int pud_huge(pud_t pud) |
84 | { |
85 | return (pud_val(pud) & _PAGE_HUGE) != 0; |
86 | } |
87 | |
88 | int pmd_huge_support(void) |
89 | { |
90 | return 1; |
91 | } |
92 | |
93 | struct page * |
94 | follow_huge_pmd(struct mm_struct *mm, unsigned long address, |
95 | pmd_t *pmd, int write) |
96 | { |
97 | struct page *page; |
98 | |
99 | page = pte_page(*(pte_t *)pmd); |
100 | if (page) |
101 | page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT); |
102 | return page; |
103 | } |
104 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9