aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/abs_addr.h56
-rw-r--r--arch/powerpc/include/asm/atomic.h1
-rw-r--r--arch/powerpc/include/asm/bitops.h10
-rw-r--r--arch/powerpc/include/asm/cacheflush.h2
-rw-r--r--arch/powerpc/include/asm/compat.h60
-rw-r--r--arch/powerpc/include/asm/debug.h2
-rw-r--r--arch/powerpc/include/asm/eeh.h141
-rw-r--r--arch/powerpc/include/asm/eeh_event.h6
-rw-r--r--arch/powerpc/include/asm/exception-64e.h6
-rw-r--r--arch/powerpc/include/asm/fsl_guts.h2
-rw-r--r--arch/powerpc/include/asm/fsl_ifc.h14
-rw-r--r--arch/powerpc/include/asm/hugetlb.h4
-rw-r--r--arch/powerpc/include/asm/hvcall.h5
-rw-r--r--arch/powerpc/include/asm/hw_breakpoint.h9
-rw-r--r--arch/powerpc/include/asm/kprobes.h15
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h2
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h1
-rw-r--r--arch/powerpc/include/asm/kvm_host.h3
-rw-r--r--arch/powerpc/include/asm/machdep.h12
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h169
-rw-r--r--arch/powerpc/include/asm/mmu.h9
-rw-r--r--arch/powerpc/include/asm/mpc52xx.h2
-rw-r--r--arch/powerpc/include/asm/mpic.h19
-rw-r--r--arch/powerpc/include/asm/paca.h3
-rw-r--r--arch/powerpc/include/asm/page_64.h10
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h11
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h1
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-4k.h4
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-64k.h2
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h19
-rw-r--r--arch/powerpc/include/asm/pgtable.h10
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h3
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h20
-rw-r--r--arch/powerpc/include/asm/probes.h42
-rw-r--r--arch/powerpc/include/asm/processor.h6
-rw-r--r--arch/powerpc/include/asm/ps3.h2
-rw-r--r--arch/powerpc/include/asm/pte-hash64-64k.h18
-rw-r--r--arch/powerpc/include/asm/reg.h54
-rw-r--r--arch/powerpc/include/asm/setup.h2
-rw-r--r--arch/powerpc/include/asm/siginfo.h1
-rw-r--r--arch/powerpc/include/asm/smp.h2
-rw-r--r--arch/powerpc/include/asm/sparsemem.h4
-rw-r--r--arch/powerpc/include/asm/swiotlb.h6
-rw-r--r--arch/powerpc/include/asm/systbl.h4
-rw-r--r--arch/powerpc/include/asm/thread_info.h7
-rw-r--r--arch/powerpc/include/asm/time.h6
-rw-r--r--arch/powerpc/include/asm/tlbflush.h7
-rw-r--r--arch/powerpc/include/asm/uaccess.h11
-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/asm/uprobes.h54
-rw-r--r--arch/powerpc/include/uapi/asm/Kbuild3
54 files changed, 578 insertions, 290 deletions
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 7e313f1ed183..ace53dbde2cd 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -35,4 +35,5 @@ header-y += types.h
35header-y += ucontext.h 35header-y += ucontext.h
36header-y += unistd.h 36header-y += unistd.h
37 37
38generic-y += clkdev.h
38generic-y += rwsem.h 39generic-y += rwsem.h
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h
deleted file mode 100644
index 9d92ba04b033..000000000000
--- a/arch/powerpc/include/asm/abs_addr.h
+++ /dev/null
@@ -1,56 +0,0 @@
1#ifndef _ASM_POWERPC_ABS_ADDR_H
2#define _ASM_POWERPC_ABS_ADDR_H
3#ifdef __KERNEL__
4
5
6/*
7 * c 2001 PPC 64 Team, IBM Corp
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/memblock.h>
16
17#include <asm/types.h>
18#include <asm/page.h>
19#include <asm/prom.h>
20
21struct mschunks_map {
22 unsigned long num_chunks;
23 unsigned long chunk_size;
24 unsigned long chunk_shift;
25 unsigned long chunk_mask;
26 u32 *mapping;
27};
28
29extern struct mschunks_map mschunks_map;
30
31/* Chunks are 256 KB */
32#define MSCHUNKS_CHUNK_SHIFT (18)
33#define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT)
34#define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1)
35
36static inline unsigned long chunk_to_addr(unsigned long chunk)
37{
38 return chunk << MSCHUNKS_CHUNK_SHIFT;
39}
40
41static inline unsigned long addr_to_chunk(unsigned long addr)
42{
43 return addr >> MSCHUNKS_CHUNK_SHIFT;
44}
45
46static inline unsigned long phys_to_abs(unsigned long pa)
47{
48 return pa;
49}
50
51/* Convenience macros */
52#define virt_to_abs(va) phys_to_abs(__pa(va))
53#define abs_to_virt(aa) __va(aa)
54
55#endif /* __KERNEL__ */
56#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
index da29032ae38f..e3b1d41c89be 100644
--- a/arch/powerpc/include/asm/atomic.h
+++ b/arch/powerpc/include/asm/atomic.h
@@ -268,6 +268,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
268 268
269 return t; 269 return t;
270} 270}
271#define atomic_dec_if_positive atomic_dec_if_positive
271 272
272#define smp_mb__before_atomic_dec() smp_mb() 273#define smp_mb__before_atomic_dec() smp_mb()
273#define smp_mb__after_atomic_dec() smp_mb() 274#define smp_mb__after_atomic_dec() smp_mb()
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/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index ab9e402518e8..b843e35122e8 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -30,6 +30,8 @@ extern void flush_dcache_page(struct page *page);
30#define flush_dcache_mmap_lock(mapping) do { } while (0) 30#define flush_dcache_mmap_lock(mapping) do { } while (0)
31#define flush_dcache_mmap_unlock(mapping) do { } while (0) 31#define flush_dcache_mmap_unlock(mapping) do { } while (0)
32 32
33extern void __flush_disable_L1(void);
34
33extern void __flush_icache_range(unsigned long, unsigned long); 35extern void __flush_icache_range(unsigned long, unsigned long);
34static inline void flush_icache_range(unsigned long start, unsigned long stop) 36static inline void flush_icache_range(unsigned long start, unsigned long stop)
35{ 37{
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/debug.h b/arch/powerpc/include/asm/debug.h
index 716d2f089eb6..32de2577bb6d 100644
--- a/arch/powerpc/include/asm/debug.h
+++ b/arch/powerpc/include/asm/debug.h
@@ -44,7 +44,7 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
44static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 44static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
45#endif 45#endif
46 46
47extern int set_dabr(unsigned long dabr); 47extern int set_dabr(unsigned long dabr, unsigned long dabrx);
48#ifdef CONFIG_PPC_ADV_DEBUG_REGS 48#ifdef CONFIG_PPC_ADV_DEBUG_REGS
49extern void do_send_trap(struct pt_regs *regs, unsigned long address, 49extern void do_send_trap(struct pt_regs *regs, unsigned long address,
50 unsigned long error_code, int signal_code, int brkpt); 50 unsigned long error_code, int signal_code, int brkpt);
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index d60f99814ffb..b0ef73882b38 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -32,27 +32,62 @@ struct device_node;
32#ifdef CONFIG_EEH 32#ifdef CONFIG_EEH
33 33
34/* 34/*
35 * The struct is used to trace PE related EEH functionality.
36 * In theory, there will have one instance of the struct to
37 * be created against particular PE. In nature, PEs corelate
38 * to each other. the struct has to reflect that hierarchy in
39 * order to easily pick up those affected PEs when one particular
40 * PE has EEH errors.
41 *
42 * Also, one particular PE might be composed of PCI device, PCI
43 * bus and its subordinate components. The struct also need ship
44 * the information. Further more, one particular PE is only meaingful
45 * in the corresponding PHB. Therefore, the root PEs should be created
46 * against existing PHBs in on-to-one fashion.
47 */
48#define EEH_PE_INVALID (1 << 0) /* Invalid */
49#define EEH_PE_PHB (1 << 1) /* PHB PE */
50#define EEH_PE_DEVICE (1 << 2) /* Device PE */
51#define EEH_PE_BUS (1 << 3) /* Bus PE */
52
53#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */
54#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */
55
56struct eeh_pe {
57 int type; /* PE type: PHB/Bus/Device */
58 int state; /* PE EEH dependent mode */
59 int config_addr; /* Traditional PCI address */
60 int addr; /* PE configuration address */
61 struct pci_controller *phb; /* Associated PHB */
62 int check_count; /* Times of ignored error */
63 int freeze_count; /* Times of froze up */
64 int false_positives; /* Times of reported #ff's */
65 struct eeh_pe *parent; /* Parent PE */
66 struct list_head child_list; /* Link PE to the child list */
67 struct list_head edevs; /* Link list of EEH devices */
68 struct list_head child; /* Child PEs */
69};
70
71#define eeh_pe_for_each_dev(pe, edev) \
72 list_for_each_entry(edev, &pe->edevs, list)
73
74/*
35 * The struct is used to trace EEH state for the associated 75 * The struct is used to trace EEH state for the associated
36 * PCI device node or PCI device. In future, it might 76 * PCI device node or PCI device. In future, it might
37 * represent PE as well so that the EEH device to form 77 * represent PE as well so that the EEH device to form
38 * another tree except the currently existing tree of PCI 78 * another tree except the currently existing tree of PCI
39 * buses and PCI devices 79 * buses and PCI devices
40 */ 80 */
41#define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */ 81#define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */
42#define EEH_MODE_NOCHECK (1<<1) /* EEH check should be skipped */
43#define EEH_MODE_ISOLATED (1<<2) /* The device has been isolated */
44#define EEH_MODE_RECOVERING (1<<3) /* Recovering the device */
45#define EEH_MODE_IRQ_DISABLED (1<<4) /* Interrupt disabled */
46 82
47struct eeh_dev { 83struct eeh_dev {
48 int mode; /* EEH mode */ 84 int mode; /* EEH mode */
49 int class_code; /* Class code of the device */ 85 int class_code; /* Class code of the device */
50 int config_addr; /* Config address */ 86 int config_addr; /* Config address */
51 int pe_config_addr; /* PE config address */ 87 int pe_config_addr; /* PE config address */
52 int check_count; /* Times of ignored error */
53 int freeze_count; /* Times of froze up */
54 int false_positives; /* Times of reported #ff's */
55 u32 config_space[16]; /* Saved PCI config space */ 88 u32 config_space[16]; /* Saved PCI config space */
89 struct eeh_pe *pe; /* Associated PE */
90 struct list_head list; /* Form link list in the PE */
56 struct pci_controller *phb; /* Associated PHB */ 91 struct pci_controller *phb; /* Associated PHB */
57 struct device_node *dn; /* Associated device node */ 92 struct device_node *dn; /* Associated device node */
58 struct pci_dev *pdev; /* Associated PCI device */ 93 struct pci_dev *pdev; /* Associated PCI device */
@@ -95,19 +130,51 @@ static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
95struct eeh_ops { 130struct eeh_ops {
96 char *name; 131 char *name;
97 int (*init)(void); 132 int (*init)(void);
98 int (*set_option)(struct device_node *dn, int option); 133 void* (*of_probe)(struct device_node *dn, void *flag);
99 int (*get_pe_addr)(struct device_node *dn); 134 void* (*dev_probe)(struct pci_dev *dev, void *flag);
100 int (*get_state)(struct device_node *dn, int *state); 135 int (*set_option)(struct eeh_pe *pe, int option);
101 int (*reset)(struct device_node *dn, int option); 136 int (*get_pe_addr)(struct eeh_pe *pe);
102 int (*wait_state)(struct device_node *dn, int max_wait); 137 int (*get_state)(struct eeh_pe *pe, int *state);
103 int (*get_log)(struct device_node *dn, int severity, char *drv_log, unsigned long len); 138 int (*reset)(struct eeh_pe *pe, int option);
104 int (*configure_bridge)(struct device_node *dn); 139 int (*wait_state)(struct eeh_pe *pe, int max_wait);
140 int (*get_log)(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len);
141 int (*configure_bridge)(struct eeh_pe *pe);
105 int (*read_config)(struct device_node *dn, int where, int size, u32 *val); 142 int (*read_config)(struct device_node *dn, int where, int size, u32 *val);
106 int (*write_config)(struct device_node *dn, int where, int size, u32 val); 143 int (*write_config)(struct device_node *dn, int where, int size, u32 val);
107}; 144};
108 145
109extern struct eeh_ops *eeh_ops; 146extern struct eeh_ops *eeh_ops;
110extern int eeh_subsystem_enabled; 147extern int eeh_subsystem_enabled;
148extern struct mutex eeh_mutex;
149extern int eeh_probe_mode;
150
151#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */
152#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */
153
154static inline void eeh_probe_mode_set(int flag)
155{
156 eeh_probe_mode = flag;
157}
158
159static inline int eeh_probe_mode_devtree(void)
160{
161 return (eeh_probe_mode == EEH_PROBE_MODE_DEVTREE);
162}
163
164static inline int eeh_probe_mode_dev(void)
165{
166 return (eeh_probe_mode == EEH_PROBE_MODE_DEV);
167}
168
169static inline void eeh_lock(void)
170{
171 mutex_lock(&eeh_mutex);
172}
173
174static inline void eeh_unlock(void)
175{
176 mutex_unlock(&eeh_mutex);
177}
111 178
112/* 179/*
113 * Max number of EEH freezes allowed before we consider the device 180 * Max number of EEH freezes allowed before we consider the device
@@ -115,22 +182,26 @@ extern int eeh_subsystem_enabled;
115 */ 182 */
116#define EEH_MAX_ALLOWED_FREEZES 5 183#define EEH_MAX_ALLOWED_FREEZES 5
117 184
185typedef void *(*eeh_traverse_func)(void *data, void *flag);
186int __devinit eeh_phb_pe_create(struct pci_controller *phb);
187int eeh_add_to_parent_pe(struct eeh_dev *edev);
188int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe);
189void *eeh_pe_dev_traverse(struct eeh_pe *root,
190 eeh_traverse_func fn, void *flag);
191void eeh_pe_restore_bars(struct eeh_pe *pe);
192struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
193
118void * __devinit eeh_dev_init(struct device_node *dn, void *data); 194void * __devinit eeh_dev_init(struct device_node *dn, void *data);
119void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb); 195void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
120void __init eeh_dev_phb_init(void);
121void __init eeh_init(void);
122#ifdef CONFIG_PPC_PSERIES
123int __init eeh_pseries_init(void);
124#endif
125int __init eeh_ops_register(struct eeh_ops *ops); 196int __init eeh_ops_register(struct eeh_ops *ops);
126int __exit eeh_ops_unregister(const char *name); 197int __exit eeh_ops_unregister(const char *name);
127unsigned long eeh_check_failure(const volatile void __iomem *token, 198unsigned long eeh_check_failure(const volatile void __iomem *token,
128 unsigned long val); 199 unsigned long val);
129int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); 200int eeh_dev_check_failure(struct eeh_dev *edev);
130void __init pci_addr_cache_build(void); 201void __init eeh_addr_cache_build(void);
131void eeh_add_device_tree_early(struct device_node *); 202void eeh_add_device_tree_early(struct device_node *);
132void eeh_add_device_tree_late(struct pci_bus *); 203void eeh_add_device_tree_late(struct pci_bus *);
133void eeh_remove_bus_device(struct pci_dev *); 204void eeh_remove_bus_device(struct pci_dev *, int);
134 205
135/** 206/**
136 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. 207 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
@@ -156,34 +227,24 @@ static inline void *eeh_dev_init(struct device_node *dn, void *data)
156 227
157static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { } 228static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { }
158 229
159static inline void eeh_dev_phb_init(void) { }
160
161static inline void eeh_init(void) { }
162
163#ifdef CONFIG_PPC_PSERIES
164static inline int eeh_pseries_init(void)
165{
166 return 0;
167}
168#endif /* CONFIG_PPC_PSERIES */
169
170static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 230static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
171{ 231{
172 return val; 232 return val;
173} 233}
174 234
175static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 235#define eeh_dev_check_failure(x) (0)
176{
177 return 0;
178}
179 236
180static inline void pci_addr_cache_build(void) { } 237static inline void eeh_addr_cache_build(void) { }
181 238
182static inline void eeh_add_device_tree_early(struct device_node *dn) { } 239static inline void eeh_add_device_tree_early(struct device_node *dn) { }
183 240
184static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } 241static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
185 242
186static inline void eeh_remove_bus_device(struct pci_dev *dev) { } 243static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
244
245static inline void eeh_lock(void) { }
246static inline void eeh_unlock(void) { }
247
187#define EEH_POSSIBLE_ERROR(val, type) (0) 248#define EEH_POSSIBLE_ERROR(val, type) (0)
188#define EEH_IO_ERROR_VALUE(size) (-1UL) 249#define EEH_IO_ERROR_VALUE(size) (-1UL)
189#endif /* CONFIG_EEH */ 250#endif /* CONFIG_EEH */
diff --git a/arch/powerpc/include/asm/eeh_event.h b/arch/powerpc/include/asm/eeh_event.h
index c68b012b7797..de67d830151b 100644
--- a/arch/powerpc/include/asm/eeh_event.h
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -28,11 +28,11 @@
28 */ 28 */
29struct eeh_event { 29struct eeh_event {
30 struct list_head list; /* to form event queue */ 30 struct list_head list; /* to form event queue */
31 struct eeh_dev *edev; /* EEH device */ 31 struct eeh_pe *pe; /* EEH PE */
32}; 32};
33 33
34int eeh_send_failure_event(struct eeh_dev *edev); 34int eeh_send_failure_event(struct eeh_pe *pe);
35struct eeh_dev *handle_eeh_events(struct eeh_event *); 35void eeh_handle_event(struct eeh_pe *pe);
36 36
37#endif /* __KERNEL__ */ 37#endif /* __KERNEL__ */
38#endif /* ASM_POWERPC_EEH_EVENT_H */ 38#endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
index ac13addb8495..51fa43e536b9 100644
--- a/arch/powerpc/include/asm/exception-64e.h
+++ b/arch/powerpc/include/asm/exception-64e.h
@@ -37,6 +37,7 @@
37 * critical data 37 * critical data
38 */ 38 */
39 39
40#define PACA_EXGDBELL PACA_EXGEN
40 41
41/* We are out of SPRGs so we save some things in the PACA. The normal 42/* We are out of SPRGs so we save some things in the PACA. The normal
42 * exception frame is smaller than the CRIT or MC one though 43 * exception frame is smaller than the CRIT or MC one though
@@ -45,8 +46,9 @@
45#define EX_CR (1 * 8) 46#define EX_CR (1 * 8)
46#define EX_R10 (2 * 8) 47#define EX_R10 (2 * 8)
47#define EX_R11 (3 * 8) 48#define EX_R11 (3 * 8)
48#define EX_R14 (4 * 8) 49#define EX_R13 (4 * 8)
49#define EX_R15 (5 * 8) 50#define EX_R14 (5 * 8)
51#define EX_R15 (6 * 8)
50 52
51/* 53/*
52 * The TLB miss exception uses different slots. 54 * The TLB miss exception uses different slots.
diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h
index aa4c488589ce..dd5ba2c22771 100644
--- a/arch/powerpc/include/asm/fsl_guts.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -48,6 +48,8 @@ struct ccsr_guts {
48 __be32 dmuxcr; /* 0x.0068 - DMA Mux Control Register */ 48 __be32 dmuxcr; /* 0x.0068 - DMA Mux Control Register */
49 u8 res06c[0x70 - 0x6c]; 49 u8 res06c[0x70 - 0x6c];
50 __be32 devdisr; /* 0x.0070 - Device Disable Control */ 50 __be32 devdisr; /* 0x.0070 - Device Disable Control */
51#define CCSR_GUTS_DEVDISR_TB1 0x00001000
52#define CCSR_GUTS_DEVDISR_TB0 0x00004000
51 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */ 53 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */
52 u8 res078[0x7c - 0x78]; 54 u8 res078[0x7c - 0x78];
53 __be32 pmjcr; /* 0x.007c - 4 Power Management Jog Control Register */ 55 __be32 pmjcr; /* 0x.007c - 4 Power Management Jog Control Register */
diff --git a/arch/powerpc/include/asm/fsl_ifc.h b/arch/powerpc/include/asm/fsl_ifc.h
index b955012939a2..b8a4b9bc50b3 100644
--- a/arch/powerpc/include/asm/fsl_ifc.h
+++ b/arch/powerpc/include/asm/fsl_ifc.h
@@ -768,22 +768,24 @@ struct fsl_ifc_gpcm {
768 */ 768 */
769struct fsl_ifc_regs { 769struct fsl_ifc_regs {
770 __be32 ifc_rev; 770 __be32 ifc_rev;
771 u32 res1[0x3]; 771 u32 res1[0x2];
772 struct { 772 struct {
773 __be32 cspr_ext;
773 __be32 cspr; 774 __be32 cspr;
774 u32 res2[0x2]; 775 u32 res2;
775 } cspr_cs[FSL_IFC_BANK_COUNT]; 776 } cspr_cs[FSL_IFC_BANK_COUNT];
776 u32 res3[0x18]; 777 u32 res3[0x19];
777 struct { 778 struct {
778 __be32 amask; 779 __be32 amask;
779 u32 res4[0x2]; 780 u32 res4[0x2];
780 } amask_cs[FSL_IFC_BANK_COUNT]; 781 } amask_cs[FSL_IFC_BANK_COUNT];
781 u32 res5[0x18]; 782 u32 res5[0x17];
782 struct { 783 struct {
784 __be32 csor_ext;
783 __be32 csor; 785 __be32 csor;
784 u32 res6[0x2]; 786 u32 res6;
785 } csor_cs[FSL_IFC_BANK_COUNT]; 787 } csor_cs[FSL_IFC_BANK_COUNT];
786 u32 res7[0x18]; 788 u32 res7[0x19];
787 struct { 789 struct {
788 __be32 ftim[4]; 790 __be32 ftim[4];
789 u32 res8[0x8]; 791 u32 res8[0x8];
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index dfdb95bc59a5..62e11a32c4c2 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -151,6 +151,10 @@ static inline void arch_release_hugepage(struct page *page)
151{ 151{
152} 152}
153 153
154static inline void arch_clear_hugepage_flags(struct page *page)
155{
156}
157
154#else /* ! CONFIG_HUGETLB_PAGE */ 158#else /* ! CONFIG_HUGETLB_PAGE */
155static inline void flush_hugetlb_page(struct vm_area_struct *vma, 159static inline void flush_hugetlb_page(struct vm_area_struct *vma,
156 unsigned long vmaddr) 160 unsigned long vmaddr)
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 423cf9eaf4a4..7a867065db79 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -152,11 +152,6 @@
152#define H_VASI_RESUMED 5 152#define H_VASI_RESUMED 5
153#define H_VASI_COMPLETED 6 153#define H_VASI_COMPLETED 6
154 154
155/* DABRX flags */
156#define H_DABRX_HYPERVISOR (1UL<<(63-61))
157#define H_DABRX_KERNEL (1UL<<(63-62))
158#define H_DABRX_USER (1UL<<(63-63))
159
160/* Each control block has to be on a 4K boundary */ 155/* Each control block has to be on a 4K boundary */
161#define H_CB_ALIGNMENT 4096 156#define H_CB_ALIGNMENT 4096
162 157
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h
index be04330af751..423424599dad 100644
--- a/arch/powerpc/include/asm/hw_breakpoint.h
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -27,10 +27,11 @@
27#ifdef CONFIG_HAVE_HW_BREAKPOINT 27#ifdef CONFIG_HAVE_HW_BREAKPOINT
28 28
29struct arch_hw_breakpoint { 29struct arch_hw_breakpoint {
30 bool extraneous_interrupt;
31 u8 len; /* length of the target data symbol */
32 int type;
33 unsigned long address; 30 unsigned long address;
31 unsigned long dabrx;
32 int type;
33 u8 len; /* length of the target data symbol */
34 bool extraneous_interrupt;
34}; 35};
35 36
36#include <linux/kdebug.h> 37#include <linux/kdebug.h>
@@ -61,7 +62,7 @@ extern void ptrace_triggered(struct perf_event *bp,
61 struct perf_sample_data *data, struct pt_regs *regs); 62 struct perf_sample_data *data, struct pt_regs *regs);
62static inline void hw_breakpoint_disable(void) 63static inline void hw_breakpoint_disable(void)
63{ 64{
64 set_dabr(0); 65 set_dabr(0, 0);
65} 66}
66extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs); 67extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs);
67 68
diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
index be0171afdc0f..7b6feab6fd26 100644
--- a/arch/powerpc/include/asm/kprobes.h
+++ b/arch/powerpc/include/asm/kprobes.h
@@ -29,21 +29,16 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/percpu.h> 31#include <linux/percpu.h>
32#include <asm/probes.h>
32 33
33#define __ARCH_WANT_KPROBES_INSN_SLOT 34#define __ARCH_WANT_KPROBES_INSN_SLOT
34 35
35struct pt_regs; 36struct pt_regs;
36struct kprobe; 37struct kprobe;
37 38
38typedef unsigned int kprobe_opcode_t; 39typedef ppc_opcode_t kprobe_opcode_t;
39#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
40#define MAX_INSN_SIZE 1 40#define MAX_INSN_SIZE 1
41 41
42#define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)
43#define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088)
44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
46
47#ifdef CONFIG_PPC64 42#ifdef CONFIG_PPC64
48/* 43/*
49 * 64bit powerpc uses function descriptors. 44 * 64bit powerpc uses function descriptors.
@@ -72,12 +67,6 @@ typedef unsigned int kprobe_opcode_t;
72 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \ 67 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \
73 } \ 68 } \
74} 69}
75
76#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
77 IS_TWI(instr) || IS_TDI(instr))
78#else
79/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */
80#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
81#endif 70#endif
82 71
83#define flush_insn_slot(p) do { } while (0) 72#define flush_insn_slot(p) do { } while (0)
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index f0e0c6a66d97..7aefdb3e1ce4 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -59,7 +59,7 @@ struct hpte_cache {
59 struct hlist_node list_vpte; 59 struct hlist_node list_vpte;
60 struct hlist_node list_vpte_long; 60 struct hlist_node list_vpte_long;
61 struct rcu_head rcu_head; 61 struct rcu_head rcu_head;
62 u64 host_va; 62 u64 host_vpn;
63 u64 pfn; 63 u64 pfn;
64 ulong slot; 64 ulong slot;
65 struct kvmppc_pte pte; 65 struct kvmppc_pte pte;
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index bfcd00c1485d..88609b23b775 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -74,7 +74,6 @@ struct kvmppc_host_state {
74 ulong vmhandler; 74 ulong vmhandler;
75 ulong scratch0; 75 ulong scratch0;
76 ulong scratch1; 76 ulong scratch1;
77 ulong sprg3;
78 u8 in_guest; 77 u8 in_guest;
79 u8 restore_hid5; 78 u8 restore_hid5;
80 u8 napping; 79 u8 napping;
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/machdep.h b/arch/powerpc/include/asm/machdep.h
index 42ce570812c1..c4231973edd3 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -34,19 +34,19 @@ struct machdep_calls {
34 char *name; 34 char *name;
35#ifdef CONFIG_PPC64 35#ifdef CONFIG_PPC64
36 void (*hpte_invalidate)(unsigned long slot, 36 void (*hpte_invalidate)(unsigned long slot,
37 unsigned long va, 37 unsigned long vpn,
38 int psize, int ssize, 38 int psize, int ssize,
39 int local); 39 int local);
40 long (*hpte_updatepp)(unsigned long slot, 40 long (*hpte_updatepp)(unsigned long slot,
41 unsigned long newpp, 41 unsigned long newpp,
42 unsigned long va, 42 unsigned long vpn,
43 int psize, int ssize, 43 int psize, int ssize,
44 int local); 44 int local);
45 void (*hpte_updateboltedpp)(unsigned long newpp, 45 void (*hpte_updateboltedpp)(unsigned long newpp,
46 unsigned long ea, 46 unsigned long ea,
47 int psize, int ssize); 47 int psize, int ssize);
48 long (*hpte_insert)(unsigned long hpte_group, 48 long (*hpte_insert)(unsigned long hpte_group,
49 unsigned long va, 49 unsigned long vpn,
50 unsigned long prpn, 50 unsigned long prpn,
51 unsigned long rflags, 51 unsigned long rflags,
52 unsigned long vflags, 52 unsigned long vflags,
@@ -180,7 +180,8 @@ struct machdep_calls {
180 void (*enable_pmcs)(void); 180 void (*enable_pmcs)(void);
181 181
182 /* Set DABR for this platform, leave empty for default implemenation */ 182 /* Set DABR for this platform, leave empty for default implemenation */
183 int (*set_dabr)(unsigned long dabr); 183 int (*set_dabr)(unsigned long dabr,
184 unsigned long dabrx);
184 185
185#ifdef CONFIG_PPC32 /* XXX for now */ 186#ifdef CONFIG_PPC32 /* XXX for now */
186 /* A general init function, called by ppc_init in init/main.c. 187 /* A general init function, called by ppc_init in init/main.c.
@@ -214,6 +215,9 @@ struct machdep_calls {
214 /* Called after scan and before resource survey */ 215 /* Called after scan and before resource survey */
215 void (*pcibios_fixup_phb)(struct pci_controller *hose); 216 void (*pcibios_fixup_phb)(struct pci_controller *hose);
216 217
218 /* Called during PCI resource reassignment */
219 resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type);
220
217 /* Called to shutdown machine specific hardware not already controlled 221 /* Called to shutdown machine specific hardware not already controlled
218 * by other drivers. 222 * by other drivers.
219 */ 223 */
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 1c65a59881ea..9673f73eb8db 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -16,6 +16,13 @@
16#include <asm/page.h> 16#include <asm/page.h>
17 17
18/* 18/*
19 * This is necessary to get the definition of PGTABLE_RANGE which we
20 * need for various slices related matters. Note that this isn't the
21 * complete pgtable.h but only a portion of it.
22 */
23#include <asm/pgtable-ppc64.h>
24
25/*
19 * Segment table 26 * Segment table
20 */ 27 */
21 28
@@ -154,9 +161,25 @@ struct mmu_psize_def
154#define MMU_SEGSIZE_256M 0 161#define MMU_SEGSIZE_256M 0
155#define MMU_SEGSIZE_1T 1 162#define MMU_SEGSIZE_1T 1
156 163
164/*
165 * encode page number shift.
166 * in order to fit the 78 bit va in a 64 bit variable we shift the va by
167 * 12 bits. This enable us to address upto 76 bit va.
168 * For hpt hash from a va we can ignore the page size bits of va and for
169 * hpte encoding we ignore up to 23 bits of va. So ignoring lower 12 bits ensure
170 * we work in all cases including 4k page size.
171 */
172#define VPN_SHIFT 12
157 173
158#ifndef __ASSEMBLY__ 174#ifndef __ASSEMBLY__
159 175
176static inline int segment_shift(int ssize)
177{
178 if (ssize == MMU_SEGSIZE_256M)
179 return SID_SHIFT;
180 return SID_SHIFT_1T;
181}
182
160/* 183/*
161 * The current system page and segment sizes 184 * The current system page and segment sizes
162 */ 185 */
@@ -180,18 +203,39 @@ extern unsigned long tce_alloc_start, tce_alloc_end;
180extern int mmu_ci_restrictions; 203extern int mmu_ci_restrictions;
181 204
182/* 205/*
206 * This computes the AVPN and B fields of the first dword of a HPTE,
207 * for use when we want to match an existing PTE. The bottom 7 bits
208 * of the returned value are zero.
209 */
210static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,
211 int ssize)
212{
213 unsigned long v;
214 /*
215 * The AVA field omits the low-order 23 bits of the 78 bits VA.
216 * These bits are not needed in the PTE, because the
217 * low-order b of these bits are part of the byte offset
218 * into the virtual page and, if b < 23, the high-order
219 * 23-b of these bits are always used in selecting the
220 * PTEGs to be searched
221 */
222 v = (vpn >> (23 - VPN_SHIFT)) & ~(mmu_psize_defs[psize].avpnm);
223 v <<= HPTE_V_AVPN_SHIFT;
224 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
225 return v;
226}
227
228/*
183 * This function sets the AVPN and L fields of the HPTE appropriately 229 * This function sets the AVPN and L fields of the HPTE appropriately
184 * for the page size 230 * for the page size
185 */ 231 */
186static inline unsigned long hpte_encode_v(unsigned long va, int psize, 232static inline unsigned long hpte_encode_v(unsigned long vpn,
187 int ssize) 233 int psize, int ssize)
188{ 234{
189 unsigned long v; 235 unsigned long v;
190 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); 236 v = hpte_encode_avpn(vpn, psize, ssize);
191 v <<= HPTE_V_AVPN_SHIFT;
192 if (psize != MMU_PAGE_4K) 237 if (psize != MMU_PAGE_4K)
193 v |= HPTE_V_LARGE; 238 v |= HPTE_V_LARGE;
194 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
195 return v; 239 return v;
196} 240}
197 241
@@ -216,30 +260,37 @@ static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
216} 260}
217 261
218/* 262/*
219 * Build a VA given VSID, EA and segment size 263 * Build a VPN_SHIFT bit shifted va given VSID, EA and segment size.
220 */ 264 */
221static inline unsigned long hpt_va(unsigned long ea, unsigned long vsid, 265static inline unsigned long hpt_vpn(unsigned long ea,
222 int ssize) 266 unsigned long vsid, int ssize)
223{ 267{
224 if (ssize == MMU_SEGSIZE_256M) 268 unsigned long mask;
225 return (vsid << 28) | (ea & 0xfffffffUL); 269 int s_shift = segment_shift(ssize);
226 return (vsid << 40) | (ea & 0xffffffffffUL); 270
271 mask = (1ul << (s_shift - VPN_SHIFT)) - 1;
272 return (vsid << (s_shift - VPN_SHIFT)) | ((ea >> VPN_SHIFT) & mask);
227} 273}
228 274
229/* 275/*
230 * This hashes a virtual address 276 * This hashes a virtual address
231 */ 277 */
232 278static inline unsigned long hpt_hash(unsigned long vpn,
233static inline unsigned long hpt_hash(unsigned long va, unsigned int shift, 279 unsigned int shift, int ssize)
234 int ssize)
235{ 280{
281 int mask;
236 unsigned long hash, vsid; 282 unsigned long hash, vsid;
237 283
284 /* VPN_SHIFT can be atmost 12 */
238 if (ssize == MMU_SEGSIZE_256M) { 285 if (ssize == MMU_SEGSIZE_256M) {
239 hash = (va >> 28) ^ ((va & 0x0fffffffUL) >> shift); 286 mask = (1ul << (SID_SHIFT - VPN_SHIFT)) - 1;
287 hash = (vpn >> (SID_SHIFT - VPN_SHIFT)) ^
288 ((vpn & mask) >> (shift - VPN_SHIFT));
240 } else { 289 } else {
241 vsid = va >> 40; 290 mask = (1ul << (SID_SHIFT_1T - VPN_SHIFT)) - 1;
242 hash = vsid ^ (vsid << 25) ^ ((va & 0xffffffffffUL) >> shift); 291 vsid = vpn >> (SID_SHIFT_1T - VPN_SHIFT);
292 hash = vsid ^ (vsid << 25) ^
293 ((vpn & mask) >> (shift - VPN_SHIFT)) ;
243 } 294 }
244 return hash & 0x7fffffffffUL; 295 return hash & 0x7fffffffffUL;
245} 296}
@@ -280,63 +331,61 @@ extern void slb_set_size(u16 size);
280#endif /* __ASSEMBLY__ */ 331#endif /* __ASSEMBLY__ */
281 332
282/* 333/*
283 * VSID allocation 334 * VSID allocation (256MB segment)
335 *
336 * We first generate a 38-bit "proto-VSID". For kernel addresses this
337 * is equal to the ESID | 1 << 37, for user addresses it is:
338 * (context << USER_ESID_BITS) | (esid & ((1U << USER_ESID_BITS) - 1)
284 * 339 *
285 * We first generate a 36-bit "proto-VSID". For kernel addresses this 340 * This splits the proto-VSID into the below range
286 * is equal to the ESID, for user addresses it is: 341 * 0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range
287 * (context << 15) | (esid & 0x7fff) 342 * 2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range
288 * 343 *
289 * The two forms are distinguishable because the top bit is 0 for user 344 * We also have CONTEXT_BITS + USER_ESID_BITS = VSID_BITS - 1
290 * addresses, whereas the top two bits are 1 for kernel addresses. 345 * That is, we assign half of the space to user processes and half
291 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for 346 * to the kernel.
292 * now.
293 * 347 *
294 * The proto-VSIDs are then scrambled into real VSIDs with the 348 * The proto-VSIDs are then scrambled into real VSIDs with the
295 * multiplicative hash: 349 * multiplicative hash:
296 * 350 *
297 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS 351 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
298 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
299 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
300 * 352 *
301 * This scramble is only well defined for proto-VSIDs below 353 * VSID_MULTIPLIER is prime, so in particular it is
302 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
303 * reserved. VSID_MULTIPLIER is prime, so in particular it is
304 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. 354 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
305 * Because the modulus is 2^n-1 we can compute it efficiently without 355 * Because the modulus is 2^n-1 we can compute it efficiently without
306 * a divide or extra multiply (see below). 356 * a divide or extra multiply (see below).
307 * 357 *
308 * This scheme has several advantages over older methods: 358 * This scheme has several advantages over older methods:
309 * 359 *
310 * - We have VSIDs allocated for every kernel address 360 * - We have VSIDs allocated for every kernel address
311 * (i.e. everything above 0xC000000000000000), except the very top 361 * (i.e. everything above 0xC000000000000000), except the very top
312 * segment, which simplifies several things. 362 * segment, which simplifies several things.
313 * 363 *
314 * - We allow for 16 significant bits of ESID and 19 bits of 364 * - We allow for USER_ESID_BITS significant bits of ESID and
315 * context for user addresses. i.e. 16T (44 bits) of address space for 365 * CONTEXT_BITS bits of context for user addresses.
316 * up to half a million contexts. 366 * i.e. 64T (46 bits) of address space for up to half a million contexts.
317 * 367 *
318 * - The scramble function gives robust scattering in the hash 368 * - The scramble function gives robust scattering in the hash
319 * table (at least based on some initial results). The previous 369 * table (at least based on some initial results). The previous
320 * method was more susceptible to pathological cases giving excessive 370 * method was more susceptible to pathological cases giving excessive
321 * hash collisions. 371 * hash collisions.
322 */ 372 */
373
323/* 374/*
324 * WARNING - If you change these you must make sure the asm 375 * This should be computed such that protovosid * vsid_mulitplier
325 * implementations in slb_allocate (slb_low.S), do_stab_bolted 376 * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus
326 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
327 */ 377 */
328 378#define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */
329#define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */ 379#define VSID_BITS_256M 38
330#define VSID_BITS_256M 36
331#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1) 380#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1)
332 381
333#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */ 382#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */
334#define VSID_BITS_1T 24 383#define VSID_BITS_1T 26
335#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1) 384#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1)
336 385
337#define CONTEXT_BITS 19 386#define CONTEXT_BITS 19
338#define USER_ESID_BITS 16 387#define USER_ESID_BITS 18
339#define USER_ESID_BITS_1T 4 388#define USER_ESID_BITS_1T 6
340 389
341#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT)) 390#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
342 391
@@ -372,6 +421,8 @@ extern void slb_set_size(u16 size);
372 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \ 421 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \
373 add rt,rt,rx 422 add rt,rt,rx
374 423
424/* 4 bits per slice and we have one slice per 1TB */
425#define SLICE_ARRAY_SIZE (PGTABLE_RANGE >> 41)
375 426
376#ifndef __ASSEMBLY__ 427#ifndef __ASSEMBLY__
377 428
@@ -416,7 +467,7 @@ typedef struct {
416 467
417#ifdef CONFIG_PPC_MM_SLICES 468#ifdef CONFIG_PPC_MM_SLICES
418 u64 low_slices_psize; /* SLB page size encodings */ 469 u64 low_slices_psize; /* SLB page size encodings */
419 u64 high_slices_psize; /* 4 bits per slice for now */ 470 unsigned char high_slices_psize[SLICE_ARRAY_SIZE];
420#else 471#else
421 u16 sllp; /* SLB page size encoding */ 472 u16 sllp; /* SLB page size encoding */
422#endif 473#endif
@@ -452,12 +503,32 @@ typedef struct {
452 }) 503 })
453#endif /* 1 */ 504#endif /* 1 */
454 505
455/* This is only valid for addresses >= PAGE_OFFSET */ 506/*
507 * This is only valid for addresses >= PAGE_OFFSET
508 * The proto-VSID space is divided into two class
509 * User: 0 to 2^(CONTEXT_BITS + USER_ESID_BITS) -1
510 * kernel: 2^(CONTEXT_BITS + USER_ESID_BITS) to 2^(VSID_BITS) - 1
511 *
512 * With KERNEL_START at 0xc000000000000000, the proto vsid for
513 * the kernel ends up with 0xc00000000 (36 bits). With 64TB
514 * support we need to have kernel proto-VSID in the
515 * [2^37 to 2^38 - 1] range due to the increased USER_ESID_BITS.
516 */
456static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) 517static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
457{ 518{
458 if (ssize == MMU_SEGSIZE_256M) 519 unsigned long proto_vsid;
459 return vsid_scramble(ea >> SID_SHIFT, 256M); 520 /*
460 return vsid_scramble(ea >> SID_SHIFT_1T, 1T); 521 * We need to make sure proto_vsid for the kernel is
522 * >= 2^(CONTEXT_BITS + USER_ESID_BITS[_1T])
523 */
524 if (ssize == MMU_SEGSIZE_256M) {
525 proto_vsid = ea >> SID_SHIFT;
526 proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS));
527 return vsid_scramble(proto_vsid, 256M);
528 }
529 proto_vsid = ea >> SID_SHIFT_1T;
530 proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS_1T));
531 return vsid_scramble(proto_vsid, 1T);
461} 532}
462 533
463/* Returns the segment size indicator for a user address */ 534/* Returns the segment size indicator for a user address */
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index e8a26db2e8f3..5e38eedea218 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -146,6 +146,15 @@ extern void setup_initial_memory_limit(phys_addr_t first_memblock_base,
146extern u64 ppc64_rma_size; 146extern u64 ppc64_rma_size;
147#endif /* CONFIG_PPC64 */ 147#endif /* CONFIG_PPC64 */
148 148
149struct mm_struct;
150#ifdef CONFIG_DEBUG_VM
151extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr);
152#else /* CONFIG_DEBUG_VM */
153static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
154{
155}
156#endif /* !CONFIG_DEBUG_VM */
157
149#endif /* !__ASSEMBLY__ */ 158#endif /* !__ASSEMBLY__ */
150 159
151/* The kernel use the constants below to index in the page sizes array. 160/* The kernel use the constants below to index in the page sizes array.
diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index 1f41382eda38..0acc7c7c28d1 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -307,6 +307,7 @@ struct mpc52xx_lpbfifo_request {
307 size_t size; 307 size_t size;
308 size_t pos; /* current position of transfer */ 308 size_t pos; /* current position of transfer */
309 int flags; 309 int flags;
310 int defer_xfer_start;
310 311
311 /* What to do when finished */ 312 /* What to do when finished */
312 void (*callback)(struct mpc52xx_lpbfifo_request *); 313 void (*callback)(struct mpc52xx_lpbfifo_request *);
@@ -323,6 +324,7 @@ struct mpc52xx_lpbfifo_request {
323extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req); 324extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req);
324extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req); 325extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req);
325extern void mpc52xx_lpbfifo_poll(void); 326extern void mpc52xx_lpbfifo_poll(void);
327extern int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req);
326 328
327/* mpc52xx_pic.c */ 329/* mpc52xx_pic.c */
328extern void mpc52xx_init_irq(void); 330extern void mpc52xx_init_irq(void);
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index c9f698a994be..c0f9ef90f0b8 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -63,6 +63,7 @@
63 */ 63 */
64#define MPIC_TIMER_BASE 0x01100 64#define MPIC_TIMER_BASE 0x01100
65#define MPIC_TIMER_STRIDE 0x40 65#define MPIC_TIMER_STRIDE 0x40
66#define MPIC_TIMER_GROUP_STRIDE 0x1000
66 67
67#define MPIC_TIMER_CURRENT_CNT 0x00000 68#define MPIC_TIMER_CURRENT_CNT 0x00000
68#define MPIC_TIMER_BASE_CNT 0x00010 69#define MPIC_TIMER_BASE_CNT 0x00010
@@ -110,10 +111,16 @@
110#define MPIC_VECPRI_SENSE_MASK 0x00400000 111#define MPIC_VECPRI_SENSE_MASK 0x00400000
111#define MPIC_IRQ_DESTINATION 0x00010 112#define MPIC_IRQ_DESTINATION 0x00010
112 113
114#define MPIC_FSL_BRR1 0x00000
115#define MPIC_FSL_BRR1_VER 0x0000ffff
116
113#define MPIC_MAX_IRQ_SOURCES 2048 117#define MPIC_MAX_IRQ_SOURCES 2048
114#define MPIC_MAX_CPUS 32 118#define MPIC_MAX_CPUS 32
115#define MPIC_MAX_ISU 32 119#define MPIC_MAX_ISU 32
116 120
121#define MPIC_MAX_ERR 32
122#define MPIC_FSL_ERR_INT 16
123
117/* 124/*
118 * Tsi108 implementation of MPIC has many differences from the original one 125 * Tsi108 implementation of MPIC has many differences from the original one
119 */ 126 */
@@ -266,6 +273,7 @@ struct mpic
266 struct irq_chip hc_ipi; 273 struct irq_chip hc_ipi;
267#endif 274#endif
268 struct irq_chip hc_tm; 275 struct irq_chip hc_tm;
276 struct irq_chip hc_err;
269 const char *name; 277 const char *name;
270 /* Flags */ 278 /* Flags */
271 unsigned int flags; 279 unsigned int flags;
@@ -279,6 +287,8 @@ struct mpic
279 /* vector numbers used for internal sources (ipi/timers) */ 287 /* vector numbers used for internal sources (ipi/timers) */
280 unsigned int ipi_vecs[4]; 288 unsigned int ipi_vecs[4];
281 unsigned int timer_vecs[8]; 289 unsigned int timer_vecs[8];
290 /* vector numbers used for FSL MPIC error interrupts */
291 unsigned int err_int_vecs[MPIC_MAX_ERR];
282 292
283 /* Spurious vector to program into unused sources */ 293 /* Spurious vector to program into unused sources */
284 unsigned int spurious_vec; 294 unsigned int spurious_vec;
@@ -296,11 +306,15 @@ struct mpic
296 phys_addr_t paddr; 306 phys_addr_t paddr;
297 307
298 /* The various ioremap'ed bases */ 308 /* The various ioremap'ed bases */
309 struct mpic_reg_bank thiscpuregs;
299 struct mpic_reg_bank gregs; 310 struct mpic_reg_bank gregs;
300 struct mpic_reg_bank tmregs; 311 struct mpic_reg_bank tmregs;
301 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS]; 312 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS];
302 struct mpic_reg_bank isus[MPIC_MAX_ISU]; 313 struct mpic_reg_bank isus[MPIC_MAX_ISU];
303 314
315 /* ioremap'ed base for error interrupt registers */
316 u32 __iomem *err_regs;
317
304 /* Protected sources */ 318 /* Protected sources */
305 unsigned long *protected; 319 unsigned long *protected;
306 320
@@ -365,6 +379,11 @@ struct mpic
365#define MPIC_NO_RESET 0x00004000 379#define MPIC_NO_RESET 0x00004000
366/* Freescale MPIC (compatible includes "fsl,mpic") */ 380/* Freescale MPIC (compatible includes "fsl,mpic") */
367#define MPIC_FSL 0x00008000 381#define MPIC_FSL 0x00008000
382/* Freescale MPIC supports EIMR (error interrupt mask register).
383 * This flag is set for MPIC version >= 4.1 (version determined
384 * from the BRR1 register).
385*/
386#define MPIC_FSL_HAS_EIMR 0x00010000
368 387
369/* MPIC HW modification ID */ 388/* MPIC HW modification ID */
370#define MPIC_REGSET_MASK 0xf0000000 389#define MPIC_REGSET_MASK 0xf0000000
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index daf813fea91f..e9e7a6999bb8 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -100,7 +100,7 @@ struct paca_struct {
100 /* SLB related definitions */ 100 /* SLB related definitions */
101 u16 vmalloc_sllp; 101 u16 vmalloc_sllp;
102 u16 slb_cache_ptr; 102 u16 slb_cache_ptr;
103 u16 slb_cache[SLB_CACHE_ENTRIES]; 103 u32 slb_cache[SLB_CACHE_ENTRIES];
104#endif /* CONFIG_PPC_STD_MMU_64 */ 104#endif /* CONFIG_PPC_STD_MMU_64 */
105 105
106#ifdef CONFIG_PPC_BOOK3E 106#ifdef CONFIG_PPC_BOOK3E
@@ -136,6 +136,7 @@ struct paca_struct {
136 u8 io_sync; /* writel() needs spin_unlock sync */ 136 u8 io_sync; /* writel() needs spin_unlock sync */
137 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ 137 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */
138 u8 nap_state_lost; /* NV GPR values lost in power7_idle */ 138 u8 nap_state_lost; /* NV GPR values lost in power7_idle */
139 u64 sprg3; /* Saved user-visible sprg */
139 140
140#ifdef CONFIG_PPC_POWERNV 141#ifdef CONFIG_PPC_POWERNV
141 /* Pointer to OPAL machine check event structure set by the 142 /* Pointer to OPAL machine check event structure set by the
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
index fed85e6290e1..cd915d6b093d 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -78,11 +78,19 @@ extern u64 ppc64_pft_size;
78#define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT) 78#define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT)
79#define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT) 79#define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT)
80 80
81/*
82 * 1 bit per slice and we have one slice per 1TB
83 * Right now we support only 64TB.
84 * IF we change this we will have to change the type
85 * of high_slices
86 */
87#define SLICE_MASK_SIZE 8
88
81#ifndef __ASSEMBLY__ 89#ifndef __ASSEMBLY__
82 90
83struct slice_mask { 91struct slice_mask {
84 u16 low_slices; 92 u16 low_slices;
85 u16 high_slices; 93 u64 high_slices;
86}; 94};
87 95
88struct mm_struct; 96struct mm_struct;
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 8cccbee61519..025a130729bc 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -182,14 +182,25 @@ static inline int pci_device_from_OF_node(struct device_node *np,
182#if defined(CONFIG_EEH) 182#if defined(CONFIG_EEH)
183static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn) 183static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
184{ 184{
185 /*
186 * For those OF nodes whose parent isn't PCI bridge, they
187 * don't have PCI_DN actually. So we have to skip them for
188 * any EEH operations.
189 */
190 if (!dn || !PCI_DN(dn))
191 return NULL;
192
185 return PCI_DN(dn)->edev; 193 return PCI_DN(dn)->edev;
186} 194}
195#else
196#define of_node_to_eeh_dev(x) (NULL)
187#endif 197#endif
188 198
189/** Find the bus corresponding to the indicated device node */ 199/** Find the bus corresponding to the indicated device node */
190extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn); 200extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn);
191 201
192/** Remove all of the PCI devices under this bus */ 202/** Remove all of the PCI devices under this bus */
203extern void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe);
193extern void pcibios_remove_pci_devices(struct pci_bus *bus); 204extern void pcibios_remove_pci_devices(struct pci_bus *bus);
194 205
195/** Discover new pci devices under this bus, and add them */ 206/** Discover new pci devices under this bus, and add them */
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index 078019b5b353..9710be3a2d17 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -49,6 +49,7 @@ struct power_pmu {
49#define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */ 49#define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */
50#define PPMU_NO_SIPR 4 /* no SIPR/HV in MMCRA at all */ 50#define PPMU_NO_SIPR 4 /* no SIPR/HV in MMCRA at all */
51#define PPMU_NO_CONT_SAMPLING 8 /* no continuous sampling */ 51#define PPMU_NO_CONT_SAMPLING 8 /* no continuous sampling */
52#define PPMU_SIAR_VALID 16 /* Processor has SIAR Valid bit */
52 53
53/* 54/*
54 * Values for flags to get_alternatives() 55 * Values for flags to get_alternatives()
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-4k.h b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
index 6eefdcffa359..12798c9d4b4b 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-4k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
@@ -7,7 +7,7 @@
7 */ 7 */
8#define PTE_INDEX_SIZE 9 8#define PTE_INDEX_SIZE 9
9#define PMD_INDEX_SIZE 7 9#define PMD_INDEX_SIZE 7
10#define PUD_INDEX_SIZE 7 10#define PUD_INDEX_SIZE 9
11#define PGD_INDEX_SIZE 9 11#define PGD_INDEX_SIZE 9
12 12
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
@@ -19,7 +19,7 @@
19 19
20#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 20#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
21#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) 21#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
22#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) 22#define PTRS_PER_PUD (1 << PUD_INDEX_SIZE)
23#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) 23#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
24 24
25/* PMD_SHIFT determines what a second-level page table entry can map */ 25/* PMD_SHIFT determines what a second-level page table entry can map */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index 90533ddcd703..be4e2878fbc0 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -7,7 +7,7 @@
7#define PTE_INDEX_SIZE 12 7#define PTE_INDEX_SIZE 12
8#define PMD_INDEX_SIZE 12 8#define PMD_INDEX_SIZE 12
9#define PUD_INDEX_SIZE 0 9#define PUD_INDEX_SIZE 0
10#define PGD_INDEX_SIZE 4 10#define PGD_INDEX_SIZE 6
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE) 13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index c4205616dfb5..0182c203e411 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -21,17 +21,6 @@
21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) 21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)
22 22
23 23
24/* Some sanity checking */
25#if TASK_SIZE_USER64 > PGTABLE_RANGE
26#error TASK_SIZE_USER64 exceeds pagetable range
27#endif
28
29#ifdef CONFIG_PPC_STD_MMU_64
30#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT))
31#error TASK_SIZE_USER64 exceeds user VSID range
32#endif
33#endif
34
35/* 24/*
36 * Define the address range of the kernel non-linear virtual area 25 * Define the address range of the kernel non-linear virtual area
37 */ 26 */
@@ -41,7 +30,7 @@
41#else 30#else
42#define KERN_VIRT_START ASM_CONST(0xD000000000000000) 31#define KERN_VIRT_START ASM_CONST(0xD000000000000000)
43#endif 32#endif
44#define KERN_VIRT_SIZE PGTABLE_RANGE 33#define KERN_VIRT_SIZE ASM_CONST(0x0000100000000000)
45 34
46/* 35/*
47 * The vmalloc space starts at the beginning of that region, and 36 * The vmalloc space starts at the beginning of that region, and
@@ -117,9 +106,6 @@
117 106
118#ifndef __ASSEMBLY__ 107#ifndef __ASSEMBLY__
119 108
120#include <linux/stddef.h>
121#include <asm/tlbflush.h>
122
123/* 109/*
124 * This is the default implementation of various PTE accessors, it's 110 * This is the default implementation of various PTE accessors, it's
125 * used in all cases except Book3S with 64K pages where we have a 111 * used in all cases except Book3S with 64K pages where we have a
@@ -198,7 +184,8 @@
198/* to find an entry in a kernel page-table-directory */ 184/* to find an entry in a kernel page-table-directory */
199/* This now only contains the vmalloc pages */ 185/* This now only contains the vmalloc pages */
200#define pgd_offset_k(address) pgd_offset(&init_mm, address) 186#define pgd_offset_k(address) pgd_offset(&init_mm, address)
201 187extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
188 pte_t *ptep, unsigned long pte, int huge);
202 189
203/* Atomic PTE updates */ 190/* Atomic PTE updates */
204static inline unsigned long pte_update(struct mm_struct *mm, 191static inline unsigned long pte_update(struct mm_struct *mm,
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 2e0e4110f7ae..a9cbd3ba5c33 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -9,14 +9,6 @@
9 9
10struct mm_struct; 10struct mm_struct;
11 11
12#ifdef CONFIG_DEBUG_VM
13extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr);
14#else /* CONFIG_DEBUG_VM */
15static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
16{
17}
18#endif /* !CONFIG_DEBUG_VM */
19
20#endif /* !__ASSEMBLY__ */ 12#endif /* !__ASSEMBLY__ */
21 13
22#if defined(CONFIG_PPC64) 14#if defined(CONFIG_PPC64)
@@ -27,6 +19,8 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
27 19
28#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
29 21
22#include <asm/tlbflush.h>
23
30/* Generic accessors to PTE bits */ 24/* Generic accessors to PTE bits */
31static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 25static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
32static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 26static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 4c25319f2fbc..5f73ce63fcae 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -126,6 +126,7 @@
126#define PPC_INST_TLBIVAX 0x7c000624 126#define PPC_INST_TLBIVAX 0x7c000624
127#define PPC_INST_TLBSRX_DOT 0x7c0006a5 127#define PPC_INST_TLBSRX_DOT 0x7c0006a5
128#define PPC_INST_XXLOR 0xf0000510 128#define PPC_INST_XXLOR 0xf0000510
129#define PPC_INST_XVCPSGNDP 0xf0000780
129 130
130#define PPC_INST_NAP 0x4c000364 131#define PPC_INST_NAP 0x4c000364
131#define PPC_INST_SLEEP 0x4c0003a4 132#define PPC_INST_SLEEP 0x4c0003a4
@@ -277,6 +278,8 @@
277 VSX_XX1((s), a, b)) 278 VSX_XX1((s), a, b))
278#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \ 279#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
279 VSX_XX3((t), a, b)) 280 VSX_XX3((t), a, b))
281#define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_INST_XVCPSGNDP | \
282 VSX_XX3((t), (a), (b))))
280 283
281#define PPC_NAP stringify_in_c(.long PPC_INST_NAP) 284#define PPC_NAP stringify_in_c(.long PPC_INST_NAP)
282#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP) 285#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP)
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 80fa704d410f..ed57fa7920c8 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -47,19 +47,17 @@ extern int rtas_setup_phb(struct pci_controller *phb);
47 47
48#ifdef CONFIG_EEH 48#ifdef CONFIG_EEH
49 49
50void pci_addr_cache_build(void); 50void eeh_addr_cache_insert_dev(struct pci_dev *dev);
51void pci_addr_cache_insert_device(struct pci_dev *dev); 51void eeh_addr_cache_rmv_dev(struct pci_dev *dev);
52void pci_addr_cache_remove_device(struct pci_dev *dev); 52struct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr);
53struct pci_dev *pci_addr_cache_get_device(unsigned long addr); 53void eeh_slot_error_detail(struct eeh_pe *pe, int severity);
54void eeh_slot_error_detail(struct eeh_dev *edev, int severity); 54int eeh_pci_enable(struct eeh_pe *pe, int function);
55int eeh_pci_enable(struct eeh_dev *edev, int function); 55int eeh_reset_pe(struct eeh_pe *);
56int eeh_reset_pe(struct eeh_dev *); 56void eeh_save_bars(struct eeh_dev *edev);
57void eeh_restore_bars(struct eeh_dev *);
58int rtas_write_config(struct pci_dn *, int where, int size, u32 val); 57int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
59int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 58int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
60void eeh_mark_slot(struct device_node *dn, int mode_flag); 59void eeh_pe_state_mark(struct eeh_pe *pe, int state);
61void eeh_clear_slot(struct device_node *dn, int mode_flag); 60void eeh_pe_state_clear(struct eeh_pe *pe, int state);
62struct device_node *eeh_find_device_pe(struct device_node *dn);
63 61
64void eeh_sysfs_add_device(struct pci_dev *pdev); 62void eeh_sysfs_add_device(struct pci_dev *pdev);
65void eeh_sysfs_remove_device(struct pci_dev *pdev); 63void eeh_sysfs_remove_device(struct pci_dev *pdev);
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
new file mode 100644
index 000000000000..5f1e15b68704
--- /dev/null
+++ b/arch/powerpc/include/asm/probes.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_POWERPC_PROBES_H
2#define _ASM_POWERPC_PROBES_H
3#ifdef __KERNEL__
4/*
5 * Definitions common to probes files
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Copyright IBM Corporation, 2012
22 */
23#include <linux/types.h>
24
25typedef u32 ppc_opcode_t;
26#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
27
28/* Trap definitions per ISA */
29#define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)
30#define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088)
31#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
32#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
33
34#ifdef CONFIG_PPC64
35#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
36 IS_TWI(instr) || IS_TDI(instr))
37#else
38#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
39#endif /* CONFIG_PPC64 */
40
41#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_PROBES_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 54b73a28c205..9dc5cd1fde1a 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -97,8 +97,8 @@ extern struct task_struct *last_task_used_spe;
97#endif 97#endif
98 98
99#ifdef CONFIG_PPC64 99#ifdef CONFIG_PPC64
100/* 64-bit user address space is 44-bits (16TB user VM) */ 100/* 64-bit user address space is 46-bits (64TB user VM) */
101#define TASK_SIZE_USER64 (0x0000100000000000UL) 101#define TASK_SIZE_USER64 (0x0000400000000000UL)
102 102
103/* 103/*
104 * 32-bit user address space is 4GB - 1 page 104 * 32-bit user address space is 4GB - 1 page
@@ -219,6 +219,8 @@ struct thread_struct {
219#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 219#endif /* CONFIG_HAVE_HW_BREAKPOINT */
220#endif 220#endif
221 unsigned long dabr; /* Data address breakpoint register */ 221 unsigned long dabr; /* Data address breakpoint register */
222 unsigned long dabrx; /* ... extension */
223 unsigned long trap_nr; /* last trap # on this thread */
222#ifdef CONFIG_ALTIVEC 224#ifdef CONFIG_ALTIVEC
223 /* Complete AltiVec register set */ 225 /* Complete AltiVec register set */
224 vector128 vr[32] __attribute__((aligned(16))); 226 vector128 vr[32] __attribute__((aligned(16)));
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/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h
index 59247e816ac5..eedf427c9124 100644
--- a/arch/powerpc/include/asm/pte-hash64-64k.h
+++ b/arch/powerpc/include/asm/pte-hash64-64k.h
@@ -58,14 +58,16 @@
58/* Trick: we set __end to va + 64k, which happens works for 58/* Trick: we set __end to va + 64k, which happens works for
59 * a 16M page as well as we want only one iteration 59 * a 16M page as well as we want only one iteration
60 */ 60 */
61#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ 61#define pte_iterate_hashed_subpages(rpte, psize, vpn, index, shift) \
62 do { \ 62 do { \
63 unsigned long __end = va + PAGE_SIZE; \ 63 unsigned long __end = vpn + (1UL << (PAGE_SHIFT - VPN_SHIFT)); \
64 unsigned __split = (psize == MMU_PAGE_4K || \ 64 unsigned __split = (psize == MMU_PAGE_4K || \
65 psize == MMU_PAGE_64K_AP); \ 65 psize == MMU_PAGE_64K_AP); \
66 shift = mmu_psize_defs[psize].shift; \ 66 shift = mmu_psize_defs[psize].shift; \
67 for (index = 0; va < __end; index++, va += (1L << shift)) { \ 67 for (index = 0; vpn < __end; index++, \
68 if (!__split || __rpte_sub_valid(rpte, index)) do { \ 68 vpn += (1L << (shift - VPN_SHIFT))) { \
69 if (!__split || __rpte_sub_valid(rpte, index)) \
70 do {
69 71
70#define pte_iterate_hashed_end() } while(0); } } while(0) 72#define pte_iterate_hashed_end() } while(0); } } while(0)
71 73
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 638608677e2a..d24c14163966 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -208,6 +208,9 @@
208#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */ 208#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */
209#define DABRX_USER (1UL << 0) 209#define DABRX_USER (1UL << 0)
210#define DABRX_KERNEL (1UL << 1) 210#define DABRX_KERNEL (1UL << 1)
211#define DABRX_HYP (1UL << 2)
212#define DABRX_BTI (1UL << 3)
213#define DABRX_ALL (DABRX_BTI | DABRX_HYP | DABRX_KERNEL | DABRX_USER)
211#define SPRN_DAR 0x013 /* Data Address Register */ 214#define SPRN_DAR 0x013 /* Data Address Register */
212#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */ 215#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */
213#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ 216#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */
@@ -521,6 +524,7 @@
521 524
522#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */ 525#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
523#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */ 526#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
527#define HSRR1_DENORM 0x00100000 /* Denorm exception */
524 528
525#define SPRN_TBCTL 0x35f /* PA6T Timebase control register */ 529#define SPRN_TBCTL 0x35f /* PA6T Timebase control register */
526#define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */ 530#define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */
@@ -602,6 +606,10 @@
602#define POWER6_MMCRA_SIPR 0x0000020000000000ULL 606#define POWER6_MMCRA_SIPR 0x0000020000000000ULL
603#define POWER6_MMCRA_THRM 0x00000020UL 607#define POWER6_MMCRA_THRM 0x00000020UL
604#define POWER6_MMCRA_OTHER 0x0000000EUL 608#define POWER6_MMCRA_OTHER 0x0000000EUL
609
610#define POWER7P_MMCRA_SIAR_VALID 0x10000000 /* P7+ SIAR contents valid */
611#define POWER7P_MMCRA_SDAR_VALID 0x08000000 /* P7+ SDAR contents valid */
612
605#define SPRN_PMC1 787 613#define SPRN_PMC1 787
606#define SPRN_PMC2 788 614#define SPRN_PMC2 788
607#define SPRN_PMC3 789 615#define SPRN_PMC3 789
@@ -761,7 +769,8 @@
761 * 64-bit embedded 769 * 64-bit embedded
762 * - SPRG0 generic exception scratch 770 * - SPRG0 generic exception scratch
763 * - SPRG2 TLB exception stack 771 * - SPRG2 TLB exception stack
764 * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible) 772 * - SPRG3 critical exception scratch and
773 * CPU and NUMA node for VDSO getcpu (user visible)
765 * - SPRG4 unused (user visible) 774 * - SPRG4 unused (user visible)
766 * - SPRG6 TLB miss scratch (user visible, sorry !) 775 * - SPRG6 TLB miss scratch (user visible, sorry !)
767 * - SPRG7 critical exception scratch 776 * - SPRG7 critical exception scratch
@@ -858,11 +867,12 @@
858 867
859#ifdef CONFIG_PPC_BOOK3E_64 868#ifdef CONFIG_PPC_BOOK3E_64
860#define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8 869#define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8
861#define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG7 870#define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG3
862#define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9 871#define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9
863#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 872#define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2
864#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 873#define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6
865#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 874#define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0
875#define SPRN_SPRG_GDBELL_SCRATCH SPRN_SPRG_GEN_SCRATCH
866 876
867#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX 877#define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX
868#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA 878#define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA
@@ -937,7 +947,7 @@
937#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ 947#define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
938#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ 948#define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */
939 949
940#define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv)) 950#define pvr_version_is(pvr) (PVR_VER(mfspr(SPRN_PVR)) == (pvr))
941 951
942/* 952/*
943 * IBM has further subdivided the standard PowerPC 16-bit version and 953 * IBM has further subdivided the standard PowerPC 16-bit version and
@@ -1002,25 +1012,25 @@
1002#define PVR_476_ISS 0x00052000 1012#define PVR_476_ISS 0x00052000
1003 1013
1004/* 64-bit processors */ 1014/* 64-bit processors */
1005/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ 1015#define PVR_NORTHSTAR 0x0033
1006#define PV_NORTHSTAR 0x0033 1016#define PVR_PULSAR 0x0034
1007#define PV_PULSAR 0x0034 1017#define PVR_POWER4 0x0035
1008#define PV_POWER4 0x0035 1018#define PVR_ICESTAR 0x0036
1009#define PV_ICESTAR 0x0036 1019#define PVR_SSTAR 0x0037
1010#define PV_SSTAR 0x0037 1020#define PVR_POWER4p 0x0038
1011#define PV_POWER4p 0x0038 1021#define PVR_970 0x0039
1012#define PV_970 0x0039 1022#define PVR_POWER5 0x003A
1013#define PV_POWER5 0x003A 1023#define PVR_POWER5p 0x003B
1014#define PV_POWER5p 0x003B 1024#define PVR_970FX 0x003C
1015#define PV_970FX 0x003C 1025#define PVR_POWER6 0x003E
1016#define PV_POWER6 0x003E 1026#define PVR_POWER7 0x003F
1017#define PV_POWER7 0x003F 1027#define PVR_630 0x0040
1018#define PV_630 0x0040 1028#define PVR_630p 0x0041
1019#define PV_630p 0x0041 1029#define PVR_970MP 0x0044
1020#define PV_970MP 0x0044 1030#define PVR_970GX 0x0045
1021#define PV_970GX 0x0045 1031#define PVR_POWER7p 0x004A
1022#define PV_BE 0x0070 1032#define PVR_BE 0x0070
1023#define PV_PA6T 0x0090 1033#define PVR_PA6T 0x0090
1024 1034
1025/* Macros for setting and retrieving special purpose registers */ 1035/* Macros for setting and retrieving special purpose registers */
1026#ifndef __ASSEMBLY__ 1036#ifndef __ASSEMBLY__
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index d084ce195fc3..8b9a306260b2 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -9,7 +9,7 @@ extern void ppc_printk_progress(char *s, unsigned short hex);
9extern unsigned int rtas_data; 9extern unsigned int rtas_data;
10extern int mem_init_done; /* set on boot once kmalloc can be called */ 10extern int mem_init_done; /* set on boot once kmalloc can be called */
11extern int init_bootmem_done; /* set once bootmem is available */ 11extern int init_bootmem_done; /* set once bootmem is available */
12extern phys_addr_t memory_limit; 12extern unsigned long long memory_limit;
13extern unsigned long klimit; 13extern unsigned long klimit;
14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
15 15
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/smp.h b/arch/powerpc/include/asm/smp.h
index ebc24dc5b1a1..e807e9d8e3f7 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -65,6 +65,7 @@ int generic_cpu_disable(void);
65void generic_cpu_die(unsigned int cpu); 65void generic_cpu_die(unsigned int cpu);
66void generic_mach_cpu_die(void); 66void generic_mach_cpu_die(void);
67void generic_set_cpu_dead(unsigned int cpu); 67void generic_set_cpu_dead(unsigned int cpu);
68void generic_set_cpu_up(unsigned int cpu);
68int generic_check_cpu_restart(unsigned int cpu); 69int generic_check_cpu_restart(unsigned int cpu);
69#endif 70#endif
70 71
@@ -190,6 +191,7 @@ extern unsigned long __secondary_hold_spinloop;
190extern unsigned long __secondary_hold_acknowledge; 191extern unsigned long __secondary_hold_acknowledge;
191extern char __secondary_hold; 192extern char __secondary_hold;
192 193
194extern void __early_start(void);
193#endif /* __ASSEMBLY__ */ 195#endif /* __ASSEMBLY__ */
194 196
195#endif /* __KERNEL__ */ 197#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/asm/sparsemem.h
index 0c5fa3145615..f6fc0ee813d7 100644
--- a/arch/powerpc/include/asm/sparsemem.h
+++ b/arch/powerpc/include/asm/sparsemem.h
@@ -10,8 +10,8 @@
10 */ 10 */
11#define SECTION_SIZE_BITS 24 11#define SECTION_SIZE_BITS 24
12 12
13#define MAX_PHYSADDR_BITS 44 13#define MAX_PHYSADDR_BITS 46
14#define MAX_PHYSMEM_BITS 44 14#define MAX_PHYSMEM_BITS 46
15 15
16#endif /* CONFIG_SPARSEMEM */ 16#endif /* CONFIG_SPARSEMEM */
17 17
diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 8979d4cd3d70..de99d6e29430 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -22,4 +22,10 @@ int __init swiotlb_setup_bus_notifier(void);
22 22
23extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev); 23extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
24 24
25#ifdef CONFIG_SWIOTLB
26void swiotlb_detect_4g(void);
27#else
28static inline void swiotlb_detect_4g(void) {}
29#endif
30
25#endif /* __ASM_SWIOTLB_H */ 31#endif /* __ASM_SWIOTLB_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/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index faf93529cbf0..8ceea14d6fe4 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -102,7 +102,10 @@ static inline struct thread_info *current_thread_info(void)
102#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ 102#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
103#define TIF_NOERROR 12 /* Force successful syscall return */ 103#define TIF_NOERROR 12 /* Force successful syscall return */
104#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ 104#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
105#define TIF_UPROBE 14 /* breakpointed or single-stepping */
105#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ 106#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
107#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
108 for stack store? */
106 109
107/* as above, but as bit values */ 110/* as above, but as bit values */
108#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 111#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -118,12 +121,14 @@ static inline struct thread_info *current_thread_info(void)
118#define _TIF_RESTOREALL (1<<TIF_RESTOREALL) 121#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
119#define _TIF_NOERROR (1<<TIF_NOERROR) 122#define _TIF_NOERROR (1<<TIF_NOERROR)
120#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 123#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
124#define _TIF_UPROBE (1<<TIF_UPROBE)
121#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 125#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
126#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
122#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 127#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
123 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT) 128 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
124 129
125#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 130#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
126 _TIF_NOTIFY_RESUME) 131 _TIF_NOTIFY_RESUME | _TIF_UPROBE)
127#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) 132#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
128 133
129/* Bits in local_flags */ 134/* Bits in local_flags */
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/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
index 81143fcbd113..61a59271665b 100644
--- a/arch/powerpc/include/asm/tlbflush.h
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -95,7 +95,7 @@ struct ppc64_tlb_batch {
95 unsigned long index; 95 unsigned long index;
96 struct mm_struct *mm; 96 struct mm_struct *mm;
97 real_pte_t pte[PPC64_TLB_BATCH_NR]; 97 real_pte_t pte[PPC64_TLB_BATCH_NR];
98 unsigned long vaddr[PPC64_TLB_BATCH_NR]; 98 unsigned long vpn[PPC64_TLB_BATCH_NR];
99 unsigned int psize; 99 unsigned int psize;
100 int ssize; 100 int ssize;
101}; 101};
@@ -103,9 +103,6 @@ DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
103 103
104extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); 104extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
105 105
106extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
107 pte_t *ptep, unsigned long pte, int huge);
108
109#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 106#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
110 107
111static inline void arch_enter_lazy_mmu_mode(void) 108static inline void arch_enter_lazy_mmu_mode(void)
@@ -127,7 +124,7 @@ static inline void arch_leave_lazy_mmu_mode(void)
127#define arch_flush_lazy_mmu_mode() do {} while (0) 124#define arch_flush_lazy_mmu_mode() do {} while (0)
128 125
129 126
130extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, 127extern void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize,
131 int ssize, int local); 128 int ssize, int local);
132extern void flush_hash_range(unsigned long number, int local); 129extern void flush_hash_range(unsigned long number, int local);
133 130
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 17bb40cad5bf..4db49590acf5 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -98,11 +98,6 @@ struct exception_table_entry {
98 * PowerPC, we can just do these as direct assignments. (Of course, the 98 * PowerPC, we can just do these as direct assignments. (Of course, the
99 * exception handling means that it's no longer "just"...) 99 * exception handling means that it's no longer "just"...)
100 * 100 *
101 * The "user64" versions of the user access functions are versions that
102 * allow access of 64-bit data. The "get_user" functions do not
103 * properly handle 64-bit data because the value gets down cast to a long.
104 * The "put_user" functions already handle 64-bit data properly but we add
105 * "user64" versions for completeness
106 */ 101 */
107#define get_user(x, ptr) \ 102#define get_user(x, ptr) \
108 __get_user_check((x), (ptr), sizeof(*(ptr))) 103 __get_user_check((x), (ptr), sizeof(*(ptr)))
@@ -114,12 +109,6 @@ struct exception_table_entry {
114#define __put_user(x, ptr) \ 109#define __put_user(x, ptr) \
115 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) 110 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
116 111
117#ifndef __powerpc64__
118#define __get_user64(x, ptr) \
119 __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
120#define __put_user64(x, ptr) __put_user(x, ptr)
121#endif
122
123#define __get_user_inatomic(x, ptr) \ 112#define __get_user_inatomic(x, ptr) \
124 __get_user_nosleep((x), (ptr), sizeof(*(ptr))) 113 __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
125#define __put_user_inatomic(x, ptr) \ 114#define __put_user_inatomic(x, ptr) \
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/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h
new file mode 100644
index 000000000000..b532060d0916
--- /dev/null
+++ b/arch/powerpc/include/asm/uprobes.h
@@ -0,0 +1,54 @@
1#ifndef _ASM_UPROBES_H
2#define _ASM_UPROBES_H
3/*
4 * User-space Probes (UProbes) for powerpc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright IBM Corporation, 2007-2012
21 *
22 * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com>
23 */
24
25#include <linux/notifier.h>
26#include <asm/probes.h>
27
28typedef ppc_opcode_t uprobe_opcode_t;
29
30#define MAX_UINSN_BYTES 4
31#define UPROBE_XOL_SLOT_BYTES (MAX_UINSN_BYTES)
32
33/* The following alias is needed for reference from arch-agnostic code */
34#define UPROBE_SWBP_INSN BREAKPOINT_INSTRUCTION
35#define UPROBE_SWBP_INSN_SIZE 4 /* swbp insn size in bytes */
36
37struct arch_uprobe {
38 union {
39 u8 insn[MAX_UINSN_BYTES];
40 u32 ainsn;
41 };
42};
43
44struct arch_uprobe_task {
45 unsigned long saved_trap_nr;
46};
47
48extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
49extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
50extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
51extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
52extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
53extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
54#endif /* _ASM_UPROBES_H */
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