diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-30 07:35:11 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-30 07:35:11 -0400 |
commit | 67577927e8d7a1f4b09b4992df640eadc6aacb36 (patch) | |
tree | 2e9efe6b5745965faf0dcc084d4613d9356263f9 /arch/powerpc/include | |
parent | 6fe4c590313133ebd5dadb769031489ff178ece1 (diff) | |
parent | 51f00a471ce8f359627dd99aeac322947a0e491b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts:
drivers/mtd/mtd_blkdevs.c
Merge Grant's device-tree bits so that we can apply the subsequent fixes.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'arch/powerpc/include')
34 files changed, 470 insertions, 145 deletions
diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h index 7cdf358337cf..ce0c28495f9a 100644 --- a/arch/powerpc/include/asm/checksum.h +++ b/arch/powerpc/include/asm/checksum.h | |||
@@ -52,12 +52,22 @@ extern __wsum csum_partial(const void *buff, int len, __wsum sum); | |||
52 | extern __wsum csum_partial_copy_generic(const void *src, void *dst, | 52 | extern __wsum csum_partial_copy_generic(const void *src, void *dst, |
53 | int len, __wsum sum, | 53 | int len, __wsum sum, |
54 | int *src_err, int *dst_err); | 54 | int *src_err, int *dst_err); |
55 | |||
56 | #ifdef __powerpc64__ | ||
57 | #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER | ||
58 | extern __wsum csum_and_copy_from_user(const void __user *src, void *dst, | ||
59 | int len, __wsum sum, int *err_ptr); | ||
60 | #define HAVE_CSUM_COPY_USER | ||
61 | extern __wsum csum_and_copy_to_user(const void *src, void __user *dst, | ||
62 | int len, __wsum sum, int *err_ptr); | ||
63 | #else | ||
55 | /* | 64 | /* |
56 | * the same as csum_partial, but copies from src to dst while it | 65 | * the same as csum_partial, but copies from src to dst while it |
57 | * checksums. | 66 | * checksums. |
58 | */ | 67 | */ |
59 | #define csum_partial_copy_from_user(src, dst, len, sum, errp) \ | 68 | #define csum_partial_copy_from_user(src, dst, len, sum, errp) \ |
60 | csum_partial_copy_generic((__force const void *)(src), (dst), (len), (sum), (errp), NULL) | 69 | csum_partial_copy_generic((__force const void *)(src), (dst), (len), (sum), (errp), NULL) |
70 | #endif | ||
61 | 71 | ||
62 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | 72 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ |
63 | csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL) | 73 | csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL) |
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index a11d4eac4f97..2296112e247b 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h | |||
@@ -143,7 +143,7 @@ static inline void __user *arch_compat_alloc_user_space(long len) | |||
143 | * We cant access below the stack pointer in the 32bit ABI and | 143 | * We cant access below the stack pointer in the 32bit ABI and |
144 | * can access 288 bytes in the 64bit ABI | 144 | * can access 288 bytes in the 64bit ABI |
145 | */ | 145 | */ |
146 | if (!(test_thread_flag(TIF_32BIT))) | 146 | if (!is_32bit_task()) |
147 | usp -= 288; | 147 | usp -= 288; |
148 | 148 | ||
149 | return (void __user *) (usp - len); | 149 | return (void __user *) (usp - len); |
@@ -213,7 +213,7 @@ struct compat_shmid64_ds { | |||
213 | 213 | ||
214 | static inline int is_compat_task(void) | 214 | static inline int is_compat_task(void) |
215 | { | 215 | { |
216 | return test_thread_flag(TIF_32BIT); | 216 | return is_32bit_task(); |
217 | } | 217 | } |
218 | 218 | ||
219 | #endif /* __KERNEL__ */ | 219 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 3a40a992e594..f3a1fdd9cf08 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h | |||
@@ -198,6 +198,7 @@ extern const char *powerpc_base_platform; | |||
198 | #define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000) | 198 | #define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000) |
199 | #define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0080000000000000) | 199 | #define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0080000000000000) |
200 | #define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0100000000000000) | 200 | #define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0100000000000000) |
201 | #define CPU_FTR_STCX_CHECKS_ADDRESS LONG_ASM_CONST(0x0200000000000000) | ||
201 | 202 | ||
202 | #ifndef __ASSEMBLY__ | 203 | #ifndef __ASSEMBLY__ |
203 | 204 | ||
@@ -392,28 +393,31 @@ extern const char *powerpc_base_platform; | |||
392 | CPU_FTR_MMCRA | CPU_FTR_CTRL) | 393 | CPU_FTR_MMCRA | CPU_FTR_CTRL) |
393 | #define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 394 | #define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
394 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 395 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
395 | CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ) | 396 | CPU_FTR_MMCRA | CPU_FTR_CP_USE_DCBTZ | \ |
397 | CPU_FTR_STCX_CHECKS_ADDRESS) | ||
396 | #define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 398 | #define CPU_FTRS_PPC970 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
397 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 399 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
398 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \ | 400 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \ |
399 | CPU_FTR_CP_USE_DCBTZ) | 401 | CPU_FTR_CP_USE_DCBTZ | CPU_FTR_STCX_CHECKS_ADDRESS) |
400 | #define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 402 | #define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
401 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 403 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
402 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 404 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
403 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 405 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
404 | CPU_FTR_PURR) | 406 | CPU_FTR_PURR | CPU_FTR_STCX_CHECKS_ADDRESS) |
405 | #define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 407 | #define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
406 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 408 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
407 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 409 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
408 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 410 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
409 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ | 411 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ |
410 | CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD) | 412 | CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD | \ |
413 | CPU_FTR_STCX_CHECKS_ADDRESS) | ||
411 | #define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 414 | #define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
412 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 415 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
413 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 416 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
414 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 417 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
415 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ | 418 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ |
416 | CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT) | 419 | CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ |
420 | CPU_FTR_STCX_CHECKS_ADDRESS) | ||
417 | #define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 421 | #define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
418 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 422 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
419 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 423 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 8c9c6ad2004e..6d2416a85709 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h | |||
@@ -127,19 +127,7 @@ static inline int dma_supported(struct device *dev, u64 mask) | |||
127 | return dma_ops->dma_supported(dev, mask); | 127 | return dma_ops->dma_supported(dev, mask); |
128 | } | 128 | } |
129 | 129 | ||
130 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) | 130 | extern int dma_set_mask(struct device *dev, u64 dma_mask); |
131 | { | ||
132 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
133 | |||
134 | if (unlikely(dma_ops == NULL)) | ||
135 | return -EIO; | ||
136 | if (dma_ops->set_dma_mask != NULL) | ||
137 | return dma_ops->set_dma_mask(dev, dma_mask); | ||
138 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | ||
139 | return -EIO; | ||
140 | *dev->dma_mask = dma_mask; | ||
141 | return 0; | ||
142 | } | ||
143 | 131 | ||
144 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 132 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, |
145 | dma_addr_t *dma_handle, gfp_t flag) | 133 | dma_addr_t *dma_handle, gfp_t flag) |
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index c376eda15313..2b917c69ed15 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h | |||
@@ -250,7 +250,7 @@ do { \ | |||
250 | * the 64bit ABI has never had these issues dont enable the workaround | 250 | * the 64bit ABI has never had these issues dont enable the workaround |
251 | * even if we have an executable stack. | 251 | * even if we have an executable stack. |
252 | */ | 252 | */ |
253 | # define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \ | 253 | # define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \ |
254 | (exec_stk == EXSTACK_DEFAULT) : 0) | 254 | (exec_stk == EXSTACK_DEFAULT) : 0) |
255 | #else | 255 | #else |
256 | # define SET_PERSONALITY(ex) \ | 256 | # define SET_PERSONALITY(ex) \ |
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 57c400071995..7778d6f0c878 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h | |||
@@ -137,7 +137,8 @@ | |||
137 | li r10,0; \ | 137 | li r10,0; \ |
138 | ld r11,exception_marker@toc(r2); \ | 138 | ld r11,exception_marker@toc(r2); \ |
139 | std r10,RESULT(r1); /* clear regs->result */ \ | 139 | std r10,RESULT(r1); /* clear regs->result */ \ |
140 | std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ | 140 | std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ \ |
141 | ACCOUNT_STOLEN_TIME | ||
141 | 142 | ||
142 | /* | 143 | /* |
143 | * Exception vectors. | 144 | * Exception vectors. |
diff --git a/arch/powerpc/include/asm/fsl_85xx_cache_sram.h b/arch/powerpc/include/asm/fsl_85xx_cache_sram.h new file mode 100644 index 000000000000..2af2bdc37b2e --- /dev/null +++ b/arch/powerpc/include/asm/fsl_85xx_cache_sram.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * Cache SRAM handling for QorIQ platform | ||
5 | * | ||
6 | * Author: Vivek Mahajan <vivek.mahajan@freescale.com> | ||
7 | |||
8 | * This file is derived from the original work done | ||
9 | * by Sylvain Munaut for the Bestcomm SRAM allocator. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #ifndef __ASM_POWERPC_FSL_85XX_CACHE_SRAM_H__ | ||
27 | #define __ASM_POWERPC_FSL_85XX_CACHE_SRAM_H__ | ||
28 | |||
29 | #include <asm/rheap.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | |||
32 | /* | ||
33 | * Cache-SRAM | ||
34 | */ | ||
35 | |||
36 | struct mpc85xx_cache_sram { | ||
37 | phys_addr_t base_phys; | ||
38 | void *base_virt; | ||
39 | unsigned int size; | ||
40 | rh_info_t *rh; | ||
41 | spinlock_t lock; | ||
42 | }; | ||
43 | |||
44 | extern void mpc85xx_cache_sram_free(void *ptr); | ||
45 | extern void *mpc85xx_cache_sram_alloc(unsigned int size, | ||
46 | phys_addr_t *phys, unsigned int align); | ||
47 | |||
48 | #endif /* __AMS_POWERPC_FSL_85XX_CACHE_SRAM_H__ */ | ||
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index bd100fcf40d0..ff08b70b36d4 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -16,42 +16,57 @@ extern void timer_interrupt(struct pt_regs *); | |||
16 | #ifdef CONFIG_PPC64 | 16 | #ifdef CONFIG_PPC64 |
17 | #include <asm/paca.h> | 17 | #include <asm/paca.h> |
18 | 18 | ||
19 | static inline unsigned long local_get_flags(void) | 19 | static inline unsigned long arch_local_save_flags(void) |
20 | { | 20 | { |
21 | unsigned long flags; | 21 | unsigned long flags; |
22 | 22 | ||
23 | __asm__ __volatile__("lbz %0,%1(13)" | 23 | asm volatile( |
24 | : "=r" (flags) | 24 | "lbz %0,%1(13)" |
25 | : "i" (offsetof(struct paca_struct, soft_enabled))); | 25 | : "=r" (flags) |
26 | : "i" (offsetof(struct paca_struct, soft_enabled))); | ||
26 | 27 | ||
27 | return flags; | 28 | return flags; |
28 | } | 29 | } |
29 | 30 | ||
30 | static inline unsigned long raw_local_irq_disable(void) | 31 | static inline unsigned long arch_local_irq_disable(void) |
31 | { | 32 | { |
32 | unsigned long flags, zero; | 33 | unsigned long flags, zero; |
33 | 34 | ||
34 | __asm__ __volatile__("li %1,0; lbz %0,%2(13); stb %1,%2(13)" | 35 | asm volatile( |
35 | : "=r" (flags), "=&r" (zero) | 36 | "li %1,0; lbz %0,%2(13); stb %1,%2(13)" |
36 | : "i" (offsetof(struct paca_struct, soft_enabled)) | 37 | : "=r" (flags), "=&r" (zero) |
37 | : "memory"); | 38 | : "i" (offsetof(struct paca_struct, soft_enabled)) |
39 | : "memory"); | ||
38 | 40 | ||
39 | return flags; | 41 | return flags; |
40 | } | 42 | } |
41 | 43 | ||
42 | extern void raw_local_irq_restore(unsigned long); | 44 | extern void arch_local_irq_restore(unsigned long); |
43 | extern void iseries_handle_interrupts(void); | 45 | extern void iseries_handle_interrupts(void); |
44 | 46 | ||
45 | #define raw_local_irq_enable() raw_local_irq_restore(1) | 47 | static inline void arch_local_irq_enable(void) |
46 | #define raw_local_save_flags(flags) ((flags) = local_get_flags()) | 48 | { |
47 | #define raw_local_irq_save(flags) ((flags) = raw_local_irq_disable()) | 49 | arch_local_irq_restore(1); |
50 | } | ||
51 | |||
52 | static inline unsigned long arch_local_irq_save(void) | ||
53 | { | ||
54 | return arch_local_irq_disable(); | ||
55 | } | ||
56 | |||
57 | static inline bool arch_irqs_disabled_flags(unsigned long flags) | ||
58 | { | ||
59 | return flags == 0; | ||
60 | } | ||
48 | 61 | ||
49 | #define raw_irqs_disabled() (local_get_flags() == 0) | 62 | static inline bool arch_irqs_disabled(void) |
50 | #define raw_irqs_disabled_flags(flags) ((flags) == 0) | 63 | { |
64 | return arch_irqs_disabled_flags(arch_local_save_flags()); | ||
65 | } | ||
51 | 66 | ||
52 | #ifdef CONFIG_PPC_BOOK3E | 67 | #ifdef CONFIG_PPC_BOOK3E |
53 | #define __hard_irq_enable() __asm__ __volatile__("wrteei 1": : :"memory"); | 68 | #define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); |
54 | #define __hard_irq_disable() __asm__ __volatile__("wrteei 0": : :"memory"); | 69 | #define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); |
55 | #else | 70 | #else |
56 | #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) | 71 | #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) |
57 | #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) | 72 | #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) |
@@ -64,64 +79,66 @@ extern void iseries_handle_interrupts(void); | |||
64 | get_paca()->hard_enabled = 0; \ | 79 | get_paca()->hard_enabled = 0; \ |
65 | } while(0) | 80 | } while(0) |
66 | 81 | ||
67 | #else | 82 | #else /* CONFIG_PPC64 */ |
68 | 83 | ||
69 | #if defined(CONFIG_BOOKE) | ||
70 | #define SET_MSR_EE(x) mtmsr(x) | 84 | #define SET_MSR_EE(x) mtmsr(x) |
71 | #define raw_local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory") | 85 | |
86 | static inline unsigned long arch_local_save_flags(void) | ||
87 | { | ||
88 | return mfmsr(); | ||
89 | } | ||
90 | |||
91 | static inline void arch_local_irq_restore(unsigned long flags) | ||
92 | { | ||
93 | #if defined(CONFIG_BOOKE) | ||
94 | asm volatile("wrtee %0" : : "r" (flags) : "memory"); | ||
72 | #else | 95 | #else |
73 | #define SET_MSR_EE(x) mtmsr(x) | 96 | mtmsr(flags); |
74 | #define raw_local_irq_restore(flags) mtmsr(flags) | ||
75 | #endif | 97 | #endif |
98 | } | ||
76 | 99 | ||
77 | static inline void raw_local_irq_disable(void) | 100 | static inline unsigned long arch_local_irq_save(void) |
78 | { | 101 | { |
102 | unsigned long flags = arch_local_save_flags(); | ||
79 | #ifdef CONFIG_BOOKE | 103 | #ifdef CONFIG_BOOKE |
80 | __asm__ __volatile__("wrteei 0": : :"memory"); | 104 | asm volatile("wrteei 0" : : : "memory"); |
81 | #else | 105 | #else |
82 | unsigned long msr; | 106 | SET_MSR_EE(flags & ~MSR_EE); |
83 | |||
84 | msr = mfmsr(); | ||
85 | SET_MSR_EE(msr & ~MSR_EE); | ||
86 | #endif | 107 | #endif |
108 | return flags; | ||
87 | } | 109 | } |
88 | 110 | ||
89 | static inline void raw_local_irq_enable(void) | 111 | static inline void arch_local_irq_disable(void) |
90 | { | 112 | { |
91 | #ifdef CONFIG_BOOKE | 113 | #ifdef CONFIG_BOOKE |
92 | __asm__ __volatile__("wrteei 1": : :"memory"); | 114 | asm volatile("wrteei 0" : : : "memory"); |
93 | #else | 115 | #else |
94 | unsigned long msr; | 116 | arch_local_irq_save(); |
95 | |||
96 | msr = mfmsr(); | ||
97 | SET_MSR_EE(msr | MSR_EE); | ||
98 | #endif | 117 | #endif |
99 | } | 118 | } |
100 | 119 | ||
101 | static inline void raw_local_irq_save_ptr(unsigned long *flags) | 120 | static inline void arch_local_irq_enable(void) |
102 | { | 121 | { |
103 | unsigned long msr; | ||
104 | msr = mfmsr(); | ||
105 | *flags = msr; | ||
106 | #ifdef CONFIG_BOOKE | 122 | #ifdef CONFIG_BOOKE |
107 | __asm__ __volatile__("wrteei 0": : :"memory"); | 123 | asm volatile("wrteei 1" : : : "memory"); |
108 | #else | 124 | #else |
109 | SET_MSR_EE(msr & ~MSR_EE); | 125 | unsigned long msr = mfmsr(); |
126 | SET_MSR_EE(msr | MSR_EE); | ||
110 | #endif | 127 | #endif |
111 | } | 128 | } |
112 | 129 | ||
113 | #define raw_local_save_flags(flags) ((flags) = mfmsr()) | 130 | static inline bool arch_irqs_disabled_flags(unsigned long flags) |
114 | #define raw_local_irq_save(flags) raw_local_irq_save_ptr(&flags) | ||
115 | #define raw_irqs_disabled() ((mfmsr() & MSR_EE) == 0) | ||
116 | #define raw_irqs_disabled_flags(flags) (((flags) & MSR_EE) == 0) | ||
117 | |||
118 | #define hard_irq_disable() raw_local_irq_disable() | ||
119 | |||
120 | static inline int irqs_disabled_flags(unsigned long flags) | ||
121 | { | 131 | { |
122 | return (flags & MSR_EE) == 0; | 132 | return (flags & MSR_EE) == 0; |
123 | } | 133 | } |
124 | 134 | ||
135 | static inline bool arch_irqs_disabled(void) | ||
136 | { | ||
137 | return arch_irqs_disabled_flags(arch_local_save_flags()); | ||
138 | } | ||
139 | |||
140 | #define hard_irq_disable() arch_local_irq_disable() | ||
141 | |||
125 | #endif /* CONFIG_PPC64 */ | 142 | #endif /* CONFIG_PPC64 */ |
126 | 143 | ||
127 | /* | 144 | /* |
diff --git a/arch/powerpc/include/asm/hydra.h b/arch/powerpc/include/asm/hydra.h index 1ad4eed07fbe..5b0c98bd46ab 100644 --- a/arch/powerpc/include/asm/hydra.h +++ b/arch/powerpc/include/asm/hydra.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | * © Copyright 1995 Apple Computer, Inc. All rights reserved. | 11 | * © Copyright 1995 Apple Computer, Inc. All rights reserved. |
12 | * | 12 | * |
13 | * It's available online from http://chrp.apple.com/MacTech.pdf. | 13 | * It's available online from http://www.cpu.lu/~mlan/ftp/MacTech.pdf |
14 | * You can obtain paper copies of this book from computer bookstores or by | 14 | * You can obtain paper copies of this book from computer bookstores or by |
15 | * writing Morgan Kaufmann Publishers, Inc., 340 Pine Street, Sixth Floor, San | 15 | * writing Morgan Kaufmann Publishers, Inc., 340 Pine Street, Sixth Floor, San |
16 | * Francisco, CA 94104. Reference ISBN 1-55860-393-X. | 16 | * Francisco, CA 94104. Reference ISBN 1-55860-393-X. |
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h index 5f68ecfdf516..b85d8ddbb666 100644 --- a/arch/powerpc/include/asm/irqflags.h +++ b/arch/powerpc/include/asm/irqflags.h | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | #ifndef __ASSEMBLY__ | 7 | #ifndef __ASSEMBLY__ |
8 | /* | 8 | /* |
9 | * Get definitions for raw_local_save_flags(x), etc. | 9 | * Get definitions for arch_local_save_flags(x), etc. |
10 | */ | 10 | */ |
11 | #include <asm/hw_irq.h> | 11 | #include <asm/hw_irq.h> |
12 | 12 | ||
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index 076327f2eff7..f54408d995b5 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h | |||
@@ -91,6 +91,7 @@ extern void machine_kexec_simple(struct kimage *image); | |||
91 | extern void crash_kexec_secondary(struct pt_regs *regs); | 91 | extern void crash_kexec_secondary(struct pt_regs *regs); |
92 | extern int overlaps_crashkernel(unsigned long start, unsigned long size); | 92 | extern int overlaps_crashkernel(unsigned long start, unsigned long size); |
93 | extern void reserve_crashkernel(void); | 93 | extern void reserve_crashkernel(void); |
94 | extern void machine_kexec_mask_interrupts(void); | ||
94 | 95 | ||
95 | #else /* !CONFIG_KEXEC */ | 96 | #else /* !CONFIG_KEXEC */ |
96 | static inline int kexec_sr_activated(int cpu) { return 0; } | 97 | static inline int kexec_sr_activated(int cpu) { return 0; } |
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h index 6c5547d82bbe..18ea6963ad77 100644 --- a/arch/powerpc/include/asm/kvm.h +++ b/arch/powerpc/include/asm/kvm.h | |||
@@ -86,5 +86,6 @@ struct kvm_guest_debug_arch { | |||
86 | 86 | ||
87 | #define KVM_INTERRUPT_SET -1U | 87 | #define KVM_INTERRUPT_SET -1U |
88 | #define KVM_INTERRUPT_UNSET -2U | 88 | #define KVM_INTERRUPT_UNSET -2U |
89 | #define KVM_INTERRUPT_SET_LEVEL -3U | ||
89 | 90 | ||
90 | #endif /* __LINUX_KVM_POWERPC_H */ | 91 | #endif /* __LINUX_KVM_POWERPC_H */ |
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h index c5ea4cda34b3..5b7504674397 100644 --- a/arch/powerpc/include/asm/kvm_asm.h +++ b/arch/powerpc/include/asm/kvm_asm.h | |||
@@ -58,6 +58,7 @@ | |||
58 | #define BOOK3S_INTERRUPT_INST_STORAGE 0x400 | 58 | #define BOOK3S_INTERRUPT_INST_STORAGE 0x400 |
59 | #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480 | 59 | #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480 |
60 | #define BOOK3S_INTERRUPT_EXTERNAL 0x500 | 60 | #define BOOK3S_INTERRUPT_EXTERNAL 0x500 |
61 | #define BOOK3S_INTERRUPT_EXTERNAL_LEVEL 0x501 | ||
61 | #define BOOK3S_INTERRUPT_ALIGNMENT 0x600 | 62 | #define BOOK3S_INTERRUPT_ALIGNMENT 0x600 |
62 | #define BOOK3S_INTERRUPT_PROGRAM 0x700 | 63 | #define BOOK3S_INTERRUPT_PROGRAM 0x700 |
63 | #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800 | 64 | #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800 |
@@ -84,7 +85,8 @@ | |||
84 | #define BOOK3S_IRQPRIO_EXTERNAL 13 | 85 | #define BOOK3S_IRQPRIO_EXTERNAL 13 |
85 | #define BOOK3S_IRQPRIO_DECREMENTER 14 | 86 | #define BOOK3S_IRQPRIO_DECREMENTER 14 |
86 | #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15 | 87 | #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15 |
87 | #define BOOK3S_IRQPRIO_MAX 16 | 88 | #define BOOK3S_IRQPRIO_EXTERNAL_LEVEL 16 |
89 | #define BOOK3S_IRQPRIO_MAX 17 | ||
88 | 90 | ||
89 | #define BOOK3S_HFLAG_DCBZ32 0x1 | 91 | #define BOOK3S_HFLAG_DCBZ32 0x1 |
90 | #define BOOK3S_HFLAG_SLB 0x2 | 92 | #define BOOK3S_HFLAG_SLB 0x2 |
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index 8274a2d43925..d62e703f1214 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -38,15 +38,6 @@ struct kvmppc_slb { | |||
38 | bool class : 1; | 38 | bool class : 1; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct kvmppc_sr { | ||
42 | u32 raw; | ||
43 | u32 vsid; | ||
44 | bool Ks : 1; | ||
45 | bool Kp : 1; | ||
46 | bool nx : 1; | ||
47 | bool valid : 1; | ||
48 | }; | ||
49 | |||
50 | struct kvmppc_bat { | 41 | struct kvmppc_bat { |
51 | u64 raw; | 42 | u64 raw; |
52 | u32 bepi; | 43 | u32 bepi; |
@@ -69,6 +60,13 @@ struct kvmppc_sid_map { | |||
69 | #define SID_MAP_NUM (1 << SID_MAP_BITS) | 60 | #define SID_MAP_NUM (1 << SID_MAP_BITS) |
70 | #define SID_MAP_MASK (SID_MAP_NUM - 1) | 61 | #define SID_MAP_MASK (SID_MAP_NUM - 1) |
71 | 62 | ||
63 | #ifdef CONFIG_PPC_BOOK3S_64 | ||
64 | #define SID_CONTEXTS 1 | ||
65 | #else | ||
66 | #define SID_CONTEXTS 128 | ||
67 | #define VSID_POOL_SIZE (SID_CONTEXTS * 16) | ||
68 | #endif | ||
69 | |||
72 | struct kvmppc_vcpu_book3s { | 70 | struct kvmppc_vcpu_book3s { |
73 | struct kvm_vcpu vcpu; | 71 | struct kvm_vcpu vcpu; |
74 | struct kvmppc_book3s_shadow_vcpu *shadow_vcpu; | 72 | struct kvmppc_book3s_shadow_vcpu *shadow_vcpu; |
@@ -79,20 +77,22 @@ struct kvmppc_vcpu_book3s { | |||
79 | u64 vsid; | 77 | u64 vsid; |
80 | } slb_shadow[64]; | 78 | } slb_shadow[64]; |
81 | u8 slb_shadow_max; | 79 | u8 slb_shadow_max; |
82 | struct kvmppc_sr sr[16]; | ||
83 | struct kvmppc_bat ibat[8]; | 80 | struct kvmppc_bat ibat[8]; |
84 | struct kvmppc_bat dbat[8]; | 81 | struct kvmppc_bat dbat[8]; |
85 | u64 hid[6]; | 82 | u64 hid[6]; |
86 | u64 gqr[8]; | 83 | u64 gqr[8]; |
87 | int slb_nr; | 84 | int slb_nr; |
88 | u32 dsisr; | ||
89 | u64 sdr1; | 85 | u64 sdr1; |
90 | u64 hior; | 86 | u64 hior; |
91 | u64 msr_mask; | 87 | u64 msr_mask; |
92 | u64 vsid_first; | ||
93 | u64 vsid_next; | 88 | u64 vsid_next; |
89 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
90 | u32 vsid_pool[VSID_POOL_SIZE]; | ||
91 | #else | ||
92 | u64 vsid_first; | ||
94 | u64 vsid_max; | 93 | u64 vsid_max; |
95 | int context_id; | 94 | #endif |
95 | int context_id[SID_CONTEXTS]; | ||
96 | ulong prog_flags; /* flags to inject when giving a 700 trap */ | 96 | ulong prog_flags; /* flags to inject when giving a 700 trap */ |
97 | }; | 97 | }; |
98 | 98 | ||
@@ -131,9 +131,10 @@ extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat, | |||
131 | bool upper, u32 val); | 131 | bool upper, u32 val); |
132 | extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr); | 132 | extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr); |
133 | extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu); | 133 | extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu); |
134 | extern pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn); | ||
134 | 135 | ||
135 | extern u32 kvmppc_trampoline_lowmem; | 136 | extern ulong kvmppc_trampoline_lowmem; |
136 | extern u32 kvmppc_trampoline_enter; | 137 | extern ulong kvmppc_trampoline_enter; |
137 | extern void kvmppc_rmcall(ulong srr0, ulong srr1); | 138 | extern void kvmppc_rmcall(ulong srr0, ulong srr1); |
138 | extern void kvmppc_load_up_fpu(void); | 139 | extern void kvmppc_load_up_fpu(void); |
139 | extern void kvmppc_load_up_altivec(void); | 140 | extern void kvmppc_load_up_altivec(void); |
diff --git a/arch/powerpc/include/asm/kvm_fpu.h b/arch/powerpc/include/asm/kvm_fpu.h index c3d4f0518a67..92daae132492 100644 --- a/arch/powerpc/include/asm/kvm_fpu.h +++ b/arch/powerpc/include/asm/kvm_fpu.h | |||
@@ -82,7 +82,7 @@ FPD_THREE_IN(fmadd) | |||
82 | FPD_THREE_IN(fnmsub) | 82 | FPD_THREE_IN(fnmsub) |
83 | FPD_THREE_IN(fnmadd) | 83 | FPD_THREE_IN(fnmadd) |
84 | 84 | ||
85 | extern void kvm_cvt_fd(u32 *from, u64 *to, u64 *fpscr); | 85 | extern void kvm_cvt_fd(u32 *from, u64 *to); |
86 | extern void kvm_cvt_df(u64 *from, u32 *to, u64 *fpscr); | 86 | extern void kvm_cvt_df(u64 *from, u32 *to); |
87 | 87 | ||
88 | #endif | 88 | #endif |
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index b0b23c007d6e..bba3b9b72a39 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/kvm_types.h> | 27 | #include <linux/kvm_types.h> |
28 | #include <linux/kvm_para.h> | ||
28 | #include <asm/kvm_asm.h> | 29 | #include <asm/kvm_asm.h> |
29 | 30 | ||
30 | #define KVM_MAX_VCPUS 1 | 31 | #define KVM_MAX_VCPUS 1 |
@@ -41,12 +42,17 @@ | |||
41 | 42 | ||
42 | #define HPTEG_CACHE_NUM (1 << 15) | 43 | #define HPTEG_CACHE_NUM (1 << 15) |
43 | #define HPTEG_HASH_BITS_PTE 13 | 44 | #define HPTEG_HASH_BITS_PTE 13 |
45 | #define HPTEG_HASH_BITS_PTE_LONG 12 | ||
44 | #define HPTEG_HASH_BITS_VPTE 13 | 46 | #define HPTEG_HASH_BITS_VPTE 13 |
45 | #define HPTEG_HASH_BITS_VPTE_LONG 5 | 47 | #define HPTEG_HASH_BITS_VPTE_LONG 5 |
46 | #define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE) | 48 | #define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE) |
49 | #define HPTEG_HASH_NUM_PTE_LONG (1 << HPTEG_HASH_BITS_PTE_LONG) | ||
47 | #define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE) | 50 | #define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE) |
48 | #define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG) | 51 | #define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG) |
49 | 52 | ||
53 | /* Physical Address Mask - allowed range of real mode RAM access */ | ||
54 | #define KVM_PAM 0x0fffffffffffffffULL | ||
55 | |||
50 | struct kvm; | 56 | struct kvm; |
51 | struct kvm_run; | 57 | struct kvm_run; |
52 | struct kvm_vcpu; | 58 | struct kvm_vcpu; |
@@ -159,8 +165,10 @@ struct kvmppc_mmu { | |||
159 | 165 | ||
160 | struct hpte_cache { | 166 | struct hpte_cache { |
161 | struct hlist_node list_pte; | 167 | struct hlist_node list_pte; |
168 | struct hlist_node list_pte_long; | ||
162 | struct hlist_node list_vpte; | 169 | struct hlist_node list_vpte; |
163 | struct hlist_node list_vpte_long; | 170 | struct hlist_node list_vpte_long; |
171 | struct rcu_head rcu_head; | ||
164 | u64 host_va; | 172 | u64 host_va; |
165 | u64 pfn; | 173 | u64 pfn; |
166 | ulong slot; | 174 | ulong slot; |
@@ -210,28 +218,20 @@ struct kvm_vcpu_arch { | |||
210 | u32 cr; | 218 | u32 cr; |
211 | #endif | 219 | #endif |
212 | 220 | ||
213 | ulong msr; | ||
214 | #ifdef CONFIG_PPC_BOOK3S | 221 | #ifdef CONFIG_PPC_BOOK3S |
215 | ulong shadow_msr; | 222 | ulong shadow_msr; |
216 | ulong hflags; | 223 | ulong hflags; |
217 | ulong guest_owned_ext; | 224 | ulong guest_owned_ext; |
218 | #endif | 225 | #endif |
219 | u32 mmucr; | 226 | u32 mmucr; |
220 | ulong sprg0; | ||
221 | ulong sprg1; | ||
222 | ulong sprg2; | ||
223 | ulong sprg3; | ||
224 | ulong sprg4; | 227 | ulong sprg4; |
225 | ulong sprg5; | 228 | ulong sprg5; |
226 | ulong sprg6; | 229 | ulong sprg6; |
227 | ulong sprg7; | 230 | ulong sprg7; |
228 | ulong srr0; | ||
229 | ulong srr1; | ||
230 | ulong csrr0; | 231 | ulong csrr0; |
231 | ulong csrr1; | 232 | ulong csrr1; |
232 | ulong dsrr0; | 233 | ulong dsrr0; |
233 | ulong dsrr1; | 234 | ulong dsrr1; |
234 | ulong dear; | ||
235 | ulong esr; | 235 | ulong esr; |
236 | u32 dec; | 236 | u32 dec; |
237 | u32 decar; | 237 | u32 decar; |
@@ -290,12 +290,17 @@ struct kvm_vcpu_arch { | |||
290 | struct tasklet_struct tasklet; | 290 | struct tasklet_struct tasklet; |
291 | u64 dec_jiffies; | 291 | u64 dec_jiffies; |
292 | unsigned long pending_exceptions; | 292 | unsigned long pending_exceptions; |
293 | struct kvm_vcpu_arch_shared *shared; | ||
294 | unsigned long magic_page_pa; /* phys addr to map the magic page to */ | ||
295 | unsigned long magic_page_ea; /* effect. addr to map the magic page to */ | ||
293 | 296 | ||
294 | #ifdef CONFIG_PPC_BOOK3S | 297 | #ifdef CONFIG_PPC_BOOK3S |
295 | struct hlist_head hpte_hash_pte[HPTEG_HASH_NUM_PTE]; | 298 | struct hlist_head hpte_hash_pte[HPTEG_HASH_NUM_PTE]; |
299 | struct hlist_head hpte_hash_pte_long[HPTEG_HASH_NUM_PTE_LONG]; | ||
296 | struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE]; | 300 | struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE]; |
297 | struct hlist_head hpte_hash_vpte_long[HPTEG_HASH_NUM_VPTE_LONG]; | 301 | struct hlist_head hpte_hash_vpte_long[HPTEG_HASH_NUM_VPTE_LONG]; |
298 | int hpte_cache_count; | 302 | int hpte_cache_count; |
303 | spinlock_t mmu_lock; | ||
299 | #endif | 304 | #endif |
300 | }; | 305 | }; |
301 | 306 | ||
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h index 2d48f6a63d0b..50533f9adf40 100644 --- a/arch/powerpc/include/asm/kvm_para.h +++ b/arch/powerpc/include/asm/kvm_para.h | |||
@@ -20,16 +20,153 @@ | |||
20 | #ifndef __POWERPC_KVM_PARA_H__ | 20 | #ifndef __POWERPC_KVM_PARA_H__ |
21 | #define __POWERPC_KVM_PARA_H__ | 21 | #define __POWERPC_KVM_PARA_H__ |
22 | 22 | ||
23 | #include <linux/types.h> | ||
24 | |||
25 | struct kvm_vcpu_arch_shared { | ||
26 | __u64 scratch1; | ||
27 | __u64 scratch2; | ||
28 | __u64 scratch3; | ||
29 | __u64 critical; /* Guest may not get interrupts if == r1 */ | ||
30 | __u64 sprg0; | ||
31 | __u64 sprg1; | ||
32 | __u64 sprg2; | ||
33 | __u64 sprg3; | ||
34 | __u64 srr0; | ||
35 | __u64 srr1; | ||
36 | __u64 dar; | ||
37 | __u64 msr; | ||
38 | __u32 dsisr; | ||
39 | __u32 int_pending; /* Tells the guest if we have an interrupt */ | ||
40 | __u32 sr[16]; | ||
41 | }; | ||
42 | |||
43 | #define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ | ||
44 | #define HC_VENDOR_KVM (42 << 16) | ||
45 | #define HC_EV_SUCCESS 0 | ||
46 | #define HC_EV_UNIMPLEMENTED 12 | ||
47 | |||
48 | #define KVM_FEATURE_MAGIC_PAGE 1 | ||
49 | |||
50 | #define KVM_MAGIC_FEAT_SR (1 << 0) | ||
51 | |||
23 | #ifdef __KERNEL__ | 52 | #ifdef __KERNEL__ |
24 | 53 | ||
54 | #ifdef CONFIG_KVM_GUEST | ||
55 | |||
56 | #include <linux/of.h> | ||
57 | |||
58 | static inline int kvm_para_available(void) | ||
59 | { | ||
60 | struct device_node *hyper_node; | ||
61 | |||
62 | hyper_node = of_find_node_by_path("/hypervisor"); | ||
63 | if (!hyper_node) | ||
64 | return 0; | ||
65 | |||
66 | if (!of_device_is_compatible(hyper_node, "linux,kvm")) | ||
67 | return 0; | ||
68 | |||
69 | return 1; | ||
70 | } | ||
71 | |||
72 | extern unsigned long kvm_hypercall(unsigned long *in, | ||
73 | unsigned long *out, | ||
74 | unsigned long nr); | ||
75 | |||
76 | #else | ||
77 | |||
25 | static inline int kvm_para_available(void) | 78 | static inline int kvm_para_available(void) |
26 | { | 79 | { |
27 | return 0; | 80 | return 0; |
28 | } | 81 | } |
29 | 82 | ||
83 | static unsigned long kvm_hypercall(unsigned long *in, | ||
84 | unsigned long *out, | ||
85 | unsigned long nr) | ||
86 | { | ||
87 | return HC_EV_UNIMPLEMENTED; | ||
88 | } | ||
89 | |||
90 | #endif | ||
91 | |||
92 | static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2) | ||
93 | { | ||
94 | unsigned long in[8]; | ||
95 | unsigned long out[8]; | ||
96 | unsigned long r; | ||
97 | |||
98 | r = kvm_hypercall(in, out, nr | HC_VENDOR_KVM); | ||
99 | *r2 = out[0]; | ||
100 | |||
101 | return r; | ||
102 | } | ||
103 | |||
104 | static inline long kvm_hypercall0(unsigned int nr) | ||
105 | { | ||
106 | unsigned long in[8]; | ||
107 | unsigned long out[8]; | ||
108 | |||
109 | return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); | ||
110 | } | ||
111 | |||
112 | static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) | ||
113 | { | ||
114 | unsigned long in[8]; | ||
115 | unsigned long out[8]; | ||
116 | |||
117 | in[0] = p1; | ||
118 | return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); | ||
119 | } | ||
120 | |||
121 | static inline long kvm_hypercall2(unsigned int nr, unsigned long p1, | ||
122 | unsigned long p2) | ||
123 | { | ||
124 | unsigned long in[8]; | ||
125 | unsigned long out[8]; | ||
126 | |||
127 | in[0] = p1; | ||
128 | in[1] = p2; | ||
129 | return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); | ||
130 | } | ||
131 | |||
132 | static inline long kvm_hypercall3(unsigned int nr, unsigned long p1, | ||
133 | unsigned long p2, unsigned long p3) | ||
134 | { | ||
135 | unsigned long in[8]; | ||
136 | unsigned long out[8]; | ||
137 | |||
138 | in[0] = p1; | ||
139 | in[1] = p2; | ||
140 | in[2] = p3; | ||
141 | return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); | ||
142 | } | ||
143 | |||
144 | static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, | ||
145 | unsigned long p2, unsigned long p3, | ||
146 | unsigned long p4) | ||
147 | { | ||
148 | unsigned long in[8]; | ||
149 | unsigned long out[8]; | ||
150 | |||
151 | in[0] = p1; | ||
152 | in[1] = p2; | ||
153 | in[2] = p3; | ||
154 | in[3] = p4; | ||
155 | return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); | ||
156 | } | ||
157 | |||
158 | |||
30 | static inline unsigned int kvm_arch_para_features(void) | 159 | static inline unsigned int kvm_arch_para_features(void) |
31 | { | 160 | { |
32 | return 0; | 161 | unsigned long r; |
162 | |||
163 | if (!kvm_para_available()) | ||
164 | return 0; | ||
165 | |||
166 | if(kvm_hypercall0_1(KVM_HC_FEATURES, &r)) | ||
167 | return 0; | ||
168 | |||
169 | return r; | ||
33 | } | 170 | } |
34 | 171 | ||
35 | #endif /* __KERNEL__ */ | 172 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 18d139ec2d22..ecb3bc74c344 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h | |||
@@ -107,6 +107,7 @@ extern int kvmppc_booke_init(void); | |||
107 | extern void kvmppc_booke_exit(void); | 107 | extern void kvmppc_booke_exit(void); |
108 | 108 | ||
109 | extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu); | 109 | extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu); |
110 | extern int kvmppc_kvm_pv(struct kvm_vcpu *vcpu); | ||
110 | 111 | ||
111 | /* | 112 | /* |
112 | * Cuts out inst bits with ordering according to spec. | 113 | * Cuts out inst bits with ordering according to spec. |
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h index 14b592dfb4e8..7f5e0fefebb0 100644 --- a/arch/powerpc/include/asm/lppaca.h +++ b/arch/powerpc/include/asm/lppaca.h | |||
@@ -153,6 +153,8 @@ struct lppaca { | |||
153 | 153 | ||
154 | extern struct lppaca lppaca[]; | 154 | extern struct lppaca lppaca[]; |
155 | 155 | ||
156 | #define lppaca_of(cpu) (*paca[cpu].lppaca_ptr) | ||
157 | |||
156 | /* | 158 | /* |
157 | * SLB shadow buffer structure as defined in the PAPR. The save_area | 159 | * SLB shadow buffer structure as defined in the PAPR. The save_area |
158 | * contains adjacent ESID and VSID pairs for each shadowed SLB. The | 160 | * contains adjacent ESID and VSID pairs for each shadowed SLB. The |
@@ -170,6 +172,33 @@ struct slb_shadow { | |||
170 | 172 | ||
171 | extern struct slb_shadow slb_shadow[]; | 173 | extern struct slb_shadow slb_shadow[]; |
172 | 174 | ||
175 | /* | ||
176 | * Layout of entries in the hypervisor's dispatch trace log buffer. | ||
177 | */ | ||
178 | struct dtl_entry { | ||
179 | u8 dispatch_reason; | ||
180 | u8 preempt_reason; | ||
181 | u16 processor_id; | ||
182 | u32 enqueue_to_dispatch_time; | ||
183 | u32 ready_to_enqueue_time; | ||
184 | u32 waiting_to_ready_time; | ||
185 | u64 timebase; | ||
186 | u64 fault_addr; | ||
187 | u64 srr0; | ||
188 | u64 srr1; | ||
189 | }; | ||
190 | |||
191 | #define DISPATCH_LOG_BYTES 4096 /* bytes per cpu */ | ||
192 | #define N_DISPATCH_LOG (DISPATCH_LOG_BYTES / sizeof(struct dtl_entry)) | ||
193 | |||
194 | /* | ||
195 | * When CONFIG_VIRT_CPU_ACCOUNTING = y, the cpu accounting code controls | ||
196 | * reading from the dispatch trace log. If other code wants to consume | ||
197 | * DTL entries, it can set this pointer to a function that will get | ||
198 | * called once for each DTL entry that gets processed. | ||
199 | */ | ||
200 | extern void (*dtl_consumer)(struct dtl_entry *entry, u64 index); | ||
201 | |||
173 | #endif /* CONFIG_PPC_BOOK3S */ | 202 | #endif /* CONFIG_PPC_BOOK3S */ |
174 | #endif /* __KERNEL__ */ | 203 | #endif /* __KERNEL__ */ |
175 | #endif /* _ASM_POWERPC_LPPACA_H */ | 204 | #endif /* _ASM_POWERPC_LPPACA_H */ |
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index adc8e6cdf339..d045b0145537 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h | |||
@@ -102,6 +102,9 @@ struct machdep_calls { | |||
102 | void (*pci_dma_dev_setup)(struct pci_dev *dev); | 102 | void (*pci_dma_dev_setup)(struct pci_dev *dev); |
103 | void (*pci_dma_bus_setup)(struct pci_bus *bus); | 103 | void (*pci_dma_bus_setup)(struct pci_bus *bus); |
104 | 104 | ||
105 | /* Platform set_dma_mask override */ | ||
106 | int (*dma_set_mask)(struct device *dev, u64 dma_mask); | ||
107 | |||
105 | int (*probe)(void); | 108 | int (*probe)(void); |
106 | void (*setup_arch)(void); /* Optional, may be NULL */ | 109 | void (*setup_arch)(void); /* Optional, may be NULL */ |
107 | void (*init_early)(void); | 110 | void (*init_early)(void); |
diff --git a/arch/powerpc/include/asm/memblock.h b/arch/powerpc/include/asm/memblock.h index 3c29728b56b1..43efc345065e 100644 --- a/arch/powerpc/include/asm/memblock.h +++ b/arch/powerpc/include/asm/memblock.h | |||
@@ -5,11 +5,4 @@ | |||
5 | 5 | ||
6 | #define MEMBLOCK_DBG(fmt...) udbg_printf(fmt) | 6 | #define MEMBLOCK_DBG(fmt...) udbg_printf(fmt) |
7 | 7 | ||
8 | #ifdef CONFIG_PPC32 | ||
9 | extern phys_addr_t lowmem_end_addr; | ||
10 | #define MEMBLOCK_REAL_LIMIT lowmem_end_addr | ||
11 | #else | ||
12 | #define MEMBLOCK_REAL_LIMIT 0 | ||
13 | #endif | ||
14 | |||
15 | #endif /* _ASM_POWERPC_MEMBLOCK_H */ | 8 | #endif /* _ASM_POWERPC_MEMBLOCK_H */ |
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h index 87a1d787c5b6..8eaed81ea642 100644 --- a/arch/powerpc/include/asm/mmu-book3e.h +++ b/arch/powerpc/include/asm/mmu-book3e.h | |||
@@ -114,6 +114,17 @@ | |||
114 | 114 | ||
115 | #define MAS7_RPN 0xFFFFFFFF | 115 | #define MAS7_RPN 0xFFFFFFFF |
116 | 116 | ||
117 | /* Bit definitions for MMUCFG */ | ||
118 | #define MMUCFG_MAVN 0x00000003 /* MMU Architecture Version Number */ | ||
119 | #define MMUCFG_MAVN_V1 0x00000000 /* v1.0 */ | ||
120 | #define MMUCFG_MAVN_V2 0x00000001 /* v2.0 */ | ||
121 | #define MMUCFG_NTLBS 0x0000000c /* Number of TLBs */ | ||
122 | #define MMUCFG_PIDSIZE 0x000007c0 /* PID Reg Size */ | ||
123 | #define MMUCFG_TWC 0x00008000 /* TLB Write Conditional (v2.0) */ | ||
124 | #define MMUCFG_LRAT 0x00010000 /* LRAT Supported (v2.0) */ | ||
125 | #define MMUCFG_RASIZE 0x00fe0000 /* Real Addr Size */ | ||
126 | #define MMUCFG_LPIDSIZE 0x0f000000 /* LPID Reg Size */ | ||
127 | |||
117 | /* Bit definitions for MMUCSR0 */ | 128 | /* Bit definitions for MMUCSR0 */ |
118 | #define MMUCSR0_TLB1FI 0x00000002 /* TLB1 Flash invalidate */ | 129 | #define MMUCSR0_TLB1FI 0x00000002 /* TLB1 Flash invalidate */ |
119 | #define MMUCSR0_TLB0FI 0x00000004 /* TLB0 Flash invalidate */ | 130 | #define MMUCSR0_TLB0FI 0x00000004 /* TLB0 Flash invalidate */ |
@@ -133,6 +144,10 @@ | |||
133 | #define TLBnCFG_GTWE 0x00010000 /* Guest can write */ | 144 | #define TLBnCFG_GTWE 0x00010000 /* Guest can write */ |
134 | #define TLBnCFG_IND 0x00020000 /* IND entries supported */ | 145 | #define TLBnCFG_IND 0x00020000 /* IND entries supported */ |
135 | #define TLBnCFG_PT 0x00040000 /* Can load from page table */ | 146 | #define TLBnCFG_PT 0x00040000 /* Can load from page table */ |
147 | #define TLBnCFG_MINSIZE 0x00f00000 /* Minimum Page Size (v1.0) */ | ||
148 | #define TLBnCFG_MINSIZE_SHIFT 20 | ||
149 | #define TLBnCFG_MAXSIZE 0x000f0000 /* Maximum Page Size (v1.0) */ | ||
150 | #define TLBnCFG_MAXSIZE_SHIFT 16 | ||
136 | #define TLBnCFG_ASSOC 0xff000000 /* Associativity */ | 151 | #define TLBnCFG_ASSOC 0xff000000 /* Associativity */ |
137 | 152 | ||
138 | /* TLBnPS encoding */ | 153 | /* TLBnPS encoding */ |
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index 7ebf42ed84a2..bb40a06d3b77 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _ASM_POWERPC_MMU_H_ | 2 | #define _ASM_POWERPC_MMU_H_ |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #include <linux/types.h> | ||
6 | |||
5 | #include <asm/asm-compat.h> | 7 | #include <asm/asm-compat.h> |
6 | #include <asm/feature-fixups.h> | 8 | #include <asm/feature-fixups.h> |
7 | 9 | ||
@@ -82,6 +84,16 @@ extern unsigned int __start___mmu_ftr_fixup, __stop___mmu_ftr_fixup; | |||
82 | extern void early_init_mmu(void); | 84 | extern void early_init_mmu(void); |
83 | extern void early_init_mmu_secondary(void); | 85 | extern void early_init_mmu_secondary(void); |
84 | 86 | ||
87 | extern void setup_initial_memory_limit(phys_addr_t first_memblock_base, | ||
88 | phys_addr_t first_memblock_size); | ||
89 | |||
90 | #ifdef CONFIG_PPC64 | ||
91 | /* This is our real memory area size on ppc64 server, on embedded, we | ||
92 | * make it match the size our of bolted TLB area | ||
93 | */ | ||
94 | extern u64 ppc64_rma_size; | ||
95 | #endif /* CONFIG_PPC64 */ | ||
96 | |||
85 | #endif /* !__ASSEMBLY__ */ | 97 | #endif /* !__ASSEMBLY__ */ |
86 | 98 | ||
87 | /* The kernel use the constants below to index in the page sizes array. | 99 | /* The kernel use the constants below to index in the page sizes array. |
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 1ff6662f7faf..ec57540cd7af 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h | |||
@@ -85,6 +85,8 @@ struct paca_struct { | |||
85 | u8 kexec_state; /* set when kexec down has irqs off */ | 85 | u8 kexec_state; /* set when kexec down has irqs off */ |
86 | #ifdef CONFIG_PPC_STD_MMU_64 | 86 | #ifdef CONFIG_PPC_STD_MMU_64 |
87 | struct slb_shadow *slb_shadow_ptr; | 87 | struct slb_shadow *slb_shadow_ptr; |
88 | struct dtl_entry *dispatch_log; | ||
89 | struct dtl_entry *dispatch_log_end; | ||
88 | 90 | ||
89 | /* | 91 | /* |
90 | * Now, starting in cacheline 2, the exception save areas | 92 | * Now, starting in cacheline 2, the exception save areas |
@@ -129,13 +131,19 @@ struct paca_struct { | |||
129 | u8 soft_enabled; /* irq soft-enable flag */ | 131 | u8 soft_enabled; /* irq soft-enable flag */ |
130 | u8 hard_enabled; /* set if irqs are enabled in MSR */ | 132 | u8 hard_enabled; /* set if irqs are enabled in MSR */ |
131 | u8 io_sync; /* writel() needs spin_unlock sync */ | 133 | u8 io_sync; /* writel() needs spin_unlock sync */ |
132 | u8 perf_event_pending; /* PM interrupt while soft-disabled */ | 134 | u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ |
133 | 135 | ||
134 | /* Stuff for accurate time accounting */ | 136 | /* Stuff for accurate time accounting */ |
135 | u64 user_time; /* accumulated usermode TB ticks */ | 137 | u64 user_time; /* accumulated usermode TB ticks */ |
136 | u64 system_time; /* accumulated system TB ticks */ | 138 | u64 system_time; /* accumulated system TB ticks */ |
137 | u64 startpurr; /* PURR/TB value snapshot */ | 139 | u64 user_time_scaled; /* accumulated usermode SPURR ticks */ |
140 | u64 starttime; /* TB value snapshot */ | ||
141 | u64 starttime_user; /* TB value on exit to usermode */ | ||
138 | u64 startspurr; /* SPURR value snapshot */ | 142 | u64 startspurr; /* SPURR value snapshot */ |
143 | u64 utime_sspurr; /* ->user_time when ->startspurr set */ | ||
144 | u64 stolen_time; /* TB ticks taken by hypervisor */ | ||
145 | u64 dtl_ridx; /* read index in dispatch log */ | ||
146 | struct dtl_entry *dtl_curr; /* pointer corresponding to dtl_ridx */ | ||
139 | 147 | ||
140 | #ifdef CONFIG_KVM_BOOK3S_HANDLER | 148 | #ifdef CONFIG_KVM_BOOK3S_HANDLER |
141 | /* We use this to store guest state in */ | 149 | /* We use this to store guest state in */ |
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h index 358ff14ea25e..932f88dcf6fa 100644 --- a/arch/powerpc/include/asm/page_64.h +++ b/arch/powerpc/include/asm/page_64.h | |||
@@ -163,7 +163,7 @@ do { \ | |||
163 | #endif /* !CONFIG_HUGETLB_PAGE */ | 163 | #endif /* !CONFIG_HUGETLB_PAGE */ |
164 | 164 | ||
165 | #define VM_DATA_DEFAULT_FLAGS \ | 165 | #define VM_DATA_DEFAULT_FLAGS \ |
166 | (test_thread_flag(TIF_32BIT) ? \ | 166 | (is_32bit_task() ? \ |
167 | VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64) | 167 | VM_DATA_DEFAULT_FLAGS32 : VM_DATA_DEFAULT_FLAGS64) |
168 | 168 | ||
169 | /* | 169 | /* |
@@ -179,7 +179,7 @@ do { \ | |||
179 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 179 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
180 | 180 | ||
181 | #define VM_STACK_DEFAULT_FLAGS \ | 181 | #define VM_STACK_DEFAULT_FLAGS \ |
182 | (test_thread_flag(TIF_32BIT) ? \ | 182 | (is_32bit_task() ? \ |
183 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) | 183 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) |
184 | 184 | ||
185 | #include <asm-generic/getorder.h> | 185 | #include <asm-generic/getorder.h> |
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h index 42fdff0e4b32..43268f15004e 100644 --- a/arch/powerpc/include/asm/ppc-pci.h +++ b/arch/powerpc/include/asm/ppc-pci.h | |||
@@ -28,8 +28,8 @@ extern void find_and_init_phbs(void); | |||
28 | extern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */ | 28 | extern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */ |
29 | 29 | ||
30 | /** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */ | 30 | /** Bus Unit ID macros; get low and hi 32-bits of the 64-bit BUID */ |
31 | #define BUID_HI(buid) ((buid) >> 32) | 31 | #define BUID_HI(buid) upper_32_bits(buid) |
32 | #define BUID_LO(buid) ((buid) & 0xffffffff) | 32 | #define BUID_LO(buid) lower_32_bits(buid) |
33 | 33 | ||
34 | /* PCI device_node operations */ | 34 | /* PCI device_node operations */ |
35 | struct device_node; | 35 | struct device_node; |
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 498fe09263d3..98210067c1cc 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/asm-compat.h> | 9 | #include <asm/asm-compat.h> |
10 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
11 | #include <asm/ppc-opcode.h> | 11 | #include <asm/ppc-opcode.h> |
12 | #include <asm/firmware.h> | ||
12 | 13 | ||
13 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
14 | #error __FILE__ should only be used in assembler files | 15 | #error __FILE__ should only be used in assembler files |
@@ -26,17 +27,13 @@ | |||
26 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 27 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
27 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) | 28 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) |
28 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) | 29 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) |
30 | #define ACCOUNT_STOLEN_TIME | ||
29 | #else | 31 | #else |
30 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) \ | 32 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) \ |
31 | beq 2f; /* if from kernel mode */ \ | 33 | beq 2f; /* if from kernel mode */ \ |
32 | BEGIN_FTR_SECTION; \ | 34 | MFTB(ra); /* get timebase */ \ |
33 | mfspr ra,SPRN_PURR; /* get processor util. reg */ \ | 35 | ld rb,PACA_STARTTIME_USER(r13); \ |
34 | END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ | 36 | std ra,PACA_STARTTIME(r13); \ |
35 | BEGIN_FTR_SECTION; \ | ||
36 | MFTB(ra); /* or get TB if no PURR */ \ | ||
37 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | ||
38 | ld rb,PACA_STARTPURR(r13); \ | ||
39 | std ra,PACA_STARTPURR(r13); \ | ||
40 | subf rb,rb,ra; /* subtract start value */ \ | 37 | subf rb,rb,ra; /* subtract start value */ \ |
41 | ld ra,PACA_USER_TIME(r13); \ | 38 | ld ra,PACA_USER_TIME(r13); \ |
42 | add ra,ra,rb; /* add on to user time */ \ | 39 | add ra,ra,rb; /* add on to user time */ \ |
@@ -44,19 +41,34 @@ END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | |||
44 | 2: | 41 | 2: |
45 | 42 | ||
46 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) \ | 43 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) \ |
47 | BEGIN_FTR_SECTION; \ | 44 | MFTB(ra); /* get timebase */ \ |
48 | mfspr ra,SPRN_PURR; /* get processor util. reg */ \ | 45 | ld rb,PACA_STARTTIME(r13); \ |
49 | END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ | 46 | std ra,PACA_STARTTIME_USER(r13); \ |
50 | BEGIN_FTR_SECTION; \ | ||
51 | MFTB(ra); /* or get TB if no PURR */ \ | ||
52 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | ||
53 | ld rb,PACA_STARTPURR(r13); \ | ||
54 | std ra,PACA_STARTPURR(r13); \ | ||
55 | subf rb,rb,ra; /* subtract start value */ \ | 47 | subf rb,rb,ra; /* subtract start value */ \ |
56 | ld ra,PACA_SYSTEM_TIME(r13); \ | 48 | ld ra,PACA_SYSTEM_TIME(r13); \ |
57 | add ra,ra,rb; /* add on to user time */ \ | 49 | add ra,ra,rb; /* add on to system time */ \ |
58 | std ra,PACA_SYSTEM_TIME(r13); | 50 | std ra,PACA_SYSTEM_TIME(r13) |
59 | #endif | 51 | |
52 | #ifdef CONFIG_PPC_SPLPAR | ||
53 | #define ACCOUNT_STOLEN_TIME \ | ||
54 | BEGIN_FW_FTR_SECTION; \ | ||
55 | beq 33f; \ | ||
56 | /* from user - see if there are any DTL entries to process */ \ | ||
57 | ld r10,PACALPPACAPTR(r13); /* get ptr to VPA */ \ | ||
58 | ld r11,PACA_DTL_RIDX(r13); /* get log read index */ \ | ||
59 | ld r10,LPPACA_DTLIDX(r10); /* get log write index */ \ | ||
60 | cmpd cr1,r11,r10; \ | ||
61 | beq+ cr1,33f; \ | ||
62 | bl .accumulate_stolen_time; \ | ||
63 | 33: \ | ||
64 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) | ||
65 | |||
66 | #else /* CONFIG_PPC_SPLPAR */ | ||
67 | #define ACCOUNT_STOLEN_TIME | ||
68 | |||
69 | #endif /* CONFIG_PPC_SPLPAR */ | ||
70 | |||
71 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | ||
60 | 72 | ||
61 | /* | 73 | /* |
62 | * Macros for storing registers into and loading registers from | 74 | * Macros for storing registers into and loading registers from |
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 19c05b0f74be..4c14187ba02d 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -118,7 +118,7 @@ extern struct task_struct *last_task_used_spe; | |||
118 | #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) | 118 | #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) |
119 | #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4)) | 119 | #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4)) |
120 | 120 | ||
121 | #define TASK_UNMAPPED_BASE ((test_thread_flag(TIF_32BIT)) ? \ | 121 | #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \ |
122 | TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) | 122 | TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) |
123 | #endif | 123 | #endif |
124 | 124 | ||
@@ -128,7 +128,7 @@ extern struct task_struct *last_task_used_spe; | |||
128 | #define STACK_TOP_USER64 TASK_SIZE_USER64 | 128 | #define STACK_TOP_USER64 TASK_SIZE_USER64 |
129 | #define STACK_TOP_USER32 TASK_SIZE_USER32 | 129 | #define STACK_TOP_USER32 TASK_SIZE_USER32 |
130 | 130 | ||
131 | #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ | 131 | #define STACK_TOP (is_32bit_task() ? \ |
132 | STACK_TOP_USER32 : STACK_TOP_USER64) | 132 | STACK_TOP_USER32 : STACK_TOP_USER64) |
133 | 133 | ||
134 | #define STACK_TOP_MAX STACK_TOP_USER64 | 134 | #define STACK_TOP_MAX STACK_TOP_USER64 |
diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h index f2b370180a09..76bb195e4f24 100644 --- a/arch/powerpc/include/asm/pte-common.h +++ b/arch/powerpc/include/asm/pte-common.h | |||
@@ -171,6 +171,13 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void); | |||
171 | /* Make modules code happy. We don't set RO yet */ | 171 | /* Make modules code happy. We don't set RO yet */ |
172 | #define PAGE_KERNEL_EXEC PAGE_KERNEL_X | 172 | #define PAGE_KERNEL_EXEC PAGE_KERNEL_X |
173 | 173 | ||
174 | /* | ||
175 | * Don't just check for any non zero bits in __PAGE_USER, since for book3e | ||
176 | * and PTE_64BIT, PAGE_KERNEL_X contains _PAGE_BAP_SR which is also in | ||
177 | * _PAGE_USER. Need to explictly match _PAGE_BAP_UR bit in that case too. | ||
178 | */ | ||
179 | #define pte_user(val) ((val & _PAGE_USER) == _PAGE_USER) | ||
180 | |||
174 | /* Advertise special mapping type for AGP */ | 181 | /* Advertise special mapping type for AGP */ |
175 | #define PAGE_AGP (PAGE_KERNEL_NC) | 182 | #define PAGE_AGP (PAGE_KERNEL_NC) |
176 | #define HAVE_PAGE_AGP | 183 | #define HAVE_PAGE_AGP |
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h index 3d35f8ae377e..9a1193e30f26 100644 --- a/arch/powerpc/include/asm/rtas.h +++ b/arch/powerpc/include/asm/rtas.h | |||
@@ -187,6 +187,7 @@ extern void rtas_progress(char *s, unsigned short hex); | |||
187 | extern void rtas_initialize(void); | 187 | extern void rtas_initialize(void); |
188 | extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data); | 188 | extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data); |
189 | extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data); | 189 | extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data); |
190 | extern int rtas_ibm_suspend_me(struct rtas_args *); | ||
190 | 191 | ||
191 | struct rtc_time; | 192 | struct rtc_time; |
192 | extern unsigned long rtas_get_boot_time(void); | 193 | extern unsigned long rtas_get_boot_time(void); |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 3d212669a130..aa0f1ebb4aaf 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -329,3 +329,22 @@ COMPAT_SYS(rt_tgsigqueueinfo) | |||
329 | SYSCALL(fanotify_init) | 329 | SYSCALL(fanotify_init) |
330 | COMPAT_SYS(fanotify_mark) | 330 | COMPAT_SYS(fanotify_mark) |
331 | SYSCALL_SPU(prlimit64) | 331 | SYSCALL_SPU(prlimit64) |
332 | SYSCALL_SPU(socket) | ||
333 | SYSCALL_SPU(bind) | ||
334 | SYSCALL_SPU(connect) | ||
335 | SYSCALL_SPU(listen) | ||
336 | SYSCALL_SPU(accept) | ||
337 | SYSCALL_SPU(getsockname) | ||
338 | SYSCALL_SPU(getpeername) | ||
339 | SYSCALL_SPU(socketpair) | ||
340 | SYSCALL_SPU(send) | ||
341 | SYSCALL_SPU(sendto) | ||
342 | COMPAT_SYS_SPU(recv) | ||
343 | COMPAT_SYS_SPU(recvfrom) | ||
344 | SYSCALL_SPU(shutdown) | ||
345 | COMPAT_SYS_SPU(setsockopt) | ||
346 | COMPAT_SYS_SPU(getsockopt) | ||
347 | COMPAT_SYS_SPU(sendmsg) | ||
348 | COMPAT_SYS_SPU(recvmsg) | ||
349 | COMPAT_SYS_SPU(recvmmsg) | ||
350 | SYSCALL_SPU(accept4) | ||
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h index 6c294acac848..5e474ddd2273 100644 --- a/arch/powerpc/include/asm/system.h +++ b/arch/powerpc/include/asm/system.h | |||
@@ -154,8 +154,8 @@ extern void enable_kernel_spe(void); | |||
154 | extern void giveup_spe(struct task_struct *); | 154 | extern void giveup_spe(struct task_struct *); |
155 | extern void load_up_spe(struct task_struct *); | 155 | extern void load_up_spe(struct task_struct *); |
156 | extern int fix_alignment(struct pt_regs *); | 156 | extern int fix_alignment(struct pt_regs *); |
157 | extern void cvt_fd(float *from, double *to, struct thread_struct *thread); | 157 | extern void cvt_fd(float *from, double *to); |
158 | extern void cvt_df(double *from, float *to, struct thread_struct *thread); | 158 | extern void cvt_df(double *from, float *to); |
159 | 159 | ||
160 | #ifndef CONFIG_SMP | 160 | #ifndef CONFIG_SMP |
161 | extern void discard_lazy_cpu_state(void); | 161 | extern void discard_lazy_cpu_state(void); |
@@ -542,10 +542,6 @@ extern void reloc_got2(unsigned long); | |||
542 | 542 | ||
543 | #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) | 543 | #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) |
544 | 544 | ||
545 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
546 | extern void account_system_vtime(struct task_struct *); | ||
547 | #endif | ||
548 | |||
549 | extern struct dentry *powerpc_debugfs_root; | 545 | extern struct dentry *powerpc_debugfs_root; |
550 | 546 | ||
551 | #endif /* __KERNEL__ */ | 547 | #endif /* __KERNEL__ */ |
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index dc779dfcf258..fe6f7c2c9c68 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h | |||
@@ -34,7 +34,6 @@ extern void to_tm(int tim, struct rtc_time * tm); | |||
34 | extern void GregorianDay(struct rtc_time *tm); | 34 | extern void GregorianDay(struct rtc_time *tm); |
35 | 35 | ||
36 | extern void generic_calibrate_decr(void); | 36 | extern void generic_calibrate_decr(void); |
37 | extern void snapshot_timebase(void); | ||
38 | 37 | ||
39 | extern void set_dec_cpu6(unsigned int val); | 38 | extern void set_dec_cpu6(unsigned int val); |
40 | 39 | ||
@@ -212,12 +211,8 @@ struct cpu_usage { | |||
212 | DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); | 211 | DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); |
213 | 212 | ||
214 | #if defined(CONFIG_VIRT_CPU_ACCOUNTING) | 213 | #if defined(CONFIG_VIRT_CPU_ACCOUNTING) |
215 | extern void calculate_steal_time(void); | ||
216 | extern void snapshot_timebases(void); | ||
217 | #define account_process_vtime(tsk) account_process_tick(tsk, 0) | 214 | #define account_process_vtime(tsk) account_process_tick(tsk, 0) |
218 | #else | 215 | #else |
219 | #define calculate_steal_time() do { } while (0) | ||
220 | #define snapshot_timebases() do { } while (0) | ||
221 | #define account_process_vtime(tsk) do { } while (0) | 216 | #define account_process_vtime(tsk) do { } while (0) |
222 | #endif | 217 | #endif |
223 | 218 | ||
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 597e6f9d094a..6151937657f6 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -348,10 +348,29 @@ | |||
348 | #define __NR_fanotify_init 323 | 348 | #define __NR_fanotify_init 323 |
349 | #define __NR_fanotify_mark 324 | 349 | #define __NR_fanotify_mark 324 |
350 | #define __NR_prlimit64 325 | 350 | #define __NR_prlimit64 325 |
351 | #define __NR_socket 326 | ||
352 | #define __NR_bind 327 | ||
353 | #define __NR_connect 328 | ||
354 | #define __NR_listen 329 | ||
355 | #define __NR_accept 330 | ||
356 | #define __NR_getsockname 331 | ||
357 | #define __NR_getpeername 332 | ||
358 | #define __NR_socketpair 333 | ||
359 | #define __NR_send 334 | ||
360 | #define __NR_sendto 335 | ||
361 | #define __NR_recv 336 | ||
362 | #define __NR_recvfrom 337 | ||
363 | #define __NR_shutdown 338 | ||
364 | #define __NR_setsockopt 339 | ||
365 | #define __NR_getsockopt 340 | ||
366 | #define __NR_sendmsg 341 | ||
367 | #define __NR_recvmsg 342 | ||
368 | #define __NR_recvmmsg 343 | ||
369 | #define __NR_accept4 344 | ||
351 | 370 | ||
352 | #ifdef __KERNEL__ | 371 | #ifdef __KERNEL__ |
353 | 372 | ||
354 | #define __NR_syscalls 326 | 373 | #define __NR_syscalls 345 |
355 | 374 | ||
356 | #define __NR__exit __NR_exit | 375 | #define __NR__exit __NR_exit |
357 | #define NR_syscalls __NR_syscalls | 376 | #define NR_syscalls __NR_syscalls |