aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/io.h30
-rw-r--r--include/asm-generic/ioctls.h1
-rw-r--r--include/asm-generic/irq_regs.h8
-rw-r--r--include/asm-generic/mman-common.h3
-rw-r--r--include/asm-generic/pgtable.h217
-rw-r--r--include/asm-generic/stat.h14
-rw-r--r--include/asm-generic/vmlinux.lds.h23
7 files changed, 222 insertions, 74 deletions
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 3577ca11a0be..4644c9a7f724 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -211,6 +211,36 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
211} 211}
212#endif 212#endif
213 213
214static inline void readsl(const void __iomem *addr, void *buf, int len)
215{
216 insl((unsigned long)addr, buf, len);
217}
218
219static inline void readsw(const void __iomem *addr, void *buf, int len)
220{
221 insw((unsigned long)addr, buf, len);
222}
223
224static inline void readsb(const void __iomem *addr, void *buf, int len)
225{
226 insb((unsigned long)addr, buf, len);
227}
228
229static inline void writesl(const void __iomem *addr, const void *buf, int len)
230{
231 outsl((unsigned long)addr, buf, len);
232}
233
234static inline void writesw(const void __iomem *addr, const void *buf, int len)
235{
236 outsw((unsigned long)addr, buf, len);
237}
238
239static inline void writesb(const void __iomem *addr, const void *buf, int len)
240{
241 outsb((unsigned long)addr, buf, len);
242}
243
214#ifndef CONFIG_GENERIC_IOMAP 244#ifndef CONFIG_GENERIC_IOMAP
215#define ioread8(addr) readb(addr) 245#define ioread8(addr) readb(addr)
216#define ioread16(addr) readw(addr) 246#define ioread16(addr) readw(addr)
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a3216655d657..3f3f2d189fb8 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -67,6 +67,7 @@
67#endif 67#endif
68#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 68#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
69#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ 69#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
70#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
70#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ 71#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
71#define TCSETX 0x5433 72#define TCSETX 0x5433
72#define TCSETXF 0x5434 73#define TCSETXF 0x5434
diff --git a/include/asm-generic/irq_regs.h b/include/asm-generic/irq_regs.h
index 5ae1d07d4a12..6bf9355fa7eb 100644
--- a/include/asm-generic/irq_regs.h
+++ b/include/asm-generic/irq_regs.h
@@ -22,15 +22,15 @@ DECLARE_PER_CPU(struct pt_regs *, __irq_regs);
22 22
23static inline struct pt_regs *get_irq_regs(void) 23static inline struct pt_regs *get_irq_regs(void)
24{ 24{
25 return __get_cpu_var(__irq_regs); 25 return __this_cpu_read(__irq_regs);
26} 26}
27 27
28static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) 28static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
29{ 29{
30 struct pt_regs *old_regs, **pp_regs = &__get_cpu_var(__irq_regs); 30 struct pt_regs *old_regs;
31 31
32 old_regs = *pp_regs; 32 old_regs = __this_cpu_read(__irq_regs);
33 *pp_regs = new_regs; 33 __this_cpu_write(__irq_regs, new_regs);
34 return old_regs; 34 return old_regs;
35} 35}
36 36
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
index 3da9e2742fa0..787abbb6d867 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/asm-generic/mman-common.h
@@ -45,6 +45,9 @@
45#define MADV_MERGEABLE 12 /* KSM may merge identical pages */ 45#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
46#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ 46#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
47 47
48#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
49#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
50
48/* compatibility flags */ 51/* compatibility flags */
49#define MAP_FILE 0 52#define MAP_FILE 0
50 53
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 6f3c6ae4fe03..31b6188df221 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -5,67 +5,100 @@
5#ifdef CONFIG_MMU 5#ifdef CONFIG_MMU
6 6
7#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 7#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
8/* 8extern int ptep_set_access_flags(struct vm_area_struct *vma,
9 * Largely same as above, but only sets the access flags (dirty, 9 unsigned long address, pte_t *ptep,
10 * accessed, and writable). Furthermore, we know it always gets set 10 pte_t entry, int dirty);
11 * to a "more permissive" setting, which allows most architectures 11#endif
12 * to optimize this. We return whether the PTE actually changed, which 12
13 * in turn instructs the caller to do things like update__mmu_cache. 13#ifndef __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS
14 * This used to be done in the caller, but sparc needs minor faults to 14extern int pmdp_set_access_flags(struct vm_area_struct *vma,
15 * force that call on sun4c so we changed this macro slightly 15 unsigned long address, pmd_t *pmdp,
16 */ 16 pmd_t entry, int dirty);
17#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
18({ \
19 int __changed = !pte_same(*(__ptep), __entry); \
20 if (__changed) { \
21 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
22 flush_tlb_page(__vma, __address); \
23 } \
24 __changed; \
25})
26#endif 17#endif
27 18
28#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 19#ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
29#define ptep_test_and_clear_young(__vma, __address, __ptep) \ 20static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
30({ \ 21 unsigned long address,
31 pte_t __pte = *(__ptep); \ 22 pte_t *ptep)
32 int r = 1; \ 23{
33 if (!pte_young(__pte)) \ 24 pte_t pte = *ptep;
34 r = 0; \ 25 int r = 1;
35 else \ 26 if (!pte_young(pte))
36 set_pte_at((__vma)->vm_mm, (__address), \ 27 r = 0;
37 (__ptep), pte_mkold(__pte)); \ 28 else
38 r; \ 29 set_pte_at(vma->vm_mm, address, ptep, pte_mkold(pte));
39}) 30 return r;
31}
32#endif
33
34#ifndef __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
35#ifdef CONFIG_TRANSPARENT_HUGEPAGE
36static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
37 unsigned long address,
38 pmd_t *pmdp)
39{
40 pmd_t pmd = *pmdp;
41 int r = 1;
42 if (!pmd_young(pmd))
43 r = 0;
44 else
45 set_pmd_at(vma->vm_mm, address, pmdp, pmd_mkold(pmd));
46 return r;
47}
48#else /* CONFIG_TRANSPARENT_HUGEPAGE */
49static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
50 unsigned long address,
51 pmd_t *pmdp)
52{
53 BUG();
54 return 0;
55}
56#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
40#endif 57#endif
41 58
42#ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH 59#ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
43#define ptep_clear_flush_young(__vma, __address, __ptep) \ 60int ptep_clear_flush_young(struct vm_area_struct *vma,
44({ \ 61 unsigned long address, pte_t *ptep);
45 int __young; \ 62#endif
46 __young = ptep_test_and_clear_young(__vma, __address, __ptep); \ 63
47 if (__young) \ 64#ifndef __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH
48 flush_tlb_page(__vma, __address); \ 65int pmdp_clear_flush_young(struct vm_area_struct *vma,
49 __young; \ 66 unsigned long address, pmd_t *pmdp);
50})
51#endif 67#endif
52 68
53#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR 69#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
54#define ptep_get_and_clear(__mm, __address, __ptep) \ 70static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
55({ \ 71 unsigned long address,
56 pte_t __pte = *(__ptep); \ 72 pte_t *ptep)
57 pte_clear((__mm), (__address), (__ptep)); \ 73{
58 __pte; \ 74 pte_t pte = *ptep;
75 pte_clear(mm, address, ptep);
76 return pte;
77}
78#endif
79
80#ifndef __HAVE_ARCH_PMDP_GET_AND_CLEAR
81#ifdef CONFIG_TRANSPARENT_HUGEPAGE
82static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
83 unsigned long address,
84 pmd_t *pmdp)
85{
86 pmd_t pmd = *pmdp;
87 pmd_clear(mm, address, pmdp);
88 return pmd;
59}) 89})
90#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
60#endif 91#endif
61 92
62#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL 93#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
63#define ptep_get_and_clear_full(__mm, __address, __ptep, __full) \ 94static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
64({ \ 95 unsigned long address, pte_t *ptep,
65 pte_t __pte; \ 96 int full)
66 __pte = ptep_get_and_clear((__mm), (__address), (__ptep)); \ 97{
67 __pte; \ 98 pte_t pte;
68}) 99 pte = ptep_get_and_clear(mm, address, ptep);
100 return pte;
101}
69#endif 102#endif
70 103
71/* 104/*
@@ -74,20 +107,25 @@
74 * not present, or in the process of an address space destruction. 107 * not present, or in the process of an address space destruction.
75 */ 108 */
76#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL 109#ifndef __HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL
77#define pte_clear_not_present_full(__mm, __address, __ptep, __full) \ 110static inline void pte_clear_not_present_full(struct mm_struct *mm,
78do { \ 111 unsigned long address,
79 pte_clear((__mm), (__address), (__ptep)); \ 112 pte_t *ptep,
80} while (0) 113 int full)
114{
115 pte_clear(mm, address, ptep);
116}
81#endif 117#endif
82 118
83#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH 119#ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
84#define ptep_clear_flush(__vma, __address, __ptep) \ 120extern pte_t ptep_clear_flush(struct vm_area_struct *vma,
85({ \ 121 unsigned long address,
86 pte_t __pte; \ 122 pte_t *ptep);
87 __pte = ptep_get_and_clear((__vma)->vm_mm, __address, __ptep); \ 123#endif
88 flush_tlb_page(__vma, __address); \ 124
89 __pte; \ 125#ifndef __HAVE_ARCH_PMDP_CLEAR_FLUSH
90}) 126extern pmd_t pmdp_clear_flush(struct vm_area_struct *vma,
127 unsigned long address,
128 pmd_t *pmdp);
91#endif 129#endif
92 130
93#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT 131#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
@@ -99,8 +137,49 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
99} 137}
100#endif 138#endif
101 139
140#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT
141#ifdef CONFIG_TRANSPARENT_HUGEPAGE
142static inline void pmdp_set_wrprotect(struct mm_struct *mm,
143 unsigned long address, pmd_t *pmdp)
144{
145 pmd_t old_pmd = *pmdp;
146 set_pmd_at(mm, address, pmdp, pmd_wrprotect(old_pmd));
147}
148#else /* CONFIG_TRANSPARENT_HUGEPAGE */
149static inline void pmdp_set_wrprotect(struct mm_struct *mm,
150 unsigned long address, pmd_t *pmdp)
151{
152 BUG();
153}
154#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
155#endif
156
157#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH
158extern pmd_t pmdp_splitting_flush(struct vm_area_struct *vma,
159 unsigned long address,
160 pmd_t *pmdp);
161#endif
162
102#ifndef __HAVE_ARCH_PTE_SAME 163#ifndef __HAVE_ARCH_PTE_SAME
103#define pte_same(A,B) (pte_val(A) == pte_val(B)) 164static inline int pte_same(pte_t pte_a, pte_t pte_b)
165{
166 return pte_val(pte_a) == pte_val(pte_b);
167}
168#endif
169
170#ifndef __HAVE_ARCH_PMD_SAME
171#ifdef CONFIG_TRANSPARENT_HUGEPAGE
172static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
173{
174 return pmd_val(pmd_a) == pmd_val(pmd_b);
175}
176#else /* CONFIG_TRANSPARENT_HUGEPAGE */
177static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
178{
179 BUG();
180 return 0;
181}
182#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
104#endif 183#endif
105 184
106#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY 185#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
@@ -348,6 +427,24 @@ extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
348 unsigned long size); 427 unsigned long size);
349#endif 428#endif
350 429
430#ifndef CONFIG_TRANSPARENT_HUGEPAGE
431static inline int pmd_trans_huge(pmd_t pmd)
432{
433 return 0;
434}
435static inline int pmd_trans_splitting(pmd_t pmd)
436{
437 return 0;
438}
439#ifndef __HAVE_ARCH_PMD_WRITE
440static inline int pmd_write(pmd_t pmd)
441{
442 BUG();
443 return 0;
444}
445#endif /* __HAVE_ARCH_PMD_WRITE */
446#endif
447
351#endif /* !__ASSEMBLY__ */ 448#endif /* !__ASSEMBLY__ */
352 449
353#endif /* _ASM_GENERIC_PGTABLE_H */ 450#endif /* _ASM_GENERIC_PGTABLE_H */
diff --git a/include/asm-generic/stat.h b/include/asm-generic/stat.h
index 47e64170305d..bd8cad21998e 100644
--- a/include/asm-generic/stat.h
+++ b/include/asm-generic/stat.h
@@ -33,18 +33,18 @@ struct stat {
33 int st_blksize; /* Optimal block size for I/O. */ 33 int st_blksize; /* Optimal block size for I/O. */
34 int __pad2; 34 int __pad2;
35 long st_blocks; /* Number 512-byte blocks allocated. */ 35 long st_blocks; /* Number 512-byte blocks allocated. */
36 int st_atime; /* Time of last access. */ 36 long st_atime; /* Time of last access. */
37 unsigned int st_atime_nsec; 37 unsigned long st_atime_nsec;
38 int st_mtime; /* Time of last modification. */ 38 long st_mtime; /* Time of last modification. */
39 unsigned int st_mtime_nsec; 39 unsigned long st_mtime_nsec;
40 int st_ctime; /* Time of last status change. */ 40 long st_ctime; /* Time of last status change. */
41 unsigned int st_ctime_nsec; 41 unsigned long st_ctime_nsec;
42 unsigned int __unused4; 42 unsigned int __unused4;
43 unsigned int __unused5; 43 unsigned int __unused5;
44}; 44};
45 45
46#if __BITS_PER_LONG != 64
47/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */ 46/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
47#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
48struct stat64 { 48struct stat64 {
49 unsigned long long st_dev; /* Device. */ 49 unsigned long long st_dev; /* Device. */
50 unsigned long long st_ino; /* File serial number. */ 50 unsigned long long st_ino; /* File serial number. */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index bd69d79208de..6ebb81030d2d 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -67,7 +67,8 @@
67 * Align to a 32 byte boundary equal to the 67 * Align to a 32 byte boundary equal to the
68 * alignment gcc 4.5 uses for a struct 68 * alignment gcc 4.5 uses for a struct
69 */ 69 */
70#define STRUCT_ALIGN() . = ALIGN(32) 70#define STRUCT_ALIGNMENT 32
71#define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
71 72
72/* The actual configuration determine if the init/exit sections 73/* The actual configuration determine if the init/exit sections
73 * are handled as text/data or they can be discarded (which 74 * are handled as text/data or they can be discarded (which
@@ -146,6 +147,13 @@
146#define TRACE_SYSCALLS() 147#define TRACE_SYSCALLS()
147#endif 148#endif
148 149
150
151#define KERNEL_DTB() \
152 STRUCT_ALIGN(); \
153 VMLINUX_SYMBOL(__dtb_start) = .; \
154 *(.dtb.init.rodata) \
155 VMLINUX_SYMBOL(__dtb_end) = .;
156
149/* .data section */ 157/* .data section */
150#define DATA_DATA \ 158#define DATA_DATA \
151 *(.data) \ 159 *(.data) \
@@ -192,7 +200,8 @@
192 200
193#define READ_MOSTLY_DATA(align) \ 201#define READ_MOSTLY_DATA(align) \
194 . = ALIGN(align); \ 202 . = ALIGN(align); \
195 *(.data..read_mostly) 203 *(.data..read_mostly) \
204 . = ALIGN(align);
196 205
197#define CACHELINE_ALIGNED_DATA(align) \ 206#define CACHELINE_ALIGNED_DATA(align) \
198 . = ALIGN(align); \ 207 . = ALIGN(align); \
@@ -355,6 +364,13 @@
355 VMLINUX_SYMBOL(__start___param) = .; \ 364 VMLINUX_SYMBOL(__start___param) = .; \
356 *(__param) \ 365 *(__param) \
357 VMLINUX_SYMBOL(__stop___param) = .; \ 366 VMLINUX_SYMBOL(__stop___param) = .; \
367 } \
368 \
369 /* Built-in module versions. */ \
370 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
371 VMLINUX_SYMBOL(__start___modver) = .; \
372 *(__modver) \
373 VMLINUX_SYMBOL(__stop___modver) = .; \
358 . = ALIGN((align)); \ 374 . = ALIGN((align)); \
359 VMLINUX_SYMBOL(__end_rodata) = .; \ 375 VMLINUX_SYMBOL(__end_rodata) = .; \
360 } \ 376 } \
@@ -468,7 +484,8 @@
468 MCOUNT_REC() \ 484 MCOUNT_REC() \
469 DEV_DISCARD(init.rodata) \ 485 DEV_DISCARD(init.rodata) \
470 CPU_DISCARD(init.rodata) \ 486 CPU_DISCARD(init.rodata) \
471 MEM_DISCARD(init.rodata) 487 MEM_DISCARD(init.rodata) \
488 KERNEL_DTB()
472 489
473#define INIT_TEXT \ 490#define INIT_TEXT \
474 *(.init.text) \ 491 *(.init.text) \