aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/barrier.h15
-rw-r--r--arch/arm/include/asm/bitops.h54
-rw-r--r--arch/arm/include/asm/cacheflush.h6
-rw-r--r--arch/arm/include/asm/checksum.h34
-rw-r--r--arch/arm/include/asm/clkdev.h2
-rw-r--r--arch/arm/include/asm/dma.h4
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h1
-rw-r--r--arch/arm/include/asm/io.h6
-rw-r--r--arch/arm/include/asm/kvm_host.h3
-rw-r--r--arch/arm/include/asm/kvm_mmu.h1
-rw-r--r--arch/arm/include/asm/mach/map.h27
-rw-r--r--arch/arm/include/asm/memory.h9
-rw-r--r--arch/arm/include/asm/pci.h5
-rw-r--r--arch/arm/include/asm/pgtable-2level.h1
-rw-r--r--arch/arm/include/asm/pgtable-3level.h16
-rw-r--r--arch/arm/include/asm/pgtable.h2
-rw-r--r--arch/arm/include/asm/spinlock.h15
-rw-r--r--arch/arm/include/asm/trusted_foundations.h67
-rw-r--r--arch/arm/include/asm/unistd.h2
-rw-r--r--arch/arm/include/asm/word-at-a-time.h18
-rw-r--r--arch/arm/include/asm/xen/page.h3
-rw-r--r--arch/arm/include/debug/imx-uart.h10
-rw-r--r--arch/arm/include/debug/tegra.S34
-rw-r--r--arch/arm/include/uapi/asm/kvm.h28
-rw-r--r--arch/arm/include/uapi/asm/unistd.h2
26 files changed, 265 insertions, 101 deletions
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index c38b58c80202..3278afe2c3ab 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -34,3 +34,4 @@ generic-y += timex.h
34generic-y += trace_clock.h 34generic-y += trace_clock.h
35generic-y += unaligned.h 35generic-y += unaligned.h
36generic-y += preempt.h 36generic-y += preempt.h
37generic-y += hash.h
diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h
index 60f15e274e6d..2f59f7443396 100644
--- a/arch/arm/include/asm/barrier.h
+++ b/arch/arm/include/asm/barrier.h
@@ -59,6 +59,21 @@
59#define smp_wmb() dmb(ishst) 59#define smp_wmb() dmb(ishst)
60#endif 60#endif
61 61
62#define smp_store_release(p, v) \
63do { \
64 compiletime_assert_atomic_type(*p); \
65 smp_mb(); \
66 ACCESS_ONCE(*p) = (v); \
67} while (0)
68
69#define smp_load_acquire(p) \
70({ \
71 typeof(*p) ___p1 = ACCESS_ONCE(*p); \
72 compiletime_assert_atomic_type(*p); \
73 smp_mb(); \
74 ___p1; \
75})
76
62#define read_barrier_depends() do { } while(0) 77#define read_barrier_depends() do { } while(0)
63#define smp_read_barrier_depends() do { } while(0) 78#define smp_read_barrier_depends() do { } while(0)
64 79
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index e691ec91e4d3..b2e298a90d76 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -254,25 +254,59 @@ static inline int constant_fls(int x)
254} 254}
255 255
256/* 256/*
257 * On ARMv5 and above those functions can be implemented around 257 * On ARMv5 and above those functions can be implemented around the
258 * the clz instruction for much better code efficiency. 258 * clz instruction for much better code efficiency. __clz returns
259 * the number of leading zeros, zero input will return 32, and
260 * 0x80000000 will return 0.
259 */ 261 */
262static inline unsigned int __clz(unsigned int x)
263{
264 unsigned int ret;
265
266 asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
260 267
268 return ret;
269}
270
271/*
272 * fls() returns zero if the input is zero, otherwise returns the bit
273 * position of the last set bit, where the LSB is 1 and MSB is 32.
274 */
261static inline int fls(int x) 275static inline int fls(int x)
262{ 276{
263 int ret;
264
265 if (__builtin_constant_p(x)) 277 if (__builtin_constant_p(x))
266 return constant_fls(x); 278 return constant_fls(x);
267 279
268 asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); 280 return 32 - __clz(x);
269 ret = 32 - ret; 281}
270 return ret; 282
283/*
284 * __fls() returns the bit position of the last bit set, where the
285 * LSB is 0 and MSB is 31. Zero input is undefined.
286 */
287static inline unsigned long __fls(unsigned long x)
288{
289 return fls(x) - 1;
290}
291
292/*
293 * ffs() returns zero if the input was zero, otherwise returns the bit
294 * position of the first set bit, where the LSB is 1 and MSB is 32.
295 */
296static inline int ffs(int x)
297{
298 return fls(x & -x);
299}
300
301/*
302 * __ffs() returns the bit position of the first bit set, where the
303 * LSB is 0 and MSB is 31. Zero input is undefined.
304 */
305static inline unsigned long __ffs(unsigned long x)
306{
307 return ffs(x) - 1;
271} 308}
272 309
273#define __fls(x) (fls(x) - 1)
274#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
275#define __ffs(x) (ffs(x) - 1)
276#define ffz(x) __ffs( ~(x) ) 310#define ffz(x) __ffs( ~(x) )
277 311
278#endif 312#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index ee753f1749cd..8b8b61685a34 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -212,6 +212,7 @@ extern void copy_to_user_page(struct vm_area_struct *, struct page *,
212static inline void __flush_icache_all(void) 212static inline void __flush_icache_all(void)
213{ 213{
214 __flush_icache_preferred(); 214 __flush_icache_preferred();
215 dsb();
215} 216}
216 217
217/* 218/*
@@ -481,4 +482,9 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
481 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \ 482 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \
482 "r9","r10","lr","memory" ) 483 "r9","r10","lr","memory" )
483 484
485int set_memory_ro(unsigned long addr, int numpages);
486int set_memory_rw(unsigned long addr, int numpages);
487int set_memory_x(unsigned long addr, int numpages);
488int set_memory_nx(unsigned long addr, int numpages);
489
484#endif 490#endif
diff --git a/arch/arm/include/asm/checksum.h b/arch/arm/include/asm/checksum.h
index 6dcc16430868..523315115478 100644
--- a/arch/arm/include/asm/checksum.h
+++ b/arch/arm/include/asm/checksum.h
@@ -87,19 +87,33 @@ static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
88 unsigned short proto, __wsum sum) 88 unsigned short proto, __wsum sum)
89{ 89{
90 __asm__( 90 u32 lenprot = len | proto << 16;
91 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 91 if (__builtin_constant_p(sum) && sum == 0) {
92 adcs %0, %0, %3 \n" 92 __asm__(
93 "adds %0, %1, %2 @ csum_tcpudp_nofold0 \n\t"
93#ifdef __ARMEB__ 94#ifdef __ARMEB__
94 "adcs %0, %0, %4 \n" 95 "adcs %0, %0, %3 \n\t"
95#else 96#else
96 "adcs %0, %0, %4, lsl #8 \n" 97 "adcs %0, %0, %3, ror #8 \n\t"
97#endif 98#endif
98 "adcs %0, %0, %5 \n\ 99 "adc %0, %0, #0"
99 adc %0, %0, #0" 100 : "=&r" (sum)
100 : "=&r"(sum) 101 : "r" (daddr), "r" (saddr), "r" (lenprot)
101 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto)) 102 : "cc");
102 : "cc"); 103 } else {
104 __asm__(
105 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\t"
106 "adcs %0, %0, %3 \n\t"
107#ifdef __ARMEB__
108 "adcs %0, %0, %4 \n\t"
109#else
110 "adcs %0, %0, %4, ror #8 \n\t"
111#endif
112 "adc %0, %0, #0"
113 : "=&r"(sum)
114 : "r" (sum), "r" (daddr), "r" (saddr), "r" (lenprot)
115 : "cc");
116 }
103 return sum; 117 return sum;
104} 118}
105/* 119/*
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
index 80751c15c300..4e8a4b27d7c7 100644
--- a/arch/arm/include/asm/clkdev.h
+++ b/arch/arm/include/asm/clkdev.h
@@ -14,12 +14,14 @@
14 14
15#include <linux/slab.h> 15#include <linux/slab.h>
16 16
17#ifndef CONFIG_COMMON_CLK
17#ifdef CONFIG_HAVE_MACH_CLKDEV 18#ifdef CONFIG_HAVE_MACH_CLKDEV
18#include <mach/clkdev.h> 19#include <mach/clkdev.h>
19#else 20#else
20#define __clk_get(clk) ({ 1; }) 21#define __clk_get(clk) ({ 1; })
21#define __clk_put(clk) do { } while (0) 22#define __clk_put(clk) do { } while (0)
22#endif 23#endif
24#endif
23 25
24static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) 26static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
25{ 27{
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 58b8c6a0ab1f..99084431d6ae 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -8,8 +8,8 @@
8#define MAX_DMA_ADDRESS 0xffffffffUL 8#define MAX_DMA_ADDRESS 0xffffffffUL
9#else 9#else
10#define MAX_DMA_ADDRESS ({ \ 10#define MAX_DMA_ADDRESS ({ \
11 extern unsigned long arm_dma_zone_size; \ 11 extern phys_addr_t arm_dma_zone_size; \
12 arm_dma_zone_size ? \ 12 arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
13 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; }) 13 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
14#endif 14#endif
15 15
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 3b2c40b5bfa2..6795ff743b3d 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -131,6 +131,7 @@ struct l2x0_regs {
131 unsigned long prefetch_ctrl; 131 unsigned long prefetch_ctrl;
132 unsigned long pwr_ctrl; 132 unsigned long pwr_ctrl;
133 unsigned long ctrl; 133 unsigned long ctrl;
134 unsigned long aux2_ctrl;
134}; 135};
135 136
136extern struct l2x0_regs l2x0_saved_regs; 137extern struct l2x0_regs l2x0_saved_regs;
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index fbeb39c869e9..8aa4cca74501 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -38,6 +38,12 @@
38#define isa_bus_to_virt phys_to_virt 38#define isa_bus_to_virt phys_to_virt
39 39
40/* 40/*
41 * Atomic MMIO-wide IO modify
42 */
43extern void atomic_io_modify(void __iomem *reg, u32 mask, u32 set);
44extern void atomic_io_modify_relaxed(void __iomem *reg, u32 mask, u32 set);
45
46/*
41 * Generic IO read/write. These perform native-endian accesses. Note 47 * Generic IO read/write. These perform native-endian accesses. Note
42 * that some architectures will want to re-define __raw_{read,write}w. 48 * that some architectures will want to re-define __raw_{read,write}w.
43 */ 49 */
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 8a6f6db14ee4..098f7dd6d564 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -225,4 +225,7 @@ static inline int kvm_arch_dev_ioctl_check_extension(long ext)
225int kvm_perf_init(void); 225int kvm_perf_init(void);
226int kvm_perf_teardown(void); 226int kvm_perf_teardown(void);
227 227
228u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
229int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
230
228#endif /* __ARM_KVM_HOST_H__ */ 231#endif /* __ARM_KVM_HOST_H__ */
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 77de4a41cc50..2d122adcdb22 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -140,6 +140,7 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva,
140} 140}
141 141
142#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l)) 142#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l))
143#define kvm_virt_to_phys(x) virt_to_idmap((unsigned long)(x))
143 144
144#endif /* !__ASSEMBLY__ */ 145#endif /* !__ASSEMBLY__ */
145 146
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 2fe141fcc8d6..f98c7f32c9c8 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -22,18 +22,21 @@ struct map_desc {
22}; 22};
23 23
24/* types 0-3 are defined in asm/io.h */ 24/* types 0-3 are defined in asm/io.h */
25#define MT_UNCACHED 4 25enum {
26#define MT_CACHECLEAN 5 26 MT_UNCACHED = 4,
27#define MT_MINICLEAN 6 27 MT_CACHECLEAN,
28#define MT_LOW_VECTORS 7 28 MT_MINICLEAN,
29#define MT_HIGH_VECTORS 8 29 MT_LOW_VECTORS,
30#define MT_MEMORY 9 30 MT_HIGH_VECTORS,
31#define MT_ROM 10 31 MT_MEMORY_RWX,
32#define MT_MEMORY_NONCACHED 11 32 MT_MEMORY_RW,
33#define MT_MEMORY_DTCM 12 33 MT_ROM,
34#define MT_MEMORY_ITCM 13 34 MT_MEMORY_RWX_NONCACHED,
35#define MT_MEMORY_SO 14 35 MT_MEMORY_RW_DTCM,
36#define MT_MEMORY_DMA_READY 15 36 MT_MEMORY_RWX_ITCM,
37 MT_MEMORY_RW_SO,
38 MT_MEMORY_DMA_READY,
39};
37 40
38#ifdef CONFIG_MMU 41#ifdef CONFIG_MMU
39extern void iotable_init(struct map_desc *, int); 42extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 8756e4bcdba0..4afb376d9c7c 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -30,14 +30,15 @@
30 */ 30 */
31#define UL(x) _AC(x, UL) 31#define UL(x) _AC(x, UL)
32 32
33/* PAGE_OFFSET - the virtual address of the start of the kernel image */
34#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
35
33#ifdef CONFIG_MMU 36#ifdef CONFIG_MMU
34 37
35/* 38/*
36 * PAGE_OFFSET - the virtual address of the start of the kernel image
37 * TASK_SIZE - the maximum size of a user space task. 39 * TASK_SIZE - the maximum size of a user space task.
38 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area 40 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
39 */ 41 */
40#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
41#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M)) 42#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M))
42#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M) 43#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M)
43 44
@@ -104,10 +105,6 @@
104#define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) 105#define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE)
105#endif 106#endif
106 107
107#ifndef PAGE_OFFSET
108#define PAGE_OFFSET PLAT_PHYS_OFFSET
109#endif
110
111/* 108/*
112 * The module can be at any place in ram in nommu mode. 109 * The module can be at any place in ram in nommu mode.
113 */ 110 */
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index a98a2e112fae..680a83e94467 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -57,12 +57,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
58 enum pci_mmap_state mmap_state, int write_combine); 58 enum pci_mmap_state mmap_state, int write_combine);
59 59
60/*
61 * Dummy implementation; always return 0.
62 */
63static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 60static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
64{ 61{
65 return 0; 62 return channel ? 15 : 14;
66} 63}
67 64
68#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 86a659a19526..dfff709fda3c 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -160,6 +160,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
160 return (pmd_t *)pud; 160 return (pmd_t *)pud;
161} 161}
162 162
163#define pmd_large(pmd) (pmd_val(pmd) & 2)
163#define pmd_bad(pmd) (pmd_val(pmd) & 2) 164#define pmd_bad(pmd) (pmd_val(pmd) & 2)
164 165
165#define copy_pmd(pmdpd,pmdps) \ 166#define copy_pmd(pmdpd,pmdps) \
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 4f9503908dca..85c60adc8b60 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -120,13 +120,16 @@
120/* 120/*
121 * 2nd stage PTE definitions for LPAE. 121 * 2nd stage PTE definitions for LPAE.
122 */ 122 */
123#define L_PTE_S2_MT_UNCACHED (_AT(pteval_t, 0x5) << 2) /* MemAttr[3:0] */ 123#define L_PTE_S2_MT_UNCACHED (_AT(pteval_t, 0x0) << 2) /* strongly ordered */
124#define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* MemAttr[3:0] */ 124#define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* normal inner write-through */
125#define L_PTE_S2_MT_WRITEBACK (_AT(pteval_t, 0xf) << 2) /* MemAttr[3:0] */ 125#define L_PTE_S2_MT_WRITEBACK (_AT(pteval_t, 0xf) << 2) /* normal inner write-back */
126#define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[1] */ 126#define L_PTE_S2_MT_DEV_SHARED (_AT(pteval_t, 0x1) << 2) /* device */
127#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */ 127#define L_PTE_S2_MT_MASK (_AT(pteval_t, 0xf) << 2)
128 128
129#define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* HAP[2:1] */ 129#define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[1] */
130#define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */
131
132#define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* HAP[2:1] */
130 133
131/* 134/*
132 * Hyp-mode PL2 PTE definitions for LPAE. 135 * Hyp-mode PL2 PTE definitions for LPAE.
@@ -142,6 +145,7 @@
142 PMD_TYPE_TABLE) 145 PMD_TYPE_TABLE)
143#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ 146#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
144 PMD_TYPE_SECT) 147 PMD_TYPE_SECT)
148#define pmd_large(pmd) pmd_sect(pmd)
145 149
146#define pud_clear(pudp) \ 150#define pud_clear(pudp) \
147 do { \ 151 do { \
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 1571d126e9dd..7d59b524f2af 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -254,6 +254,8 @@ PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
254PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); 254PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
255PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); 255PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
256PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); 256PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
257PTE_BIT_FUNC(mkexec, &= ~L_PTE_XN);
258PTE_BIT_FUNC(mknexec, |= L_PTE_XN);
257 259
258static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 260static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
259 261
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index ef3c6072aa45..ac4bfae26702 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -37,18 +37,9 @@
37 37
38static inline void dsb_sev(void) 38static inline void dsb_sev(void)
39{ 39{
40#if __LINUX_ARM_ARCH__ >= 7 40
41 __asm__ __volatile__ ( 41 dsb(ishst);
42 "dsb ishst\n" 42 __asm__(SEV);
43 SEV
44 );
45#else
46 __asm__ __volatile__ (
47 "mcr p15, 0, %0, c7, c10, 4\n"
48 SEV
49 : : "r" (0)
50 );
51#endif
52} 43}
53 44
54/* 45/*
diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h
new file mode 100644
index 000000000000..3bd36e2c5f2e
--- /dev/null
+++ b/arch/arm/include/asm/trusted_foundations.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright (c) 2013, NVIDIA Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 */
14
15/*
16 * Support for the Trusted Foundations secure monitor.
17 *
18 * Trusted Foundation comes active on some ARM consumer devices (most
19 * Tegra-based devices sold on the market are concerned). Such devices can only
20 * perform some basic operations, like setting the CPU reset vector, through
21 * SMC calls to the secure monitor. The calls are completely specific to
22 * Trusted Foundations, and do *not* follow the SMC calling convention or the
23 * PSCI standard.
24 */
25
26#ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H
27#define __ASM_ARM_TRUSTED_FOUNDATIONS_H
28
29#include <linux/kconfig.h>
30#include <linux/printk.h>
31#include <linux/bug.h>
32#include <linux/of.h>
33
34struct trusted_foundations_platform_data {
35 unsigned int version_major;
36 unsigned int version_minor;
37};
38
39#if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS)
40
41void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
42void of_register_trusted_foundations(void);
43
44#else /* CONFIG_TRUSTED_FOUNDATIONS */
45
46static inline void register_trusted_foundations(
47 struct trusted_foundations_platform_data *pd)
48{
49 /*
50 * If we try to register TF, this means the system needs it to continue.
51 * Its absence if thus a fatal error.
52 */
53 panic("No support for Trusted Foundations, stopping...\n");
54}
55
56static inline void of_register_trusted_foundations(void)
57{
58 /*
59 * If we find the target should enable TF but does not support it,
60 * fail as the system won't be able to do much anyway
61 */
62 if (of_find_compatible_node(NULL, NULL, "tl,trusted-foundations"))
63 register_trusted_foundations(NULL);
64}
65#endif /* CONFIG_TRUSTED_FOUNDATIONS */
66
67#endif
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 141baa3f9a72..acabef1a75df 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -15,7 +15,7 @@
15 15
16#include <uapi/asm/unistd.h> 16#include <uapi/asm/unistd.h>
17 17
18#define __NR_syscalls (380) 18#define __NR_syscalls (384)
19#define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0) 19#define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0)
20 20
21#define __ARCH_WANT_STAT64 21#define __ARCH_WANT_STAT64
diff --git a/arch/arm/include/asm/word-at-a-time.h b/arch/arm/include/asm/word-at-a-time.h
index 4d52f92967a6..a6d0a29861e7 100644
--- a/arch/arm/include/asm/word-at-a-time.h
+++ b/arch/arm/include/asm/word-at-a-time.h
@@ -48,10 +48,14 @@ static inline unsigned long find_zero(unsigned long mask)
48 return ret; 48 return ret;
49} 49}
50 50
51#ifdef CONFIG_DCACHE_WORD_ACCESS
52
53#define zero_bytemask(mask) (mask) 51#define zero_bytemask(mask) (mask)
54 52
53#else /* __ARMEB__ */
54#include <asm-generic/word-at-a-time.h>
55#endif
56
57#ifdef CONFIG_DCACHE_WORD_ACCESS
58
55/* 59/*
56 * Load an unaligned word from kernel space. 60 * Load an unaligned word from kernel space.
57 * 61 *
@@ -73,7 +77,11 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
73 " bic %2, %2, #0x3\n" 77 " bic %2, %2, #0x3\n"
74 " ldr %0, [%2]\n" 78 " ldr %0, [%2]\n"
75 " lsl %1, %1, #0x3\n" 79 " lsl %1, %1, #0x3\n"
80#ifndef __ARMEB__
76 " lsr %0, %0, %1\n" 81 " lsr %0, %0, %1\n"
82#else
83 " lsl %0, %0, %1\n"
84#endif
77 " b 2b\n" 85 " b 2b\n"
78 " .popsection\n" 86 " .popsection\n"
79 " .pushsection __ex_table,\"a\"\n" 87 " .pushsection __ex_table,\"a\"\n"
@@ -86,11 +94,5 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
86 return ret; 94 return ret;
87} 95}
88 96
89
90#endif /* DCACHE_WORD_ACCESS */ 97#endif /* DCACHE_WORD_ACCESS */
91
92#else /* __ARMEB__ */
93#include <asm-generic/word-at-a-time.h>
94#endif
95
96#endif /* __ASM_ARM_WORD_AT_A_TIME_H */ 98#endif /* __ASM_ARM_WORD_AT_A_TIME_H */
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 3759cacdd7f8..e0965abacb7d 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -117,6 +117,7 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
117 return __set_phys_to_machine(pfn, mfn); 117 return __set_phys_to_machine(pfn, mfn);
118} 118}
119 119
120#define xen_remap(cookie, size) ioremap_cache((cookie), (size)); 120#define xen_remap(cookie, size) ioremap_cache((cookie), (size))
121#define xen_unmap(cookie) iounmap((cookie))
121 122
122#endif /* _ASM_ARM_XEN_PAGE_H */ 123#endif /* _ASM_ARM_XEN_PAGE_H */
diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx-uart.h
index 29da84e183f4..42b823cd2d22 100644
--- a/arch/arm/include/debug/imx-uart.h
+++ b/arch/arm/include/debug/imx-uart.h
@@ -43,6 +43,14 @@
43#define IMX35_UART_BASE_ADDR(n) IMX35_UART##n##_BASE_ADDR 43#define IMX35_UART_BASE_ADDR(n) IMX35_UART##n##_BASE_ADDR
44#define IMX35_UART_BASE(n) IMX35_UART_BASE_ADDR(n) 44#define IMX35_UART_BASE(n) IMX35_UART_BASE_ADDR(n)
45 45
46#define IMX50_UART1_BASE_ADDR 0x53fbc000
47#define IMX50_UART2_BASE_ADDR 0x53fc0000
48#define IMX50_UART3_BASE_ADDR 0x5000c000
49#define IMX50_UART4_BASE_ADDR 0x53ff0000
50#define IMX50_UART5_BASE_ADDR 0x63f90000
51#define IMX50_UART_BASE_ADDR(n) IMX50_UART##n##_BASE_ADDR
52#define IMX50_UART_BASE(n) IMX50_UART_BASE_ADDR(n)
53
46#define IMX51_UART1_BASE_ADDR 0x73fbc000 54#define IMX51_UART1_BASE_ADDR 0x73fbc000
47#define IMX51_UART2_BASE_ADDR 0x73fc0000 55#define IMX51_UART2_BASE_ADDR 0x73fc0000
48#define IMX51_UART3_BASE_ADDR 0x7000c000 56#define IMX51_UART3_BASE_ADDR 0x7000c000
@@ -85,6 +93,8 @@
85#define UART_PADDR IMX_DEBUG_UART_BASE(IMX31) 93#define UART_PADDR IMX_DEBUG_UART_BASE(IMX31)
86#elif defined(CONFIG_DEBUG_IMX35_UART) 94#elif defined(CONFIG_DEBUG_IMX35_UART)
87#define UART_PADDR IMX_DEBUG_UART_BASE(IMX35) 95#define UART_PADDR IMX_DEBUG_UART_BASE(IMX35)
96#elif defined(CONFIG_DEBUG_IMX50_UART)
97#define UART_PADDR IMX_DEBUG_UART_BASE(IMX50)
88#elif defined(CONFIG_DEBUG_IMX51_UART) 98#elif defined(CONFIG_DEBUG_IMX51_UART)
89#define UART_PADDR IMX_DEBUG_UART_BASE(IMX51) 99#define UART_PADDR IMX_DEBUG_UART_BASE(IMX51)
90#elif defined(CONFIG_DEBUG_IMX53_UART) 100#elif defined(CONFIG_DEBUG_IMX53_UART)
diff --git a/arch/arm/include/debug/tegra.S b/arch/arm/include/debug/tegra.S
index be6a720dd183..f98763f0bc17 100644
--- a/arch/arm/include/debug/tegra.S
+++ b/arch/arm/include/debug/tegra.S
@@ -46,10 +46,10 @@
46#define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804) 46#define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804)
47 47
48/* 48/*
49 * Must be 1MB-aligned since a 1MB mapping is used early on. 49 * Must be section-aligned since a section mapping is used early on.
50 * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[]. 50 * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[].
51 */ 51 */
52#define UART_VIRTUAL_BASE 0xfe100000 52#define UART_VIRTUAL_BASE 0xfe800000
53 53
54#define checkuart(rp, rv, lhu, bit, uart) \ 54#define checkuart(rp, rv, lhu, bit, uart) \
55 /* Load address of CLK_RST register */ \ 55 /* Load address of CLK_RST register */ \
@@ -156,28 +156,6 @@
15692: and \rv, \rp, #0xffffff @ offset within 1MB section 15692: and \rv, \rp, #0xffffff @ offset within 1MB section
157 add \rv, \rv, #UART_VIRTUAL_BASE 157 add \rv, \rv, #UART_VIRTUAL_BASE
158 str \rv, [\tmp, #8] @ Store in tegra_uart_virt 158 str \rv, [\tmp, #8] @ Store in tegra_uart_virt
159 movw \rv, #TEGRA_APB_MISC_GP_HIDREV & 0xffff
160 movt \rv, #TEGRA_APB_MISC_GP_HIDREV >> 16
161 ldr \rv, [\rv, #0] @ Load HIDREV
162 ubfx \rv, \rv, #8, #8 @ 15:8 are SoC version
163 cmp \rv, #0x20 @ Tegra20?
164 moveq \rv, #0x75 @ Tegra20 divisor
165 movne \rv, #0xdd @ Tegra30 divisor
166 str \rv, [\tmp, #12] @ Save divisor to scratch
167 /* uart[UART_LCR] = UART_LCR_WLEN8 | UART_LCR_DLAB; */
168 mov \rv, #UART_LCR_WLEN8 | UART_LCR_DLAB
169 str \rv, [\rp, #UART_LCR << UART_SHIFT]
170 /* uart[UART_DLL] = div & 0xff; */
171 ldr \rv, [\tmp, #12]
172 and \rv, \rv, #0xff
173 str \rv, [\rp, #UART_DLL << UART_SHIFT]
174 /* uart[UART_DLM] = div >> 8; */
175 ldr \rv, [\tmp, #12]
176 lsr \rv, \rv, #8
177 str \rv, [\rp, #UART_DLM << UART_SHIFT]
178 /* uart[UART_LCR] = UART_LCR_WLEN8; */
179 mov \rv, #UART_LCR_WLEN8
180 str \rv, [\rp, #UART_LCR << UART_SHIFT]
181 b 100f 159 b 100f
182 160
183 .align 161 .align
@@ -205,8 +183,8 @@
205 cmp \rx, #0 183 cmp \rx, #0
206 beq 1002f 184 beq 1002f
2071001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] 1851001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
208 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE 186 and \rd, \rd, #UART_LSR_THRE
209 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE 187 teq \rd, #UART_LSR_THRE
210 bne 1001b 188 bne 1001b
2111002: 1891002:
212 .endm 190 .endm
@@ -225,7 +203,7 @@
225/* 203/*
226 * Storage for the state maintained by the macros above. 204 * Storage for the state maintained by the macros above.
227 * 205 *
228 * In the kernel proper, this data is located in arch/arm/mach-tegra/common.c. 206 * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c.
229 * That's because this header is included from multiple files, and we only 207 * That's because this header is included from multiple files, and we only
230 * want a single copy of the data. In particular, the UART probing code above 208 * want a single copy of the data. In particular, the UART probing code above
231 * assumes it's running using physical addresses. This is true when this file 209 * assumes it's running using physical addresses. This is true when this file
@@ -247,6 +225,4 @@ tegra_uart_config:
247 .word 0 225 .word 0
248 /* Debug UART virtual address */ 226 /* Debug UART virtual address */
249 .word 0 227 .word 0
250 /* Scratch space for debug macro */
251 .word 0
252#endif 228#endif
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
index c498b60c0505..ef0c8785ba16 100644
--- a/arch/arm/include/uapi/asm/kvm.h
+++ b/arch/arm/include/uapi/asm/kvm.h
@@ -119,6 +119,26 @@ struct kvm_arch_memory_slot {
119#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 119#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800
120#define KVM_REG_ARM_32_CRN_SHIFT 11 120#define KVM_REG_ARM_32_CRN_SHIFT 11
121 121
122#define ARM_CP15_REG_SHIFT_MASK(x,n) \
123 (((x) << KVM_REG_ARM_ ## n ## _SHIFT) & KVM_REG_ARM_ ## n ## _MASK)
124
125#define __ARM_CP15_REG(op1,crn,crm,op2) \
126 (KVM_REG_ARM | (15 << KVM_REG_ARM_COPROC_SHIFT) | \
127 ARM_CP15_REG_SHIFT_MASK(op1, OPC1) | \
128 ARM_CP15_REG_SHIFT_MASK(crn, 32_CRN) | \
129 ARM_CP15_REG_SHIFT_MASK(crm, CRM) | \
130 ARM_CP15_REG_SHIFT_MASK(op2, 32_OPC2))
131
132#define ARM_CP15_REG32(...) (__ARM_CP15_REG(__VA_ARGS__) | KVM_REG_SIZE_U32)
133
134#define __ARM_CP15_REG64(op1,crm) \
135 (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64)
136#define ARM_CP15_REG64(...) __ARM_CP15_REG64(__VA_ARGS__)
137
138#define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1)
139#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14)
140#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14)
141
122/* Normal registers are mapped as coprocessor 16. */ 142/* Normal registers are mapped as coprocessor 16. */
123#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT) 143#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT)
124#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4) 144#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4)
@@ -143,6 +163,14 @@ struct kvm_arch_memory_slot {
143#define KVM_REG_ARM_VFP_FPINST 0x1009 163#define KVM_REG_ARM_VFP_FPINST 0x1009
144#define KVM_REG_ARM_VFP_FPINST2 0x100A 164#define KVM_REG_ARM_VFP_FPINST2 0x100A
145 165
166/* Device Control API: ARM VGIC */
167#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
168#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
169#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
170#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32
171#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
172#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
173#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
146 174
147/* KVM_IRQ_LINE irq field index values */ 175/* KVM_IRQ_LINE irq field index values */
148#define KVM_ARM_IRQ_TYPE_SHIFT 24 176#define KVM_ARM_IRQ_TYPE_SHIFT 24
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index af33b44990ed..fb5584d0cc05 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -406,6 +406,8 @@
406#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) 406#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377)
407#define __NR_kcmp (__NR_SYSCALL_BASE+378) 407#define __NR_kcmp (__NR_SYSCALL_BASE+378)
408#define __NR_finit_module (__NR_SYSCALL_BASE+379) 408#define __NR_finit_module (__NR_SYSCALL_BASE+379)
409#define __NR_sched_setattr (__NR_SYSCALL_BASE+380)
410#define __NR_sched_getattr (__NR_SYSCALL_BASE+381)
409 411
410/* 412/*
411 * This may need to be greater than __NR_last_syscall+1 in order to 413 * This may need to be greater than __NR_last_syscall+1 in order to