aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/boot/.gitignore4
-rw-r--r--arch/powerpc/configs/pmac32_defconfig1
-rw-r--r--arch/powerpc/configs/ppc64_defconfig4
-rw-r--r--arch/powerpc/configs/ppc64e_defconfig1
-rw-r--r--arch/powerpc/configs/ppc6xx_defconfig1
-rw-r--r--arch/powerpc/configs/pseries_defconfig3
-rw-r--r--arch/powerpc/include/asm/bitops.h10
-rw-r--r--arch/powerpc/include/asm/compat.h60
-rw-r--r--arch/powerpc/include/asm/kvm_host.h3
-rw-r--r--arch/powerpc/include/asm/ps3.h2
-rw-r--r--arch/powerpc/include/asm/siginfo.h1
-rw-r--r--arch/powerpc/include/asm/systbl.h4
-rw-r--r--arch/powerpc/include/asm/time.h6
-rw-r--r--arch/powerpc/include/asm/ucc_fast.h2
-rw-r--r--arch/powerpc/include/asm/ucc_slow.h2
-rw-r--r--arch/powerpc/include/asm/unistd.h1
-rw-r--r--arch/powerpc/include/uapi/asm/Kbuild3
-rw-r--r--arch/powerpc/kernel/ppc32.h51
-rw-r--r--arch/powerpc/kernel/process.c3
-rw-r--r--arch/powerpc/kernel/prom_init.c66
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c45
-rw-r--r--arch/powerpc/kernel/time.c55
-rw-r--r--arch/powerpc/kvm/44x_tlb.c1
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c51
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c6
-rw-r--r--arch/powerpc/kvm/book3s_pr.c4
-rw-r--r--arch/powerpc/kvm/e500_tlb.c3
-rw-r--r--arch/powerpc/kvm/powerpc.c14
-rw-r--r--arch/powerpc/mm/fault.c2
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_generic.c2
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c2
-rw-r--r--arch/powerpc/platforms/52xx/media5200.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_rdb.c2
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c2
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c2
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype16
-rw-r--r--arch/powerpc/platforms/cell/celleb_pci.c2
-rw-r--r--arch/powerpc/platforms/cell/cpufreq_spudemand.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c21
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c40
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c8
42 files changed, 292 insertions, 220 deletions
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 1c1aadc8c48f..c32ae5ce9fff 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -1,10 +1,6 @@
1addnote 1addnote
2empty.c 2empty.c
3hack-coff 3hack-coff
4infblock.c
5infblock.h
6infcodes.c
7infcodes.h
8inffast.c 4inffast.c
9inffast.h 5inffast.h
10inffixed.h 6inffixed.h
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index f8b394a76ac3..29767a8dfea5 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -55,7 +55,6 @@ CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
55CONFIG_NETFILTER_XT_TARGET_MARK=m 55CONFIG_NETFILTER_XT_TARGET_MARK=m
56CONFIG_NETFILTER_XT_TARGET_NFLOG=m 56CONFIG_NETFILTER_XT_TARGET_NFLOG=m
57CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m 57CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
58CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
59CONFIG_NETFILTER_XT_TARGET_TRACE=m 58CONFIG_NETFILTER_XT_TARGET_TRACE=m
60CONFIG_NETFILTER_XT_TARGET_TCPMSS=m 59CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
61CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m 60CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index e263e6a5aca1..6d03530b7506 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -93,7 +93,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m
93CONFIG_NETFILTER_XT_TARGET_MARK=m 93CONFIG_NETFILTER_XT_TARGET_MARK=m
94CONFIG_NETFILTER_XT_TARGET_NFLOG=m 94CONFIG_NETFILTER_XT_TARGET_NFLOG=m
95CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m 95CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
96CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
97CONFIG_NETFILTER_XT_TARGET_TPROXY=m 96CONFIG_NETFILTER_XT_TARGET_TPROXY=m
98CONFIG_NETFILTER_XT_TARGET_TRACE=m 97CONFIG_NETFILTER_XT_TARGET_TRACE=m
99CONFIG_NETFILTER_XT_TARGET_TCPMSS=m 98CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
@@ -488,7 +487,8 @@ CONFIG_CRYPTO_TWOFISH=m
488CONFIG_CRYPTO_LZO=m 487CONFIG_CRYPTO_LZO=m
489# CONFIG_CRYPTO_ANSI_CPRNG is not set 488# CONFIG_CRYPTO_ANSI_CPRNG is not set
490CONFIG_CRYPTO_HW=y 489CONFIG_CRYPTO_HW=y
491CONFIG_CRYPTO_DEV_NX=m 490CONFIG_CRYPTO_DEV_NX=y
491CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
492CONFIG_VIRTUALIZATION=y 492CONFIG_VIRTUALIZATION=y
493CONFIG_KVM_BOOK3S_64=m 493CONFIG_KVM_BOOK3S_64=m
494CONFIG_KVM_BOOK3S_64_HV=y 494CONFIG_KVM_BOOK3S_64_HV=y
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig
index 7bd1763877ba..f55c27609fc6 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -66,7 +66,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m
66CONFIG_NETFILTER_XT_TARGET_MARK=m 66CONFIG_NETFILTER_XT_TARGET_MARK=m
67CONFIG_NETFILTER_XT_TARGET_NFLOG=m 67CONFIG_NETFILTER_XT_TARGET_NFLOG=m
68CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m 68CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
69CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
70CONFIG_NETFILTER_XT_TARGET_TPROXY=m 69CONFIG_NETFILTER_XT_TARGET_TPROXY=m
71CONFIG_NETFILTER_XT_TARGET_TRACE=m 70CONFIG_NETFILTER_XT_TARGET_TRACE=m
72CONFIG_NETFILTER_XT_TARGET_TCPMSS=m 71CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index c47f2becfbc3..be1cb6ea3a36 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -167,7 +167,6 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=m
167CONFIG_NETFILTER_XT_TARGET_MARK=m 167CONFIG_NETFILTER_XT_TARGET_MARK=m
168CONFIG_NETFILTER_XT_TARGET_NFLOG=m 168CONFIG_NETFILTER_XT_TARGET_NFLOG=m
169CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m 169CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
170CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
171CONFIG_NETFILTER_XT_TARGET_TPROXY=m 170CONFIG_NETFILTER_XT_TARGET_TPROXY=m
172CONFIG_NETFILTER_XT_TARGET_TRACE=m 171CONFIG_NETFILTER_XT_TARGET_TRACE=m
173CONFIG_NETFILTER_XT_TARGET_SECMARK=m 172CONFIG_NETFILTER_XT_TARGET_SECMARK=m
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index c169dfb3e42d..1f710a32ffae 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -370,7 +370,8 @@ CONFIG_CRYPTO_TWOFISH=m
370CONFIG_CRYPTO_LZO=m 370CONFIG_CRYPTO_LZO=m
371# CONFIG_CRYPTO_ANSI_CPRNG is not set 371# CONFIG_CRYPTO_ANSI_CPRNG is not set
372CONFIG_CRYPTO_HW=y 372CONFIG_CRYPTO_HW=y
373CONFIG_CRYPTO_DEV_NX=m 373CONFIG_CRYPTO_DEV_NX=y
374CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
374CONFIG_VIRTUALIZATION=y 375CONFIG_VIRTUALIZATION=y
375CONFIG_KVM_BOOK3S_64=m 376CONFIG_KVM_BOOK3S_64=m
376CONFIG_KVM_BOOK3S_64_HV=y 377CONFIG_KVM_BOOK3S_64_HV=y
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index efdc92618b38..dc2cf9c6d9e6 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -288,6 +288,16 @@ static __inline__ int test_bit_le(unsigned long nr,
288 return (tmp[nr >> 3] >> (nr & 7)) & 1; 288 return (tmp[nr >> 3] >> (nr & 7)) & 1;
289} 289}
290 290
291static inline void set_bit_le(int nr, void *addr)
292{
293 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
294}
295
296static inline void clear_bit_le(int nr, void *addr)
297{
298 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
299}
300
291static inline void __set_bit_le(int nr, void *addr) 301static inline void __set_bit_le(int nr, void *addr)
292{ 302{
293 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); 303 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index 88e602f6430d..84fdf6857c31 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -38,6 +38,7 @@ typedef s64 compat_s64;
38typedef u32 compat_uint_t; 38typedef u32 compat_uint_t;
39typedef u32 compat_ulong_t; 39typedef u32 compat_ulong_t;
40typedef u64 compat_u64; 40typedef u64 compat_u64;
41typedef u32 compat_uptr_t;
41 42
42struct compat_timespec { 43struct compat_timespec {
43 compat_time_t tv_sec; 44 compat_time_t tv_sec;
@@ -114,6 +115,64 @@ typedef u32 compat_old_sigset_t;
114 115
115typedef u32 compat_sigset_word; 116typedef u32 compat_sigset_word;
116 117
118typedef union compat_sigval {
119 compat_int_t sival_int;
120 compat_uptr_t sival_ptr;
121} compat_sigval_t;
122
123#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
124
125typedef struct compat_siginfo {
126 int si_signo;
127 int si_errno;
128 int si_code;
129
130 union {
131 int _pad[SI_PAD_SIZE32];
132
133 /* kill() */
134 struct {
135 compat_pid_t _pid; /* sender's pid */
136 __compat_uid_t _uid; /* sender's uid */
137 } _kill;
138
139 /* POSIX.1b timers */
140 struct {
141 compat_timer_t _tid; /* timer id */
142 int _overrun; /* overrun count */
143 compat_sigval_t _sigval; /* same as below */
144 int _sys_private; /* not to be passed to user */
145 } _timer;
146
147 /* POSIX.1b signals */
148 struct {
149 compat_pid_t _pid; /* sender's pid */
150 __compat_uid_t _uid; /* sender's uid */
151 compat_sigval_t _sigval;
152 } _rt;
153
154 /* SIGCHLD */
155 struct {
156 compat_pid_t _pid; /* which child */
157 __compat_uid_t _uid; /* sender's uid */
158 int _status; /* exit code */
159 compat_clock_t _utime;
160 compat_clock_t _stime;
161 } _sigchld;
162
163 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
164 struct {
165 unsigned int _addr; /* faulting insn/memory ref. */
166 } _sigfault;
167
168 /* SIGPOLL */
169 struct {
170 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
171 int _fd;
172 } _sigpoll;
173 } _sifields;
174} compat_siginfo_t;
175
117#define COMPAT_OFF_T_MAX 0x7fffffff 176#define COMPAT_OFF_T_MAX 0x7fffffff
118#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 177#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
119 178
@@ -123,7 +182,6 @@ typedef u32 compat_sigset_word;
123 * as pointers because the syscall entry code will have 182 * as pointers because the syscall entry code will have
124 * appropriately converted them already. 183 * appropriately converted them already.
125 */ 184 */
126typedef u32 compat_uptr_t;
127 185
128static inline void __user *compat_ptr(compat_uptr_t uptr) 186static inline void __user *compat_ptr(compat_uptr_t uptr)
129{ 187{
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index a8bf5c673a3c..28e8f5e5c63e 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -53,6 +53,8 @@
53 53
54struct kvm; 54struct kvm;
55extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 55extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
56extern int kvm_unmap_hva_range(struct kvm *kvm,
57 unsigned long start, unsigned long end);
56extern int kvm_age_hva(struct kvm *kvm, unsigned long hva); 58extern int kvm_age_hva(struct kvm *kvm, unsigned long hva);
57extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); 59extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
58extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 60extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
@@ -220,6 +222,7 @@ struct revmap_entry {
220#define KVMPPC_GOT_PAGE 0x80 222#define KVMPPC_GOT_PAGE 0x80
221 223
222struct kvm_arch_memory_slot { 224struct kvm_arch_memory_slot {
225 unsigned long *rmap;
223}; 226};
224 227
225struct kvm_arch { 228struct kvm_arch {
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index 7f065e178ec4..0e15db4d703b 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -24,7 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/device.h> 26#include <linux/device.h>
27#include "cell-pmu.h" 27#include <asm/cell-pmu.h>
28 28
29union ps3_firmware_version { 29union ps3_firmware_version {
30 u64 raw; 30 u64 raw;
diff --git a/arch/powerpc/include/asm/siginfo.h b/arch/powerpc/include/asm/siginfo.h
index 49495b0534ed..ccce3ef5cd86 100644
--- a/arch/powerpc/include/asm/siginfo.h
+++ b/arch/powerpc/include/asm/siginfo.h
@@ -10,7 +10,6 @@
10 10
11#ifdef __powerpc64__ 11#ifdef __powerpc64__
12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14#endif 13#endif
15 14
16#include <asm-generic/siginfo.h> 15#include <asm-generic/siginfo.h>
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 559ae1ee6706..840838769853 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -189,7 +189,7 @@ SYSCALL_SPU(getcwd)
189SYSCALL_SPU(capget) 189SYSCALL_SPU(capget)
190SYSCALL_SPU(capset) 190SYSCALL_SPU(capset)
191COMPAT_SYS(sigaltstack) 191COMPAT_SYS(sigaltstack)
192SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile) 192SYSX_SPU(sys_sendfile,compat_sys_sendfile_wrapper,sys_sendfile)
193SYSCALL(ni_syscall) 193SYSCALL(ni_syscall)
194SYSCALL(ni_syscall) 194SYSCALL(ni_syscall)
195PPC_SYS(vfork) 195PPC_SYS(vfork)
@@ -229,7 +229,7 @@ COMPAT_SYS_SPU(sched_setaffinity)
229COMPAT_SYS_SPU(sched_getaffinity) 229COMPAT_SYS_SPU(sched_getaffinity)
230SYSCALL(ni_syscall) 230SYSCALL(ni_syscall)
231SYSCALL(ni_syscall) 231SYSCALL(ni_syscall)
232SYS32ONLY(sendfile64) 232SYSX(sys_ni_syscall,compat_sys_sendfile64_wrapper,sys_sendfile64)
233COMPAT_SYS_SPU(io_setup) 233COMPAT_SYS_SPU(io_setup)
234SYSCALL_SPU(io_destroy) 234SYSCALL_SPU(io_destroy)
235COMPAT_SYS_SPU(io_getevents) 235COMPAT_SYS_SPU(io_getevents)
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index 3b4b4a8da922..c1f267694acb 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -197,12 +197,6 @@ struct cpu_usage {
197 197
198DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); 198DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
199 199
200#if defined(CONFIG_VIRT_CPU_ACCOUNTING)
201#define account_process_vtime(tsk) account_process_tick(tsk, 0)
202#else
203#define account_process_vtime(tsk) do { } while (0)
204#endif
205
206extern void secondary_cpu_time_init(void); 200extern void secondary_cpu_time_init(void);
207 201
208DECLARE_PER_CPU(u64, decrementers_next_tb); 202DECLARE_PER_CPU(u64, decrementers_next_tb);
diff --git a/arch/powerpc/include/asm/ucc_fast.h b/arch/powerpc/include/asm/ucc_fast.h
index 839aab8bf37d..4644c840e2fa 100644
--- a/arch/powerpc/include/asm/ucc_fast.h
+++ b/arch/powerpc/include/asm/ucc_fast.h
@@ -19,7 +19,7 @@
19#include <asm/immap_qe.h> 19#include <asm/immap_qe.h>
20#include <asm/qe.h> 20#include <asm/qe.h>
21 21
22#include "ucc.h" 22#include <asm/ucc.h>
23 23
24/* Receive BD's status */ 24/* Receive BD's status */
25#define R_E 0x80000000 /* buffer empty */ 25#define R_E 0x80000000 /* buffer empty */
diff --git a/arch/powerpc/include/asm/ucc_slow.h b/arch/powerpc/include/asm/ucc_slow.h
index 0980e6ad335b..cf131ffdb8d1 100644
--- a/arch/powerpc/include/asm/ucc_slow.h
+++ b/arch/powerpc/include/asm/ucc_slow.h
@@ -20,7 +20,7 @@
20#include <asm/immap_qe.h> 20#include <asm/immap_qe.h>
21#include <asm/qe.h> 21#include <asm/qe.h>
22 22
23#include "ucc.h" 23#include <asm/ucc.h>
24 24
25/* transmit BD's status */ 25/* transmit BD's status */
26#define T_R 0x80000000 /* ready bit */ 26#define T_R 0x80000000 /* ready bit */
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index bd377a368611..c683fa350add 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -419,6 +419,7 @@
419#define __ARCH_WANT_COMPAT_SYS_TIME 419#define __ARCH_WANT_COMPAT_SYS_TIME
420#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 420#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
421#define __ARCH_WANT_SYS_NEWFSTATAT 421#define __ARCH_WANT_SYS_NEWFSTATAT
422#define __ARCH_WANT_COMPAT_SYS_SENDFILE
422#endif 423#endif
423 424
424/* 425/*
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
new file mode 100644
index 000000000000..baebb3da1d44
--- /dev/null
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -0,0 +1,3 @@
1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm
3
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h
index dc16aefe1dd0..02fb0ee26093 100644
--- a/arch/powerpc/kernel/ppc32.h
+++ b/arch/powerpc/kernel/ppc32.h
@@ -16,57 +16,6 @@
16 16
17/* These are here to support 32-bit syscalls on a 64-bit kernel. */ 17/* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 18
19typedef struct compat_siginfo {
20 int si_signo;
21 int si_errno;
22 int si_code;
23
24 union {
25 int _pad[SI_PAD_SIZE32];
26
27 /* kill() */
28 struct {
29 compat_pid_t _pid; /* sender's pid */
30 compat_uid_t _uid; /* sender's uid */
31 } _kill;
32
33 /* POSIX.1b timers */
34 struct {
35 compat_timer_t _tid; /* timer id */
36 int _overrun; /* overrun count */
37 compat_sigval_t _sigval; /* same as below */
38 int _sys_private; /* not to be passed to user */
39 } _timer;
40
41 /* POSIX.1b signals */
42 struct {
43 compat_pid_t _pid; /* sender's pid */
44 compat_uid_t _uid; /* sender's uid */
45 compat_sigval_t _sigval;
46 } _rt;
47
48 /* SIGCHLD */
49 struct {
50 compat_pid_t _pid; /* which child */
51 compat_uid_t _uid; /* sender's uid */
52 int _status; /* exit code */
53 compat_clock_t _utime;
54 compat_clock_t _stime;
55 } _sigchld;
56
57 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
58 struct {
59 unsigned int _addr; /* faulting insn/memory ref. */
60 } _sigfault;
61
62 /* SIGPOLL */
63 struct {
64 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
65 int _fd;
66 } _sigpoll;
67 } _sifields;
68} compat_siginfo_t;
69
70#define __old_sigaction32 old_sigaction32 19#define __old_sigaction32 old_sigaction32
71 20
72struct __old_sigaction32 { 21struct __old_sigaction32 {
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 50e504c29bb9..d5ad666efd8b 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -516,9 +516,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
516 516
517 local_irq_save(flags); 517 local_irq_save(flags);
518 518
519 account_system_vtime(current);
520 account_process_vtime(current);
521
522 /* 519 /*
523 * We can't take a PMU exception inside _switch() since there is a 520 * We can't take a PMU exception inside _switch() since there is a
524 * window where the kernel stack SLB and the kernel stack are out 521 * window where the kernel stack SLB and the kernel stack are out
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ce68278a5d73..cb6c123722a2 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -705,6 +705,7 @@ static void __init early_cmdline_parse(void)
705#endif 705#endif
706#define OV5_TYPE1_AFFINITY 0x80 /* Type 1 NUMA affinity */ 706#define OV5_TYPE1_AFFINITY 0x80 /* Type 1 NUMA affinity */
707#define OV5_PFO_HW_RNG 0x80 /* PFO Random Number Generator */ 707#define OV5_PFO_HW_RNG 0x80 /* PFO Random Number Generator */
708#define OV5_PFO_HW_842 0x40 /* PFO Compression Accelerator */
708#define OV5_PFO_HW_ENCR 0x20 /* PFO Encryption Accelerator */ 709#define OV5_PFO_HW_ENCR 0x20 /* PFO Encryption Accelerator */
709 710
710/* Option Vector 6: IBM PAPR hints */ 711/* Option Vector 6: IBM PAPR hints */
@@ -774,8 +775,7 @@ static unsigned char ibm_architecture_vec[] = {
774 0, 775 0,
775 0, 776 0,
776 0, 777 0,
777 OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR, 778 OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR | OV5_PFO_HW_842,
778
779 /* option vector 6: IBM PAPR hints */ 779 /* option vector 6: IBM PAPR hints */
780 4 - 2, /* length */ 780 4 - 2, /* length */
781 0, 781 0,
@@ -1624,6 +1624,63 @@ static void __init prom_instantiate_rtas(void)
1624 1624
1625#ifdef CONFIG_PPC64 1625#ifdef CONFIG_PPC64
1626/* 1626/*
1627 * Allocate room for and instantiate Stored Measurement Log (SML)
1628 */
1629static void __init prom_instantiate_sml(void)
1630{
1631 phandle ibmvtpm_node;
1632 ihandle ibmvtpm_inst;
1633 u32 entry = 0, size = 0;
1634 u64 base;
1635
1636 prom_debug("prom_instantiate_sml: start...\n");
1637
1638 ibmvtpm_node = call_prom("finddevice", 1, 1, ADDR("/ibm,vtpm"));
1639 prom_debug("ibmvtpm_node: %x\n", ibmvtpm_node);
1640 if (!PHANDLE_VALID(ibmvtpm_node))
1641 return;
1642
1643 ibmvtpm_inst = call_prom("open", 1, 1, ADDR("/ibm,vtpm"));
1644 if (!IHANDLE_VALID(ibmvtpm_inst)) {
1645 prom_printf("opening vtpm package failed (%x)\n", ibmvtpm_inst);
1646 return;
1647 }
1648
1649 if (call_prom_ret("call-method", 2, 2, &size,
1650 ADDR("sml-get-handover-size"),
1651 ibmvtpm_inst) != 0 || size == 0) {
1652 prom_printf("SML get handover size failed\n");
1653 return;
1654 }
1655
1656 base = alloc_down(size, PAGE_SIZE, 0);
1657 if (base == 0)
1658 prom_panic("Could not allocate memory for sml\n");
1659
1660 prom_printf("instantiating sml at 0x%x...", base);
1661
1662 if (call_prom_ret("call-method", 4, 2, &entry,
1663 ADDR("sml-handover"),
1664 ibmvtpm_inst, size, base) != 0 || entry == 0) {
1665 prom_printf("SML handover failed\n");
1666 return;
1667 }
1668 prom_printf(" done\n");
1669
1670 reserve_mem(base, size);
1671
1672 prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-base",
1673 &base, sizeof(base));
1674 prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-size",
1675 &size, sizeof(size));
1676
1677 prom_debug("sml base = 0x%x\n", base);
1678 prom_debug("sml size = 0x%x\n", (long)size);
1679
1680 prom_debug("prom_instantiate_sml: end...\n");
1681}
1682
1683/*
1627 * Allocate room for and initialize TCE tables 1684 * Allocate room for and initialize TCE tables
1628 */ 1685 */
1629static void __init prom_initialize_tce_table(void) 1686static void __init prom_initialize_tce_table(void)
@@ -2916,6 +2973,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2916 prom_instantiate_opal(); 2973 prom_instantiate_opal();
2917#endif 2974#endif
2918 2975
2976#ifdef CONFIG_PPC64
2977 /* instantiate sml */
2978 prom_instantiate_sml();
2979#endif
2980
2919 /* 2981 /*
2920 * On non-powermacs, put all CPUs in spin-loops. 2982 * On non-powermacs, put all CPUs in spin-loops.
2921 * 2983 *
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 81c570633ead..abd1112da54f 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -143,48 +143,17 @@ long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t pt
143 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 143 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
144 * and the register representation of a signed int (msr in 64-bit mode) is performed. 144 * and the register representation of a signed int (msr in 64-bit mode) is performed.
145 */ 145 */
146asmlinkage long compat_sys_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count) 146asmlinkage long compat_sys_sendfile_wrapper(u32 out_fd, u32 in_fd,
147 compat_off_t __user *offset, u32 count)
147{ 148{
148 mm_segment_t old_fs = get_fs(); 149 return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
149 int ret;
150 off_t of;
151 off_t __user *up;
152
153 if (offset && get_user(of, offset))
154 return -EFAULT;
155
156 /* The __user pointer cast is valid because of the set_fs() */
157 set_fs(KERNEL_DS);
158 up = offset ? (off_t __user *) &of : NULL;
159 ret = sys_sendfile((int)out_fd, (int)in_fd, up, count);
160 set_fs(old_fs);
161
162 if (offset && put_user(of, offset))
163 return -EFAULT;
164
165 return ret;
166} 150}
167 151
168asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) 152asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd,
153 compat_loff_t __user *offset, u32 count)
169{ 154{
170 mm_segment_t old_fs = get_fs(); 155 return sys_sendfile((int)out_fd, (int)in_fd,
171 int ret; 156 (off_t __user *)offset, count);
172 loff_t lof;
173 loff_t __user *up;
174
175 if (offset && get_user(lof, offset))
176 return -EFAULT;
177
178 /* The __user pointer cast is valid because of the set_fs() */
179 set_fs(KERNEL_DS);
180 up = offset ? (loff_t __user *) &lof : NULL;
181 ret = sys_sendfile64(out_fd, in_fd, up, count);
182 set_fs(old_fs);
183
184 if (offset && put_user(lof, offset))
185 return -EFAULT;
186
187 return ret;
188} 157}
189 158
190long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, 159long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index bd693a11d86e..c9986fd400d8 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -291,13 +291,12 @@ static inline u64 calculate_stolen_time(u64 stop_tb)
291 * Account time for a transition between system, hard irq 291 * Account time for a transition between system, hard irq
292 * or soft irq state. 292 * or soft irq state.
293 */ 293 */
294void account_system_vtime(struct task_struct *tsk) 294static u64 vtime_delta(struct task_struct *tsk,
295 u64 *sys_scaled, u64 *stolen)
295{ 296{
296 u64 now, nowscaled, delta, deltascaled; 297 u64 now, nowscaled, deltascaled;
297 unsigned long flags; 298 u64 udelta, delta, user_scaled;
298 u64 stolen, udelta, sys_scaled, user_scaled;
299 299
300 local_irq_save(flags);
301 now = mftb(); 300 now = mftb();
302 nowscaled = read_spurr(now); 301 nowscaled = read_spurr(now);
303 get_paca()->system_time += now - get_paca()->starttime; 302 get_paca()->system_time += now - get_paca()->starttime;
@@ -305,7 +304,7 @@ void account_system_vtime(struct task_struct *tsk)
305 deltascaled = nowscaled - get_paca()->startspurr; 304 deltascaled = nowscaled - get_paca()->startspurr;
306 get_paca()->startspurr = nowscaled; 305 get_paca()->startspurr = nowscaled;
307 306
308 stolen = calculate_stolen_time(now); 307 *stolen = calculate_stolen_time(now);
309 308
310 delta = get_paca()->system_time; 309 delta = get_paca()->system_time;
311 get_paca()->system_time = 0; 310 get_paca()->system_time = 0;
@@ -322,35 +321,45 @@ void account_system_vtime(struct task_struct *tsk)
322 * the user ticks get saved up in paca->user_time_scaled to be 321 * the user ticks get saved up in paca->user_time_scaled to be
323 * used by account_process_tick. 322 * used by account_process_tick.
324 */ 323 */
325 sys_scaled = delta; 324 *sys_scaled = delta;
326 user_scaled = udelta; 325 user_scaled = udelta;
327 if (deltascaled != delta + udelta) { 326 if (deltascaled != delta + udelta) {
328 if (udelta) { 327 if (udelta) {
329 sys_scaled = deltascaled * delta / (delta + udelta); 328 *sys_scaled = deltascaled * delta / (delta + udelta);
330 user_scaled = deltascaled - sys_scaled; 329 user_scaled = deltascaled - *sys_scaled;
331 } else { 330 } else {
332 sys_scaled = deltascaled; 331 *sys_scaled = deltascaled;
333 } 332 }
334 } 333 }
335 get_paca()->user_time_scaled += user_scaled; 334 get_paca()->user_time_scaled += user_scaled;
336 335
337 if (in_interrupt() || idle_task(smp_processor_id()) != tsk) { 336 return delta;
338 account_system_time(tsk, 0, delta, sys_scaled); 337}
339 if (stolen) 338
340 account_steal_time(stolen); 339void vtime_account_system(struct task_struct *tsk)
341 } else { 340{
342 account_idle_time(delta + stolen); 341 u64 delta, sys_scaled, stolen;
343 } 342
344 local_irq_restore(flags); 343 delta = vtime_delta(tsk, &sys_scaled, &stolen);
344 account_system_time(tsk, 0, delta, sys_scaled);
345 if (stolen)
346 account_steal_time(stolen);
347}
348
349void vtime_account_idle(struct task_struct *tsk)
350{
351 u64 delta, sys_scaled, stolen;
352
353 delta = vtime_delta(tsk, &sys_scaled, &stolen);
354 account_idle_time(delta + stolen);
345} 355}
346EXPORT_SYMBOL_GPL(account_system_vtime);
347 356
348/* 357/*
349 * Transfer the user and system times accumulated in the paca 358 * Transfer the user and system times accumulated in the paca
350 * by the exception entry and exit code to the generic process 359 * by the exception entry and exit code to the generic process
351 * user and system time records. 360 * user and system time records.
352 * Must be called with interrupts disabled. 361 * Must be called with interrupts disabled.
353 * Assumes that account_system_vtime() has been called recently 362 * Assumes that vtime_account() has been called recently
354 * (i.e. since the last entry from usermode) so that 363 * (i.e. since the last entry from usermode) so that
355 * get_paca()->user_time_scaled is up to date. 364 * get_paca()->user_time_scaled is up to date.
356 */ 365 */
@@ -366,6 +375,12 @@ void account_process_tick(struct task_struct *tsk, int user_tick)
366 account_user_time(tsk, utime, utimescaled); 375 account_user_time(tsk, utime, utimescaled);
367} 376}
368 377
378void vtime_task_switch(struct task_struct *prev)
379{
380 vtime_account(prev);
381 account_process_tick(prev, 0);
382}
383
369#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */ 384#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */
370#define calc_cputime_factors() 385#define calc_cputime_factors()
371#endif 386#endif
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index 33aa715dab28..5dd3ab469976 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -319,7 +319,6 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr,
319 if (is_error_page(new_page)) { 319 if (is_error_page(new_page)) {
320 printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n", 320 printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n",
321 (unsigned long long)gfn); 321 (unsigned long long)gfn);
322 kvm_release_page_clean(new_page);
323 return; 322 return;
324 } 323 }
325 hpaddr = page_to_phys(new_page); 324 hpaddr = page_to_phys(new_page);
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index d03eb6f7b058..d95d11322a15 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -705,7 +705,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
705 goto out_unlock; 705 goto out_unlock;
706 hpte[0] = (hpte[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID; 706 hpte[0] = (hpte[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID;
707 707
708 rmap = &memslot->rmap[gfn - memslot->base_gfn]; 708 rmap = &memslot->arch.rmap[gfn - memslot->base_gfn];
709 lock_rmap(rmap); 709 lock_rmap(rmap);
710 710
711 /* Check if we might have been invalidated; let the guest retry if so */ 711 /* Check if we might have been invalidated; let the guest retry if so */
@@ -756,9 +756,12 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
756 goto out_put; 756 goto out_put;
757} 757}
758 758
759static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, 759static int kvm_handle_hva_range(struct kvm *kvm,
760 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 760 unsigned long start,
761 unsigned long gfn)) 761 unsigned long end,
762 int (*handler)(struct kvm *kvm,
763 unsigned long *rmapp,
764 unsigned long gfn))
762{ 765{
763 int ret; 766 int ret;
764 int retval = 0; 767 int retval = 0;
@@ -767,15 +770,25 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
767 770
768 slots = kvm_memslots(kvm); 771 slots = kvm_memslots(kvm);
769 kvm_for_each_memslot(memslot, slots) { 772 kvm_for_each_memslot(memslot, slots) {
770 unsigned long start = memslot->userspace_addr; 773 unsigned long hva_start, hva_end;
771 unsigned long end; 774 gfn_t gfn, gfn_end;
772 775
773 end = start + (memslot->npages << PAGE_SHIFT); 776 hva_start = max(start, memslot->userspace_addr);
774 if (hva >= start && hva < end) { 777 hva_end = min(end, memslot->userspace_addr +
775 gfn_t gfn_offset = (hva - start) >> PAGE_SHIFT; 778 (memslot->npages << PAGE_SHIFT));
779 if (hva_start >= hva_end)
780 continue;
781 /*
782 * {gfn(page) | page intersects with [hva_start, hva_end)} =
783 * {gfn, gfn+1, ..., gfn_end-1}.
784 */
785 gfn = hva_to_gfn_memslot(hva_start, memslot);
786 gfn_end = hva_to_gfn_memslot(hva_end + PAGE_SIZE - 1, memslot);
787
788 for (; gfn < gfn_end; ++gfn) {
789 gfn_t gfn_offset = gfn - memslot->base_gfn;
776 790
777 ret = handler(kvm, &memslot->rmap[gfn_offset], 791 ret = handler(kvm, &memslot->arch.rmap[gfn_offset], gfn);
778 memslot->base_gfn + gfn_offset);
779 retval |= ret; 792 retval |= ret;
780 } 793 }
781 } 794 }
@@ -783,6 +796,13 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
783 return retval; 796 return retval;
784} 797}
785 798
799static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
800 int (*handler)(struct kvm *kvm, unsigned long *rmapp,
801 unsigned long gfn))
802{
803 return kvm_handle_hva_range(kvm, hva, hva + 1, handler);
804}
805
786static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, 806static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
787 unsigned long gfn) 807 unsigned long gfn)
788{ 808{
@@ -850,6 +870,13 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
850 return 0; 870 return 0;
851} 871}
852 872
873int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
874{
875 if (kvm->arch.using_mmu_notifiers)
876 kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
877 return 0;
878}
879
853static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 880static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
854 unsigned long gfn) 881 unsigned long gfn)
855{ 882{
@@ -1009,7 +1036,7 @@ long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
1009 unsigned long *rmapp, *map; 1036 unsigned long *rmapp, *map;
1010 1037
1011 preempt_disable(); 1038 preempt_disable();
1012 rmapp = memslot->rmap; 1039 rmapp = memslot->arch.rmap;
1013 map = memslot->dirty_bitmap; 1040 map = memslot->dirty_bitmap;
1014 for (i = 0; i < memslot->npages; ++i) { 1041 for (i = 0; i < memslot->npages; ++i) {
1015 if (kvm_test_clear_dirty(kvm, rmapp)) 1042 if (kvm_test_clear_dirty(kvm, rmapp))
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 5c70d19494f9..fb0e821622d4 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -84,7 +84,7 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index,
84 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID)) 84 if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID))
85 return; 85 return;
86 86
87 rmap = real_vmalloc_addr(&memslot->rmap[gfn - memslot->base_gfn]); 87 rmap = real_vmalloc_addr(&memslot->arch.rmap[gfn - memslot->base_gfn]);
88 lock_rmap(rmap); 88 lock_rmap(rmap);
89 89
90 head = *rmap & KVMPPC_RMAP_INDEX; 90 head = *rmap & KVMPPC_RMAP_INDEX;
@@ -180,7 +180,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
180 if (!slot_is_aligned(memslot, psize)) 180 if (!slot_is_aligned(memslot, psize))
181 return H_PARAMETER; 181 return H_PARAMETER;
182 slot_fn = gfn - memslot->base_gfn; 182 slot_fn = gfn - memslot->base_gfn;
183 rmap = &memslot->rmap[slot_fn]; 183 rmap = &memslot->arch.rmap[slot_fn];
184 184
185 if (!kvm->arch.using_mmu_notifiers) { 185 if (!kvm->arch.using_mmu_notifiers) {
186 physp = kvm->arch.slot_phys[memslot->id]; 186 physp = kvm->arch.slot_phys[memslot->id];
@@ -197,7 +197,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
197 pa &= PAGE_MASK; 197 pa &= PAGE_MASK;
198 } else { 198 } else {
199 /* Translate to host virtual address */ 199 /* Translate to host virtual address */
200 hva = gfn_to_hva_memslot(memslot, gfn); 200 hva = __gfn_to_hva_memslot(memslot, gfn);
201 201
202 /* Look up the Linux PTE for the backing page */ 202 /* Look up the Linux PTE for the backing page */
203 pte_size = psize; 203 pte_size = psize;
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index a1baec340f7e..05c28f59f77f 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -242,10 +242,8 @@ static void kvmppc_patch_dcbz(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
242 int i; 242 int i;
243 243
244 hpage = gfn_to_page(vcpu->kvm, pte->raddr >> PAGE_SHIFT); 244 hpage = gfn_to_page(vcpu->kvm, pte->raddr >> PAGE_SHIFT);
245 if (is_error_page(hpage)) { 245 if (is_error_page(hpage))
246 kvm_release_page_clean(hpage);
247 return; 246 return;
248 }
249 247
250 hpage_offset = pte->raddr & ~PAGE_MASK; 248 hpage_offset = pte->raddr & ~PAGE_MASK;
251 hpage_offset &= ~0xFFFULL; 249 hpage_offset &= ~0xFFFULL;
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index a2b66717813d..ff38b664195d 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -520,11 +520,10 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
520 520
521 if (likely(!pfnmap)) { 521 if (likely(!pfnmap)) {
522 unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT); 522 unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
523 pfn = gfn_to_pfn_memslot(vcpu_e500->vcpu.kvm, slot, gfn); 523 pfn = gfn_to_pfn_memslot(slot, gfn);
524 if (is_error_pfn(pfn)) { 524 if (is_error_pfn(pfn)) {
525 printk(KERN_ERR "Couldn't get real page for gfn %lx!\n", 525 printk(KERN_ERR "Couldn't get real page for gfn %lx!\n",
526 (long)gfn); 526 (long)gfn);
527 kvm_release_pfn_clean(pfn);
528 return; 527 return;
529 } 528 }
530 529
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 87f4dc886076..4d213b8b0fb5 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -302,10 +302,18 @@ long kvm_arch_dev_ioctl(struct file *filp,
302void kvm_arch_free_memslot(struct kvm_memory_slot *free, 302void kvm_arch_free_memslot(struct kvm_memory_slot *free,
303 struct kvm_memory_slot *dont) 303 struct kvm_memory_slot *dont)
304{ 304{
305 if (!dont || free->arch.rmap != dont->arch.rmap) {
306 vfree(free->arch.rmap);
307 free->arch.rmap = NULL;
308 }
305} 309}
306 310
307int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 311int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
308{ 312{
313 slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap));
314 if (!slot->arch.rmap)
315 return -ENOMEM;
316
309 return 0; 317 return 0;
310} 318}
311 319
@@ -326,8 +334,12 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
326 kvmppc_core_commit_memory_region(kvm, mem); 334 kvmppc_core_commit_memory_region(kvm, mem);
327} 335}
328 336
337void kvm_arch_flush_shadow_all(struct kvm *kvm)
338{
339}
329 340
330void kvm_arch_flush_shadow(struct kvm *kvm) 341void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
342 struct kvm_memory_slot *slot)
331{ 343{
332} 344}
333 345
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 995f924e007f..5495ebe983a2 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -471,7 +471,7 @@ bad_area_nosemaphore:
471 if (is_exec && (error_code & DSISR_PROTFAULT)) 471 if (is_exec && (error_code & DSISR_PROTFAULT))
472 printk_ratelimited(KERN_CRIT "kernel tried to execute NX-protected" 472 printk_ratelimited(KERN_CRIT "kernel tried to execute NX-protected"
473 " page (%lx) - exploit attempt? (uid: %d)\n", 473 " page (%lx) - exploit attempt? (uid: %d)\n",
474 address, current_uid()); 474 address, from_kuid(&init_user_ns, current_uid()));
475 475
476 return SIGSEGV; 476 return SIGSEGV;
477 477
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 97612068fae3..969dddcf3320 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -50,7 +50,7 @@ machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
50 * Again, if your board needs to do things differently then create a 50 * Again, if your board needs to do things differently then create a
51 * board.c file for it rather than adding it to this list. 51 * board.c file for it rather than adding it to this list.
52 */ 52 */
53static const char *board[] __initdata = { 53static const char * const board[] __initconst = {
54 "amcc,acadia", 54 "amcc,acadia",
55 "amcc,haleakala", 55 "amcc,haleakala",
56 "amcc,kilauea", 56 "amcc,kilauea",
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c
index 926731f1ff01..ca1ca6669990 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -26,7 +26,7 @@
26/* 26/*
27 * list of supported boards 27 * list of supported boards
28 */ 28 */
29static const char *board[] __initdata = { 29static const char * const board[] __initconst = {
30 "prt,prtlvt", 30 "prt,prtlvt",
31 NULL 31 NULL
32}; 32};
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 01ffa64d2aa7..448d862bcf3d 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -172,7 +172,7 @@ static void __init lite5200_setup_arch(void)
172 mpc52xx_setup_pci(); 172 mpc52xx_setup_pci();
173} 173}
174 174
175static const char *board[] __initdata = { 175static const char * const board[] __initconst = {
176 "fsl,lite5200", 176 "fsl,lite5200",
177 "fsl,lite5200b", 177 "fsl,lite5200b",
178 NULL, 178 NULL,
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c
index 17d91b7da315..070d315dd6cd 100644
--- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -232,7 +232,7 @@ static void __init media5200_setup_arch(void)
232} 232}
233 233
234/* list of the supported boards */ 234/* list of the supported boards */
235static const char *board[] __initdata = { 235static const char * const board[] __initconst = {
236 "fsl,media5200", 236 "fsl,media5200",
237 NULL 237 NULL
238}; 238};
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index 16c9c9cbbb7f..eca1f0960fff 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -60,7 +60,7 @@ static void __init mpc837x_rdb_setup_arch(void)
60 60
61machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices); 61machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices);
62 62
63static const char *board[] __initdata = { 63static const char * const board[] __initconst = {
64 "fsl,mpc8377rdb", 64 "fsl,mpc8377rdb",
65 "fsl,mpc8378rdb", 65 "fsl,mpc8378rdb",
66 "fsl,mpc8379rdb", 66 "fsl,mpc8379rdb",
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 1a046715e461..1d769a29249f 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -326,7 +326,7 @@ static int pmc_probe(struct platform_device *ofdev)
326 const struct of_device_id *match; 326 const struct of_device_id *match;
327 struct device_node *np = ofdev->dev.of_node; 327 struct device_node *np = ofdev->dev.of_node;
328 struct resource res; 328 struct resource res;
329 struct pmc_type *type; 329 const struct pmc_type *type;
330 int ret = 0; 330 int ret = 0;
331 331
332 match = of_match_device(pmc_match, &ofdev->dev); 332 match = of_match_device(pmc_match, &ofdev->dev);
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index d8941eea7075..b4e58cdc09a5 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -108,7 +108,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
108 108
109machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices); 109machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices);
110 110
111static const char *board[] __initdata = { 111static const char * const board[] __initconst = {
112 "tqc,tqm8540", 112 "tqc,tqm8540",
113 "tqc,tqm8541", 113 "tqc,tqm8541",
114 "tqc,tqm8548", 114 "tqc,tqm8548",
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 30fd01de6bed..72afd2888cad 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -1,6 +1,7 @@
1config PPC64 1config PPC64
2 bool "64-bit kernel" 2 bool "64-bit kernel"
3 default n 3 default n
4 select HAVE_VIRT_CPU_ACCOUNTING
4 help 5 help
5 This option selects whether a 32-bit or a 64-bit kernel 6 This option selects whether a 32-bit or a 64-bit kernel
6 will be built. 7 will be built.
@@ -337,21 +338,6 @@ config PPC_MM_SLICES
337 default y if (!PPC_FSL_BOOK3E && PPC64 && HUGETLB_PAGE) || (PPC_STD_MMU_64 && PPC_64K_PAGES) 338 default y if (!PPC_FSL_BOOK3E && PPC64 && HUGETLB_PAGE) || (PPC_STD_MMU_64 && PPC_64K_PAGES)
338 default n 339 default n
339 340
340config VIRT_CPU_ACCOUNTING
341 bool "Deterministic task and CPU time accounting"
342 depends on PPC64
343 default y
344 help
345 Select this option to enable more accurate task and CPU time
346 accounting. This is done by reading a CPU counter on each
347 kernel entry and exit and on transitions within the kernel
348 between system, softirq and hardirq state, so there is a
349 small performance impact. This also enables accounting of
350 stolen time on logically-partitioned systems running on
351 IBM POWER5-based machines.
352
353 If in doubt, say Y here.
354
355config PPC_HAVE_PMU_SUPPORT 341config PPC_HAVE_PMU_SUPPORT
356 bool 342 bool
357 343
diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c
index 5822141aa63f..abc8af43ea7c 100644
--- a/arch/powerpc/platforms/cell/celleb_pci.c
+++ b/arch/powerpc/platforms/cell/celleb_pci.c
@@ -472,7 +472,7 @@ int __init celleb_setup_phb(struct pci_controller *phb)
472{ 472{
473 struct device_node *dev = phb->dn; 473 struct device_node *dev = phb->dn;
474 const struct of_device_id *match; 474 const struct of_device_id *match;
475 struct celleb_phb_spec *phb_spec; 475 const struct celleb_phb_spec *phb_spec;
476 int rc; 476 int rc;
477 477
478 match = of_match_node(celleb_phb_match, dev); 478 match = of_match_node(celleb_phb_match, dev);
diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
index 23bc9db4317e..82607d621aca 100644
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
@@ -76,7 +76,7 @@ static void spu_gov_work(struct work_struct *work)
76static void spu_gov_init_work(struct spu_gov_info_struct *info) 76static void spu_gov_init_work(struct spu_gov_info_struct *info)
77{ 77{
78 int delay = usecs_to_jiffies(info->poll_int); 78 int delay = usecs_to_jiffies(info->poll_int);
79 INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work); 79 INIT_DEFERRABLE_WORK(&info->work, spu_gov_work);
80 schedule_delayed_work_on(info->policy->cpu, &info->work, delay); 80 schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
81} 81}
82 82
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index 714bbfc3162c..db4e638cf408 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -69,8 +69,6 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
69 umode_t, mode, int, neighbor_fd) 69 umode_t, mode, int, neighbor_fd)
70{ 70{
71 long ret; 71 long ret;
72 struct file *neighbor;
73 int fput_needed;
74 struct spufs_calls *calls; 72 struct spufs_calls *calls;
75 73
76 calls = spufs_calls_get(); 74 calls = spufs_calls_get();
@@ -78,11 +76,11 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
78 return -ENOSYS; 76 return -ENOSYS;
79 77
80 if (flags & SPU_CREATE_AFFINITY_SPU) { 78 if (flags & SPU_CREATE_AFFINITY_SPU) {
79 struct fd neighbor = fdget(neighbor_fd);
81 ret = -EBADF; 80 ret = -EBADF;
82 neighbor = fget_light(neighbor_fd, &fput_needed); 81 if (neighbor.file) {
83 if (neighbor) { 82 ret = calls->create_thread(name, flags, mode, neighbor.file);
84 ret = calls->create_thread(name, flags, mode, neighbor); 83 fdput(neighbor);
85 fput_light(neighbor, fput_needed);
86 } 84 }
87 } else 85 } else
88 ret = calls->create_thread(name, flags, mode, NULL); 86 ret = calls->create_thread(name, flags, mode, NULL);
@@ -94,8 +92,7 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
94asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) 92asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
95{ 93{
96 long ret; 94 long ret;
97 struct file *filp; 95 struct fd arg;
98 int fput_needed;
99 struct spufs_calls *calls; 96 struct spufs_calls *calls;
100 97
101 calls = spufs_calls_get(); 98 calls = spufs_calls_get();
@@ -103,10 +100,10 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
103 return -ENOSYS; 100 return -ENOSYS;
104 101
105 ret = -EBADF; 102 ret = -EBADF;
106 filp = fget_light(fd, &fput_needed); 103 arg = fdget(fd);
107 if (filp) { 104 if (arg.file) {
108 ret = calls->spu_run(filp, unpc, ustatus); 105 ret = calls->spu_run(arg.file, unpc, ustatus);
109 fput_light(filp, fput_needed); 106 fdput(arg);
110 } 107 }
111 108
112 spufs_calls_put(calls); 109 spufs_calls_put(calls);
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index c2c5b078ba80..657e3f233a64 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -106,6 +106,17 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
106 return total; 106 return total;
107} 107}
108 108
109static int match_context(const void *v, struct file *file, unsigned fd)
110{
111 struct spu_context *ctx;
112 if (file->f_op != &spufs_context_fops)
113 return 0;
114 ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
115 if (ctx->flags & SPU_CREATE_NOSCHED)
116 return 0;
117 return fd + 1;
118}
119
109/* 120/*
110 * The additional architecture-specific notes for Cell are various 121 * The additional architecture-specific notes for Cell are various
111 * context files in the spu context. 122 * context files in the spu context.
@@ -115,29 +126,18 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd)
115 * internal functionality to dump them without needing to actually 126 * internal functionality to dump them without needing to actually
116 * open the files. 127 * open the files.
117 */ 128 */
129/*
130 * descriptor table is not shared, so files can't change or go away.
131 */
118static struct spu_context *coredump_next_context(int *fd) 132static struct spu_context *coredump_next_context(int *fd)
119{ 133{
120 struct fdtable *fdt = files_fdtable(current->files);
121 struct file *file; 134 struct file *file;
122 struct spu_context *ctx = NULL; 135 int n = iterate_fd(current->files, *fd, match_context, NULL);
123 136 if (!n)
124 for (; *fd < fdt->max_fds; (*fd)++) { 137 return NULL;
125 if (!fd_is_open(*fd, fdt)) 138 *fd = n - 1;
126 continue; 139 file = fcheck(*fd);
127 140 return SPUFS_I(file->f_dentry->d_inode)->i_ctx;
128 file = fcheck(*fd);
129
130 if (!file || file->f_op != &spufs_context_fops)
131 continue;
132
133 ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx;
134 if (ctx->flags & SPU_CREATE_NOSCHED)
135 continue;
136
137 break;
138 }
139
140 return ctx;
141} 141}
142 142
143int spufs_coredump_extra_notes_size(void) 143int spufs_coredump_extra_notes_size(void)
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 6e097de00e09..51ffafae561e 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -368,7 +368,7 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev)
368 int err, i, j, irq_index, count; 368 int err, i, j, irq_index, count;
369 int rc; 369 int rc;
370 const u32 *p; 370 const u32 *p;
371 struct fsl_msi_feature *features; 371 const struct fsl_msi_feature *features;
372 int len; 372 int len;
373 u32 offset; 373 u32 offset;
374 static const u32 all_avail[] = { 0, NR_MSI_IRQS }; 374 static const u32 all_avail[] = { 0, NR_MSI_IRQS };
@@ -502,15 +502,15 @@ static const struct fsl_msi_feature vmpic_msi_feature = {
502static const struct of_device_id fsl_of_msi_ids[] = { 502static const struct of_device_id fsl_of_msi_ids[] = {
503 { 503 {
504 .compatible = "fsl,mpic-msi", 504 .compatible = "fsl,mpic-msi",
505 .data = (void *)&mpic_msi_feature, 505 .data = &mpic_msi_feature,
506 }, 506 },
507 { 507 {
508 .compatible = "fsl,ipic-msi", 508 .compatible = "fsl,ipic-msi",
509 .data = (void *)&ipic_msi_feature, 509 .data = &ipic_msi_feature,
510 }, 510 },
511 { 511 {
512 .compatible = "fsl,vmpic-msi", 512 .compatible = "fsl,vmpic-msi",
513 .data = (void *)&vmpic_msi_feature, 513 .data = &vmpic_msi_feature,
514 }, 514 },
515 {} 515 {}
516}; 516};