diff options
Diffstat (limited to 'include/asm-generic')
| -rw-r--r-- | include/asm-generic/atomic.h | 194 | ||||
| -rw-r--r-- | include/asm-generic/atomic64.h | 20 | ||||
| -rw-r--r-- | include/asm-generic/clkdev.h | 2 | ||||
| -rw-r--r-- | include/asm-generic/cputime_jiffies.h | 2 | ||||
| -rw-r--r-- | include/asm-generic/cputime_nsecs.h | 2 | ||||
| -rw-r--r-- | include/asm-generic/dma-contiguous.h | 9 | ||||
| -rw-r--r-- | include/asm-generic/dma-mapping-common.h | 17 | ||||
| -rw-r--r-- | include/asm-generic/gpio.h | 5 | ||||
| -rw-r--r-- | include/asm-generic/io.h | 2 | ||||
| -rw-r--r-- | include/asm-generic/irq_work.h | 10 | ||||
| -rw-r--r-- | include/asm-generic/pci-dma-compat.h | 8 | ||||
| -rw-r--r-- | include/asm-generic/pgtable.h | 45 | ||||
| -rw-r--r-- | include/asm-generic/sections.h | 4 | ||||
| -rw-r--r-- | include/asm-generic/syscall.h | 2 | ||||
| -rw-r--r-- | include/asm-generic/vmlinux.lds.h | 2 |
15 files changed, 191 insertions, 133 deletions
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 9c79e7603459..1973ad2b13f4 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
| @@ -18,14 +18,100 @@ | |||
| 18 | #include <asm/cmpxchg.h> | 18 | #include <asm/cmpxchg.h> |
| 19 | #include <asm/barrier.h> | 19 | #include <asm/barrier.h> |
| 20 | 20 | ||
| 21 | /* | ||
| 22 | * atomic_$op() - $op integer to atomic variable | ||
| 23 | * @i: integer value to $op | ||
| 24 | * @v: pointer to the atomic variable | ||
| 25 | * | ||
| 26 | * Atomically $ops @i to @v. Does not strictly guarantee a memory-barrier, use | ||
| 27 | * smp_mb__{before,after}_atomic(). | ||
| 28 | */ | ||
| 29 | |||
| 30 | /* | ||
| 31 | * atomic_$op_return() - $op interer to atomic variable and returns the result | ||
| 32 | * @i: integer value to $op | ||
| 33 | * @v: pointer to the atomic variable | ||
| 34 | * | ||
| 35 | * Atomically $ops @i to @v. Does imply a full memory barrier. | ||
| 36 | */ | ||
| 37 | |||
| 21 | #ifdef CONFIG_SMP | 38 | #ifdef CONFIG_SMP |
| 22 | /* Force people to define core atomics */ | 39 | |
| 23 | # if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ | 40 | /* we can build all atomic primitives from cmpxchg */ |
| 24 | !defined(atomic_clear_mask) || !defined(atomic_set_mask) | 41 | |
| 25 | # error "SMP requires a little arch-specific magic" | 42 | #define ATOMIC_OP(op, c_op) \ |
| 26 | # endif | 43 | static inline void atomic_##op(int i, atomic_t *v) \ |
| 44 | { \ | ||
| 45 | int c, old; \ | ||
| 46 | \ | ||
| 47 | c = v->counter; \ | ||
| 48 | while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \ | ||
| 49 | c = old; \ | ||
| 50 | } | ||
| 51 | |||
| 52 | #define ATOMIC_OP_RETURN(op, c_op) \ | ||
| 53 | static inline int atomic_##op##_return(int i, atomic_t *v) \ | ||
| 54 | { \ | ||
| 55 | int c, old; \ | ||
| 56 | \ | ||
| 57 | c = v->counter; \ | ||
| 58 | while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \ | ||
| 59 | c = old; \ | ||
| 60 | \ | ||
| 61 | return c c_op i; \ | ||
| 62 | } | ||
| 63 | |||
| 64 | #else | ||
| 65 | |||
| 66 | #include <linux/irqflags.h> | ||
| 67 | |||
| 68 | #define ATOMIC_OP(op, c_op) \ | ||
| 69 | static inline void atomic_##op(int i, atomic_t *v) \ | ||
| 70 | { \ | ||
| 71 | unsigned long flags; \ | ||
| 72 | \ | ||
| 73 | raw_local_irq_save(flags); \ | ||
| 74 | v->counter = v->counter c_op i; \ | ||
| 75 | raw_local_irq_restore(flags); \ | ||
| 76 | } | ||
| 77 | |||
| 78 | #define ATOMIC_OP_RETURN(op, c_op) \ | ||
| 79 | static inline int atomic_##op##_return(int i, atomic_t *v) \ | ||
| 80 | { \ | ||
| 81 | unsigned long flags; \ | ||
| 82 | int ret; \ | ||
| 83 | \ | ||
| 84 | raw_local_irq_save(flags); \ | ||
| 85 | ret = (v->counter = v->counter c_op i); \ | ||
| 86 | raw_local_irq_restore(flags); \ | ||
| 87 | \ | ||
| 88 | return ret; \ | ||
| 89 | } | ||
| 90 | |||
| 91 | #endif /* CONFIG_SMP */ | ||
| 92 | |||
| 93 | #ifndef atomic_add_return | ||
| 94 | ATOMIC_OP_RETURN(add, +) | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifndef atomic_sub_return | ||
| 98 | ATOMIC_OP_RETURN(sub, -) | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #ifndef atomic_clear_mask | ||
| 102 | ATOMIC_OP(and, &) | ||
| 103 | #define atomic_clear_mask(i, v) atomic_and(~(i), (v)) | ||
| 27 | #endif | 104 | #endif |
| 28 | 105 | ||
| 106 | #ifndef atomic_set_mask | ||
| 107 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
| 108 | ATOMIC_OP(or, |) | ||
| 109 | #define atomic_set_mask(i, v) atomic_or((i), (v)) | ||
| 110 | #endif | ||
| 111 | |||
| 112 | #undef ATOMIC_OP_RETURN | ||
| 113 | #undef ATOMIC_OP | ||
| 114 | |||
| 29 | /* | 115 | /* |
| 30 | * Atomic operations that C can't guarantee us. Useful for | 116 | * Atomic operations that C can't guarantee us. Useful for |
| 31 | * resource counting etc.. | 117 | * resource counting etc.. |
| @@ -33,8 +119,6 @@ | |||
| 33 | 119 | ||
| 34 | #define ATOMIC_INIT(i) { (i) } | 120 | #define ATOMIC_INIT(i) { (i) } |
| 35 | 121 | ||
| 36 | #ifdef __KERNEL__ | ||
| 37 | |||
| 38 | /** | 122 | /** |
| 39 | * atomic_read - read atomic variable | 123 | * atomic_read - read atomic variable |
| 40 | * @v: pointer of type atomic_t | 124 | * @v: pointer of type atomic_t |
| @@ -42,7 +126,7 @@ | |||
| 42 | * Atomically reads the value of @v. | 126 | * Atomically reads the value of @v. |
| 43 | */ | 127 | */ |
| 44 | #ifndef atomic_read | 128 | #ifndef atomic_read |
| 45 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 129 | #define atomic_read(v) ACCESS_ONCE((v)->counter) |
| 46 | #endif | 130 | #endif |
| 47 | 131 | ||
| 48 | /** | 132 | /** |
| @@ -56,52 +140,6 @@ | |||
| 56 | 140 | ||
| 57 | #include <linux/irqflags.h> | 141 | #include <linux/irqflags.h> |
| 58 | 142 | ||
| 59 | /** | ||
| 60 | * atomic_add_return - add integer to atomic variable | ||
| 61 | * @i: integer value to add | ||
| 62 | * @v: pointer of type atomic_t | ||
| 63 | * | ||
| 64 | * Atomically adds @i to @v and returns the result | ||
| 65 | */ | ||
| 66 | #ifndef atomic_add_return | ||
| 67 | static inline int atomic_add_return(int i, atomic_t *v) | ||
| 68 | { | ||
| 69 | unsigned long flags; | ||
| 70 | int temp; | ||
| 71 | |||
| 72 | raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */ | ||
| 73 | temp = v->counter; | ||
| 74 | temp += i; | ||
| 75 | v->counter = temp; | ||
| 76 | raw_local_irq_restore(flags); | ||
| 77 | |||
| 78 | return temp; | ||
| 79 | } | ||
| 80 | #endif | ||
| 81 | |||
| 82 | /** | ||
| 83 | * atomic_sub_return - subtract integer from atomic variable | ||
| 84 | * @i: integer value to subtract | ||
| 85 | * @v: pointer of type atomic_t | ||
| 86 | * | ||
| 87 | * Atomically subtracts @i from @v and returns the result | ||
| 88 | */ | ||
| 89 | #ifndef atomic_sub_return | ||
| 90 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
| 91 | { | ||
| 92 | unsigned long flags; | ||
| 93 | int temp; | ||
| 94 | |||
| 95 | raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */ | ||
| 96 | temp = v->counter; | ||
| 97 | temp -= i; | ||
| 98 | v->counter = temp; | ||
| 99 | raw_local_irq_restore(flags); | ||
| 100 | |||
| 101 | return temp; | ||
| 102 | } | ||
| 103 | #endif | ||
| 104 | |||
| 105 | static inline int atomic_add_negative(int i, atomic_t *v) | 143 | static inline int atomic_add_negative(int i, atomic_t *v) |
| 106 | { | 144 | { |
| 107 | return atomic_add_return(i, v) < 0; | 145 | return atomic_add_return(i, v) < 0; |
| @@ -139,49 +177,11 @@ static inline void atomic_dec(atomic_t *v) | |||
| 139 | 177 | ||
| 140 | static inline int __atomic_add_unless(atomic_t *v, int a, int u) | 178 | static inline int __atomic_add_unless(atomic_t *v, int a, int u) |
| 141 | { | 179 | { |
| 142 | int c, old; | 180 | int c, old; |
| 143 | c = atomic_read(v); | 181 | c = atomic_read(v); |
| 144 | while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c) | 182 | while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c) |
| 145 | c = old; | 183 | c = old; |
| 146 | return c; | 184 | return c; |
| 147 | } | ||
| 148 | |||
| 149 | /** | ||
| 150 | * atomic_clear_mask - Atomically clear bits in atomic variable | ||
| 151 | * @mask: Mask of the bits to be cleared | ||
| 152 | * @v: pointer of type atomic_t | ||
| 153 | * | ||
| 154 | * Atomically clears the bits set in @mask from @v | ||
| 155 | */ | ||
| 156 | #ifndef atomic_clear_mask | ||
| 157 | static inline void atomic_clear_mask(unsigned long mask, atomic_t *v) | ||
| 158 | { | ||
| 159 | unsigned long flags; | ||
| 160 | |||
| 161 | mask = ~mask; | ||
| 162 | raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */ | ||
| 163 | v->counter &= mask; | ||
| 164 | raw_local_irq_restore(flags); | ||
| 165 | } | 185 | } |
| 166 | #endif | ||
| 167 | |||
| 168 | /** | ||
| 169 | * atomic_set_mask - Atomically set bits in atomic variable | ||
| 170 | * @mask: Mask of the bits to be set | ||
| 171 | * @v: pointer of type atomic_t | ||
| 172 | * | ||
| 173 | * Atomically sets the bits set in @mask in @v | ||
| 174 | */ | ||
| 175 | #ifndef atomic_set_mask | ||
| 176 | static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
| 177 | { | ||
| 178 | unsigned long flags; | ||
| 179 | |||
| 180 | raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */ | ||
| 181 | v->counter |= mask; | ||
| 182 | raw_local_irq_restore(flags); | ||
| 183 | } | ||
| 184 | #endif | ||
| 185 | 186 | ||
| 186 | #endif /* __KERNEL__ */ | ||
| 187 | #endif /* __ASM_GENERIC_ATOMIC_H */ | 187 | #endif /* __ASM_GENERIC_ATOMIC_H */ |
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h index b18ce4f9ee3d..30ad9c86cebb 100644 --- a/include/asm-generic/atomic64.h +++ b/include/asm-generic/atomic64.h | |||
| @@ -20,10 +20,22 @@ typedef struct { | |||
| 20 | 20 | ||
| 21 | extern long long atomic64_read(const atomic64_t *v); | 21 | extern long long atomic64_read(const atomic64_t *v); |
| 22 | extern void atomic64_set(atomic64_t *v, long long i); | 22 | extern void atomic64_set(atomic64_t *v, long long i); |
| 23 | extern void atomic64_add(long long a, atomic64_t *v); | 23 | |
| 24 | extern long long atomic64_add_return(long long a, atomic64_t *v); | 24 | #define ATOMIC64_OP(op) \ |
| 25 | extern void atomic64_sub(long long a, atomic64_t *v); | 25 | extern void atomic64_##op(long long a, atomic64_t *v); |
| 26 | extern long long atomic64_sub_return(long long a, atomic64_t *v); | 26 | |
| 27 | #define ATOMIC64_OP_RETURN(op) \ | ||
| 28 | extern long long atomic64_##op##_return(long long a, atomic64_t *v); | ||
| 29 | |||
| 30 | #define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) | ||
| 31 | |||
| 32 | ATOMIC64_OPS(add) | ||
| 33 | ATOMIC64_OPS(sub) | ||
| 34 | |||
| 35 | #undef ATOMIC64_OPS | ||
| 36 | #undef ATOMIC64_OP_RETURN | ||
| 37 | #undef ATOMIC64_OP | ||
| 38 | |||
| 27 | extern long long atomic64_dec_if_positive(atomic64_t *v); | 39 | extern long long atomic64_dec_if_positive(atomic64_t *v); |
| 28 | extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n); | 40 | extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n); |
| 29 | extern long long atomic64_xchg(atomic64_t *v, long long new); | 41 | extern long long atomic64_xchg(atomic64_t *v, long long new); |
diff --git a/include/asm-generic/clkdev.h b/include/asm-generic/clkdev.h index 90a32a61dd21..4ff334749ed5 100644 --- a/include/asm-generic/clkdev.h +++ b/include/asm-generic/clkdev.h | |||
| @@ -15,10 +15,12 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | 17 | ||
| 18 | #ifndef CONFIG_COMMON_CLK | ||
| 18 | struct clk; | 19 | struct clk; |
| 19 | 20 | ||
| 20 | static inline int __clk_get(struct clk *clk) { return 1; } | 21 | static inline int __clk_get(struct clk *clk) { return 1; } |
| 21 | static inline void __clk_put(struct clk *clk) { } | 22 | static inline void __clk_put(struct clk *clk) { } |
| 23 | #endif | ||
| 22 | 24 | ||
| 23 | static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) | 25 | static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) |
| 24 | { | 26 | { |
diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h index d5cb78f53986..fe386fc6e85e 100644 --- a/include/asm-generic/cputime_jiffies.h +++ b/include/asm-generic/cputime_jiffies.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | typedef unsigned long __nocast cputime_t; | 4 | typedef unsigned long __nocast cputime_t; |
| 5 | 5 | ||
| 6 | #define cmpxchg_cputime(ptr, old, new) cmpxchg(ptr, old, new) | ||
| 7 | |||
| 6 | #define cputime_one_jiffy jiffies_to_cputime(1) | 8 | #define cputime_one_jiffy jiffies_to_cputime(1) |
| 7 | #define cputime_to_jiffies(__ct) (__force unsigned long)(__ct) | 9 | #define cputime_to_jiffies(__ct) (__force unsigned long)(__ct) |
| 8 | #define cputime_to_scaled(__ct) (__ct) | 10 | #define cputime_to_scaled(__ct) (__ct) |
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index 4e817606c549..0419485891f2 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | typedef u64 __nocast cputime_t; | 21 | typedef u64 __nocast cputime_t; |
| 22 | typedef u64 __nocast cputime64_t; | 22 | typedef u64 __nocast cputime64_t; |
| 23 | 23 | ||
| 24 | #define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new) | ||
| 25 | |||
| 24 | #define cputime_one_jiffy jiffies_to_cputime(1) | 26 | #define cputime_one_jiffy jiffies_to_cputime(1) |
| 25 | 27 | ||
| 26 | #define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor) | 28 | #define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor) |
diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h new file mode 100644 index 000000000000..292c571750f0 --- /dev/null +++ b/include/asm-generic/dma-contiguous.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #ifndef _ASM_GENERIC_DMA_CONTIGUOUS_H | ||
| 2 | #define _ASM_GENERIC_DMA_CONTIGUOUS_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | static inline void | ||
| 7 | dma_contiguous_early_fixup(phys_addr_t base, unsigned long size) { } | ||
| 8 | |||
| 9 | #endif | ||
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h index de8bf89940f8..3378dcf4c31e 100644 --- a/include/asm-generic/dma-mapping-common.h +++ b/include/asm-generic/dma-mapping-common.h | |||
| @@ -179,6 +179,15 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
| 179 | extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, | 179 | extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, |
| 180 | void *cpu_addr, dma_addr_t dma_addr, size_t size); | 180 | void *cpu_addr, dma_addr_t dma_addr, size_t size); |
| 181 | 181 | ||
| 182 | void *dma_common_contiguous_remap(struct page *page, size_t size, | ||
| 183 | unsigned long vm_flags, | ||
| 184 | pgprot_t prot, const void *caller); | ||
| 185 | |||
| 186 | void *dma_common_pages_remap(struct page **pages, size_t size, | ||
| 187 | unsigned long vm_flags, pgprot_t prot, | ||
| 188 | const void *caller); | ||
| 189 | void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags); | ||
| 190 | |||
| 182 | /** | 191 | /** |
| 183 | * dma_mmap_attrs - map a coherent DMA allocation into user space | 192 | * dma_mmap_attrs - map a coherent DMA allocation into user space |
| 184 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | 193 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices |
| @@ -205,14 +214,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, | |||
| 205 | 214 | ||
| 206 | #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) | 215 | #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) |
| 207 | 216 | ||
| 208 | static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma, | ||
| 209 | void *cpu_addr, dma_addr_t dma_addr, size_t size) | ||
| 210 | { | ||
| 211 | DEFINE_DMA_ATTRS(attrs); | ||
| 212 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
| 213 | return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); | ||
| 214 | } | ||
| 215 | |||
| 216 | int | 217 | int |
| 217 | dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, | 218 | dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, |
| 218 | void *cpu_addr, dma_addr_t dma_addr, size_t size); | 219 | void *cpu_addr, dma_addr_t dma_addr, size_t size); |
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 23e364538ab5..383ade1a211b 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | #ifndef ARCH_NR_GPIOS | 29 | #ifndef ARCH_NR_GPIOS |
| 30 | #define ARCH_NR_GPIOS 256 | 30 | #define ARCH_NR_GPIOS 512 |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| @@ -110,9 +110,6 @@ static inline int __gpio_to_irq(unsigned gpio) | |||
| 110 | return gpiod_to_irq(gpio_to_desc(gpio)); | 110 | return gpiod_to_irq(gpio_to_desc(gpio)); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | extern int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset); | ||
| 114 | extern void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); | ||
| 115 | |||
| 116 | extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); | 113 | extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); |
| 117 | extern int gpio_request_array(const struct gpio *array, size_t num); | 114 | extern int gpio_request_array(const struct gpio *array, size_t num); |
| 118 | extern void gpio_free_array(const struct gpio *array, size_t num); | 115 | extern void gpio_free_array(const struct gpio *array, size_t num); |
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 975e1cc75edb..b8fdc57a7335 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h | |||
| @@ -331,7 +331,7 @@ static inline void iounmap(void __iomem *addr) | |||
| 331 | #ifndef CONFIG_GENERIC_IOMAP | 331 | #ifndef CONFIG_GENERIC_IOMAP |
| 332 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | 332 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) |
| 333 | { | 333 | { |
| 334 | return (void __iomem *) port; | 334 | return PCI_IOBASE + (port & IO_SPACE_LIMIT); |
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | static inline void ioport_unmap(void __iomem *p) | 337 | static inline void ioport_unmap(void __iomem *p) |
diff --git a/include/asm-generic/irq_work.h b/include/asm-generic/irq_work.h new file mode 100644 index 000000000000..a44f452c6590 --- /dev/null +++ b/include/asm-generic/irq_work.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef __ASM_IRQ_WORK_H | ||
| 2 | #define __ASM_IRQ_WORK_H | ||
| 3 | |||
| 4 | static inline bool arch_irq_work_has_interrupt(void) | ||
| 5 | { | ||
| 6 | return false; | ||
| 7 | } | ||
| 8 | |||
| 9 | #endif /* __ASM_IRQ_WORK_H */ | ||
| 10 | |||
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h index 1437b7da09b2..c110843fc53b 100644 --- a/include/asm-generic/pci-dma-compat.h +++ b/include/asm-generic/pci-dma-compat.h | |||
| @@ -19,6 +19,14 @@ pci_alloc_consistent(struct pci_dev *hwdev, size_t size, | |||
| 19 | return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); | 19 | return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | static inline void * | ||
| 23 | pci_zalloc_consistent(struct pci_dev *hwdev, size_t size, | ||
| 24 | dma_addr_t *dma_handle) | ||
| 25 | { | ||
| 26 | return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, | ||
| 27 | size, dma_handle, GFP_ATOMIC); | ||
| 28 | } | ||
| 29 | |||
| 22 | static inline void | 30 | static inline void |
| 23 | pci_free_consistent(struct pci_dev *hwdev, size_t size, | 31 | pci_free_consistent(struct pci_dev *hwdev, size_t size, |
| 24 | void *vaddr, dma_addr_t dma_handle) | 32 | void *vaddr, dma_addr_t dma_handle) |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 53b2acc38213..752e30d63904 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
| @@ -249,6 +249,24 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) | |||
| 249 | #define pgprot_writecombine pgprot_noncached | 249 | #define pgprot_writecombine pgprot_noncached |
| 250 | #endif | 250 | #endif |
| 251 | 251 | ||
| 252 | #ifndef pgprot_device | ||
| 253 | #define pgprot_device pgprot_noncached | ||
| 254 | #endif | ||
| 255 | |||
| 256 | #ifndef pgprot_modify | ||
| 257 | #define pgprot_modify pgprot_modify | ||
| 258 | static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) | ||
| 259 | { | ||
| 260 | if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot))) | ||
| 261 | newprot = pgprot_noncached(newprot); | ||
| 262 | if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot))) | ||
| 263 | newprot = pgprot_writecombine(newprot); | ||
| 264 | if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot))) | ||
| 265 | newprot = pgprot_device(newprot); | ||
| 266 | return newprot; | ||
| 267 | } | ||
| 268 | #endif | ||
| 269 | |||
| 252 | /* | 270 | /* |
| 253 | * When walking page tables, get the address of the next boundary, | 271 | * When walking page tables, get the address of the next boundary, |
| 254 | * or the end address of the range if that comes earlier. Although no | 272 | * or the end address of the range if that comes earlier. Although no |
| @@ -660,11 +678,12 @@ static inline int pmd_trans_unstable(pmd_t *pmd) | |||
| 660 | } | 678 | } |
| 661 | 679 | ||
| 662 | #ifdef CONFIG_NUMA_BALANCING | 680 | #ifdef CONFIG_NUMA_BALANCING |
| 663 | #ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE | ||
| 664 | /* | 681 | /* |
| 665 | * _PAGE_NUMA works identical to _PAGE_PROTNONE (it's actually the | 682 | * _PAGE_NUMA distinguishes between an unmapped page table entry, an entry that |
| 666 | * same bit too). It's set only when _PAGE_PRESET is not set and it's | 683 | * is protected for PROT_NONE and a NUMA hinting fault entry. If the |
| 667 | * never set if _PAGE_PRESENT is set. | 684 | * architecture defines __PAGE_PROTNONE then it should take that into account |
| 685 | * but those that do not can rely on the fact that the NUMA hinting scanner | ||
| 686 | * skips inaccessible VMAs. | ||
| 668 | * | 687 | * |
| 669 | * pte/pmd_present() returns true if pte/pmd_numa returns true. Page | 688 | * pte/pmd_present() returns true if pte/pmd_numa returns true. Page |
| 670 | * fault triggers on those regions if pte/pmd_numa returns true | 689 | * fault triggers on those regions if pte/pmd_numa returns true |
| @@ -673,16 +692,14 @@ static inline int pmd_trans_unstable(pmd_t *pmd) | |||
| 673 | #ifndef pte_numa | 692 | #ifndef pte_numa |
| 674 | static inline int pte_numa(pte_t pte) | 693 | static inline int pte_numa(pte_t pte) |
| 675 | { | 694 | { |
| 676 | return (pte_flags(pte) & | 695 | return ptenuma_flags(pte) == _PAGE_NUMA; |
| 677 | (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA; | ||
| 678 | } | 696 | } |
| 679 | #endif | 697 | #endif |
| 680 | 698 | ||
| 681 | #ifndef pmd_numa | 699 | #ifndef pmd_numa |
| 682 | static inline int pmd_numa(pmd_t pmd) | 700 | static inline int pmd_numa(pmd_t pmd) |
| 683 | { | 701 | { |
| 684 | return (pmd_flags(pmd) & | 702 | return pmdnuma_flags(pmd) == _PAGE_NUMA; |
| 685 | (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA; | ||
| 686 | } | 703 | } |
| 687 | #endif | 704 | #endif |
| 688 | 705 | ||
| @@ -722,6 +739,8 @@ static inline pte_t pte_mknuma(pte_t pte) | |||
| 722 | { | 739 | { |
| 723 | pteval_t val = pte_val(pte); | 740 | pteval_t val = pte_val(pte); |
| 724 | 741 | ||
| 742 | VM_BUG_ON(!(val & _PAGE_PRESENT)); | ||
| 743 | |||
| 725 | val &= ~_PAGE_PRESENT; | 744 | val &= ~_PAGE_PRESENT; |
| 726 | val |= _PAGE_NUMA; | 745 | val |= _PAGE_NUMA; |
| 727 | 746 | ||
| @@ -765,16 +784,6 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, | |||
| 765 | } | 784 | } |
| 766 | #endif | 785 | #endif |
| 767 | #else | 786 | #else |
| 768 | extern int pte_numa(pte_t pte); | ||
| 769 | extern int pmd_numa(pmd_t pmd); | ||
| 770 | extern pte_t pte_mknonnuma(pte_t pte); | ||
| 771 | extern pmd_t pmd_mknonnuma(pmd_t pmd); | ||
| 772 | extern pte_t pte_mknuma(pte_t pte); | ||
| 773 | extern pmd_t pmd_mknuma(pmd_t pmd); | ||
| 774 | extern void ptep_set_numa(struct mm_struct *mm, unsigned long addr, pte_t *ptep); | ||
| 775 | extern void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp); | ||
| 776 | #endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */ | ||
| 777 | #else | ||
| 778 | static inline int pmd_numa(pmd_t pmd) | 787 | static inline int pmd_numa(pmd_t pmd) |
| 779 | { | 788 | { |
| 780 | return 0; | 789 | return 0; |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index f1a24b5c3b90..b58fd667f87b 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | /* References to section boundaries */ | 4 | /* References to section boundaries */ |
| 5 | 5 | ||
| 6 | #include <linux/compiler.h> | ||
| 7 | |||
| 6 | /* | 8 | /* |
| 7 | * Usage guidelines: | 9 | * Usage guidelines: |
| 8 | * _text, _data: architecture specific, don't use them in arch-independent code | 10 | * _text, _data: architecture specific, don't use them in arch-independent code |
| @@ -37,6 +39,8 @@ extern char __start_rodata[], __end_rodata[]; | |||
| 37 | /* Start and end of .ctors section - used for constructor calls. */ | 39 | /* Start and end of .ctors section - used for constructor calls. */ |
| 38 | extern char __ctors_start[], __ctors_end[]; | 40 | extern char __ctors_start[], __ctors_end[]; |
| 39 | 41 | ||
| 42 | extern __visible const void __nosave_begin, __nosave_end; | ||
| 43 | |||
| 40 | /* function descriptor handling (if any). Override | 44 | /* function descriptor handling (if any). Override |
| 41 | * in asm/sections.h */ | 45 | * in asm/sections.h */ |
| 42 | #ifndef dereference_function_descriptor | 46 | #ifndef dereference_function_descriptor |
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h index d401e5463fb0..0c938a4354f6 100644 --- a/include/asm-generic/syscall.h +++ b/include/asm-generic/syscall.h | |||
| @@ -147,7 +147,7 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs, | |||
| 147 | * | 147 | * |
| 148 | * Returns the AUDIT_ARCH_* based on the system call convention in use. | 148 | * Returns the AUDIT_ARCH_* based on the system call convention in use. |
| 149 | * | 149 | * |
| 150 | * It's only valid to call this when @task is stopped on entry to a system | 150 | * It's only valid to call this when current is stopped on entry to a system |
| 151 | * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP. | 151 | * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP. |
| 152 | * | 152 | * |
| 153 | * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must | 153 | * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 5ba0360663a7..aa70cbda327c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -40,6 +40,8 @@ | |||
| 40 | * } | 40 | * } |
| 41 | * | 41 | * |
| 42 | * [__init_begin, __init_end] is the init section that may be freed after init | 42 | * [__init_begin, __init_end] is the init section that may be freed after init |
| 43 | * // __init_begin and __init_end should be page aligned, so that we can | ||
| 44 | * // free the whole .init memory | ||
| 43 | * [_stext, _etext] is the text section | 45 | * [_stext, _etext] is the text section |
| 44 | * [_sdata, _edata] is the data section | 46 | * [_sdata, _edata] is the data section |
| 45 | * | 47 | * |
