diff options
Diffstat (limited to 'include/asm-generic')
| -rw-r--r-- | include/asm-generic/cputime_nsecs.h | 28 | ||||
| -rw-r--r-- | include/asm-generic/hugetlb.h | 40 | ||||
| -rw-r--r-- | include/asm-generic/pgtable.h | 10 | ||||
| -rw-r--r-- | include/asm-generic/tlb.h | 7 | ||||
| -rw-r--r-- | include/asm-generic/unistd.h | 18 | ||||
| -rw-r--r-- | include/asm-generic/vmlinux.lds.h | 8 |
6 files changed, 77 insertions, 34 deletions
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index a8ece9a33aef..2c9e62c2bfd0 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h | |||
| @@ -16,21 +16,27 @@ | |||
| 16 | #ifndef _ASM_GENERIC_CPUTIME_NSECS_H | 16 | #ifndef _ASM_GENERIC_CPUTIME_NSECS_H |
| 17 | #define _ASM_GENERIC_CPUTIME_NSECS_H | 17 | #define _ASM_GENERIC_CPUTIME_NSECS_H |
| 18 | 18 | ||
| 19 | #include <linux/math64.h> | ||
| 20 | |||
| 19 | typedef u64 __nocast cputime_t; | 21 | typedef u64 __nocast cputime_t; |
| 20 | typedef u64 __nocast cputime64_t; | 22 | typedef u64 __nocast cputime64_t; |
| 21 | 23 | ||
| 22 | #define cputime_one_jiffy jiffies_to_cputime(1) | 24 | #define cputime_one_jiffy jiffies_to_cputime(1) |
| 23 | 25 | ||
| 26 | #define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor) | ||
| 27 | #define cputime_div_rem(__ct, divisor, remainder) \ | ||
| 28 | div_u64_rem((__force u64)__ct, divisor, remainder); | ||
| 29 | |||
| 24 | /* | 30 | /* |
| 25 | * Convert cputime <-> jiffies (HZ) | 31 | * Convert cputime <-> jiffies (HZ) |
| 26 | */ | 32 | */ |
| 27 | #define cputime_to_jiffies(__ct) \ | 33 | #define cputime_to_jiffies(__ct) \ |
| 28 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) | 34 | cputime_div(__ct, NSEC_PER_SEC / HZ) |
| 29 | #define cputime_to_scaled(__ct) (__ct) | 35 | #define cputime_to_scaled(__ct) (__ct) |
| 30 | #define jiffies_to_cputime(__jif) \ | 36 | #define jiffies_to_cputime(__jif) \ |
| 31 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) | 37 | (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) |
| 32 | #define cputime64_to_jiffies64(__ct) \ | 38 | #define cputime64_to_jiffies64(__ct) \ |
| 33 | ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) | 39 | cputime_div(__ct, NSEC_PER_SEC / HZ) |
| 34 | #define jiffies64_to_cputime64(__jif) \ | 40 | #define jiffies64_to_cputime64(__jif) \ |
| 35 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) | 41 | (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) |
| 36 | 42 | ||
| @@ -45,7 +51,7 @@ typedef u64 __nocast cputime64_t; | |||
| 45 | * Convert cputime <-> microseconds | 51 | * Convert cputime <-> microseconds |
| 46 | */ | 52 | */ |
| 47 | #define cputime_to_usecs(__ct) \ | 53 | #define cputime_to_usecs(__ct) \ |
| 48 | ((__force u64)(__ct) / NSEC_PER_USEC) | 54 | cputime_div(__ct, NSEC_PER_USEC) |
| 49 | #define usecs_to_cputime(__usecs) \ | 55 | #define usecs_to_cputime(__usecs) \ |
| 50 | (__force cputime_t)((__usecs) * NSEC_PER_USEC) | 56 | (__force cputime_t)((__usecs) * NSEC_PER_USEC) |
| 51 | #define usecs_to_cputime64(__usecs) \ | 57 | #define usecs_to_cputime64(__usecs) \ |
| @@ -55,7 +61,7 @@ typedef u64 __nocast cputime64_t; | |||
| 55 | * Convert cputime <-> seconds | 61 | * Convert cputime <-> seconds |
| 56 | */ | 62 | */ |
| 57 | #define cputime_to_secs(__ct) \ | 63 | #define cputime_to_secs(__ct) \ |
| 58 | ((__force u64)(__ct) / NSEC_PER_SEC) | 64 | cputime_div(__ct, NSEC_PER_SEC) |
| 59 | #define secs_to_cputime(__secs) \ | 65 | #define secs_to_cputime(__secs) \ |
| 60 | (__force cputime_t)((__secs) * NSEC_PER_SEC) | 66 | (__force cputime_t)((__secs) * NSEC_PER_SEC) |
| 61 | 67 | ||
| @@ -69,8 +75,10 @@ static inline cputime_t timespec_to_cputime(const struct timespec *val) | |||
| 69 | } | 75 | } |
| 70 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | 76 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) |
| 71 | { | 77 | { |
| 72 | val->tv_sec = (__force u64) ct / NSEC_PER_SEC; | 78 | u32 rem; |
| 73 | val->tv_nsec = (__force u64) ct % NSEC_PER_SEC; | 79 | |
| 80 | val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem); | ||
| 81 | val->tv_nsec = rem; | ||
| 74 | } | 82 | } |
| 75 | 83 | ||
| 76 | /* | 84 | /* |
| @@ -83,15 +91,17 @@ static inline cputime_t timeval_to_cputime(const struct timeval *val) | |||
| 83 | } | 91 | } |
| 84 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) | 92 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) |
| 85 | { | 93 | { |
| 86 | val->tv_sec = (__force u64) ct / NSEC_PER_SEC; | 94 | u32 rem; |
| 87 | val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC; | 95 | |
| 96 | val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem); | ||
| 97 | val->tv_usec = rem / NSEC_PER_USEC; | ||
| 88 | } | 98 | } |
| 89 | 99 | ||
| 90 | /* | 100 | /* |
| 91 | * Convert cputime <-> clock (USER_HZ) | 101 | * Convert cputime <-> clock (USER_HZ) |
| 92 | */ | 102 | */ |
| 93 | #define cputime_to_clock_t(__ct) \ | 103 | #define cputime_to_clock_t(__ct) \ |
| 94 | ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ)) | 104 | cputime_div(__ct, (NSEC_PER_SEC / USER_HZ)) |
| 95 | #define clock_t_to_cputime(__x) \ | 105 | #define clock_t_to_cputime(__x) \ |
| 96 | (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) | 106 | (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) |
| 97 | 107 | ||
diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h new file mode 100644 index 000000000000..d06079c774a0 --- /dev/null +++ b/include/asm-generic/hugetlb.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #ifndef _ASM_GENERIC_HUGETLB_H | ||
| 2 | #define _ASM_GENERIC_HUGETLB_H | ||
| 3 | |||
| 4 | static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot) | ||
| 5 | { | ||
| 6 | return mk_pte(page, pgprot); | ||
| 7 | } | ||
| 8 | |||
| 9 | static inline int huge_pte_write(pte_t pte) | ||
| 10 | { | ||
| 11 | return pte_write(pte); | ||
| 12 | } | ||
| 13 | |||
| 14 | static inline int huge_pte_dirty(pte_t pte) | ||
| 15 | { | ||
| 16 | return pte_dirty(pte); | ||
| 17 | } | ||
| 18 | |||
| 19 | static inline pte_t huge_pte_mkwrite(pte_t pte) | ||
| 20 | { | ||
| 21 | return pte_mkwrite(pte); | ||
| 22 | } | ||
| 23 | |||
| 24 | static inline pte_t huge_pte_mkdirty(pte_t pte) | ||
| 25 | { | ||
| 26 | return pte_mkdirty(pte); | ||
| 27 | } | ||
| 28 | |||
| 29 | static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) | ||
| 30 | { | ||
| 31 | return pte_modify(pte, newprot); | ||
| 32 | } | ||
| 33 | |||
| 34 | static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, | ||
| 35 | pte_t *ptep) | ||
| 36 | { | ||
| 37 | pte_clear(mm, addr, ptep); | ||
| 38 | } | ||
| 39 | |||
| 40 | #endif /* _ASM_GENERIC_HUGETLB_H */ | ||
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index bfd87685fc1f..a59ff51b0166 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
| @@ -7,6 +7,16 @@ | |||
| 7 | #include <linux/mm_types.h> | 7 | #include <linux/mm_types.h> |
| 8 | #include <linux/bug.h> | 8 | #include <linux/bug.h> |
| 9 | 9 | ||
| 10 | /* | ||
| 11 | * On almost all architectures and configurations, 0 can be used as the | ||
| 12 | * upper ceiling to free_pgtables(): on many architectures it has the same | ||
| 13 | * effect as using TASK_SIZE. However, there is one configuration which | ||
| 14 | * must impose a more careful limit, to avoid freeing kernel pgtables. | ||
| 15 | */ | ||
| 16 | #ifndef USER_PGTABLES_CEILING | ||
| 17 | #define USER_PGTABLES_CEILING 0UL | ||
| 18 | #endif | ||
| 19 | |||
| 10 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 20 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
| 11 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 21 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
| 12 | unsigned long address, pte_t *ptep, | 22 | unsigned long address, pte_t *ptep, |
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 25f01d0bc149..b1b1fa6ffffe 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h | |||
| @@ -99,7 +99,12 @@ struct mmu_gather { | |||
| 99 | unsigned int need_flush : 1, /* Did free PTEs */ | 99 | unsigned int need_flush : 1, /* Did free PTEs */ |
| 100 | fast_mode : 1; /* No batching */ | 100 | fast_mode : 1; /* No batching */ |
| 101 | 101 | ||
| 102 | unsigned int fullmm; | 102 | /* we are in the middle of an operation to clear |
| 103 | * a full mm and can make some optimizations */ | ||
| 104 | unsigned int fullmm : 1, | ||
| 105 | /* we have performed an operation which | ||
| 106 | * requires a complete flush of the tlb */ | ||
| 107 | need_flush_all : 1; | ||
| 103 | 108 | ||
| 104 | struct mmu_gather_batch *active; | 109 | struct mmu_gather_batch *active; |
| 105 | struct mmu_gather_batch local; | 110 | struct mmu_gather_batch local; |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 4077b5d9ff81..cccc86ecfeaa 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | #include <uapi/asm-generic/unistd.h> | 1 | #include <uapi/asm-generic/unistd.h> |
| 2 | #include <linux/export.h> | ||
| 2 | 3 | ||
| 3 | /* | 4 | /* |
| 4 | * These are required system calls, we should | 5 | * These are required system calls, we should |
| @@ -9,20 +10,3 @@ | |||
| 9 | #define __ARCH_WANT_STAT64 | 10 | #define __ARCH_WANT_STAT64 |
| 10 | #define __ARCH_WANT_SYS_LLSEEK | 11 | #define __ARCH_WANT_SYS_LLSEEK |
| 11 | #endif | 12 | #endif |
| 12 | |||
| 13 | /* | ||
| 14 | * "Conditional" syscalls | ||
| 15 | * | ||
| 16 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
| 17 | * but it doesn't work on all toolchains, so we just do it by hand | ||
| 18 | */ | ||
| 19 | #ifndef cond_syscall | ||
| 20 | #ifdef CONFIG_SYMBOL_PREFIX | ||
| 21 | #define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
| 22 | #else | ||
| 23 | #define __SYMBOL_PREFIX | ||
| 24 | #endif | ||
| 25 | #define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \ | ||
| 26 | ".set\t" __SYMBOL_PREFIX #x "," \ | ||
| 27 | __SYMBOL_PREFIX "sys_ni_syscall") | ||
| 28 | #endif | ||
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index afa12c7a025c..eb58d2d7d971 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -52,13 +52,7 @@ | |||
| 52 | #define LOAD_OFFSET 0 | 52 | #define LOAD_OFFSET 0 |
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | #ifndef SYMBOL_PREFIX | 55 | #include <linux/export.h> |
| 56 | #define VMLINUX_SYMBOL(sym) sym | ||
| 57 | #else | ||
| 58 | #define PASTE2(x,y) x##y | ||
| 59 | #define PASTE(x,y) PASTE2(x,y) | ||
| 60 | #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym) | ||
| 61 | #endif | ||
| 62 | 56 | ||
| 63 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ | 57 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
| 64 | #define ALIGN_FUNCTION() . = ALIGN(8) | 58 | #define ALIGN_FUNCTION() . = ALIGN(8) |
