aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/bitops.h6
-rw-r--r--arch/powerpc/include/asm/cputable.h10
-rw-r--r--arch/powerpc/include/asm/eeh.h2
-rw-r--r--arch/powerpc/include/asm/elf.h3
-rw-r--r--arch/powerpc/include/asm/fsl_guts.h5
-rw-r--r--arch/powerpc/include/asm/hardirq.h7
-rw-r--r--arch/powerpc/include/asm/hugetlb.h8
-rw-r--r--arch/powerpc/include/asm/io.h3
-rw-r--r--arch/powerpc/include/asm/machdep.h19
-rw-r--r--arch/powerpc/include/asm/mmu-8xx.h2
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h22
-rw-r--r--arch/powerpc/include/asm/opal.h122
-rw-r--r--arch/powerpc/include/asm/paca.h7
-rw-r--r--arch/powerpc/include/asm/page.h4
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h20
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-4k.h16
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-64k.h3
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h52
-rw-r--r--arch/powerpc/include/asm/pgtable.h6
-rw-r--r--arch/powerpc/include/asm/processor.h2
-rw-r--r--arch/powerpc/include/asm/pte-8xx.h7
-rw-r--r--arch/powerpc/include/asm/setup.h3
-rw-r--r--arch/powerpc/include/asm/thread_info.h5
-rw-r--r--arch/powerpc/include/asm/tlbflush.h10
-rw-r--r--arch/powerpc/include/asm/vga.h4
-rw-r--r--arch/powerpc/include/asm/xics.h8
26 files changed, 161 insertions, 195 deletions
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index bd3bd573d0ae..59abc620f8e8 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -14,9 +14,9 @@
14 * 14 *
15 * The bitop functions are defined to work on unsigned longs, so for a 15 * The bitop functions are defined to work on unsigned longs, so for a
16 * ppc64 system the bits end up numbered: 16 * ppc64 system the bits end up numbered:
17 * |63..............0|127............64|191...........128|255...........196| 17 * |63..............0|127............64|191...........128|255...........192|
18 * and on ppc32: 18 * and on ppc32:
19 * |31.....0|63....31|95....64|127...96|159..128|191..160|223..192|255..224| 19 * |31.....0|63....32|95....64|127...96|159..128|191..160|223..192|255..224|
20 * 20 *
21 * There are a few little-endian macros used mostly for filesystem 21 * There are a few little-endian macros used mostly for filesystem
22 * bitmaps, these work on similar bit arrays layouts, but 22 * bitmaps, these work on similar bit arrays layouts, but
@@ -213,7 +213,7 @@ static __inline__ unsigned long ffz(unsigned long x)
213 return __ilog2(x & -x); 213 return __ilog2(x & -x);
214} 214}
215 215
216static __inline__ int __ffs(unsigned long x) 216static __inline__ unsigned long __ffs(unsigned long x)
217{ 217{
218 return __ilog2(x & -x); 218 return __ilog2(x & -x);
219} 219}
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index daa5af91163c..22d5a7da9e68 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -448,13 +448,9 @@ extern const char *powerpc_base_platform;
448 CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_DABRX) 448 CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_DABRX)
449#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2) 449#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2)
450 450
451#define CPU_FTRS_A2 (CPU_FTR_USE_TB | CPU_FTR_SMT | CPU_FTR_DBELL | \
452 CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | \
453 CPU_FTR_ICSWX | CPU_FTR_DABRX )
454
455#ifdef __powerpc64__ 451#ifdef __powerpc64__
456#ifdef CONFIG_PPC_BOOK3E 452#ifdef CONFIG_PPC_BOOK3E
457#define CPU_FTRS_POSSIBLE (CPU_FTRS_E6500 | CPU_FTRS_E5500 | CPU_FTRS_A2) 453#define CPU_FTRS_POSSIBLE (CPU_FTRS_E6500 | CPU_FTRS_E5500)
458#else 454#else
459#define CPU_FTRS_POSSIBLE \ 455#define CPU_FTRS_POSSIBLE \
460 (CPU_FTRS_POWER4 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \ 456 (CPU_FTRS_POWER4 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
@@ -505,13 +501,13 @@ enum {
505 501
506#ifdef __powerpc64__ 502#ifdef __powerpc64__
507#ifdef CONFIG_PPC_BOOK3E 503#ifdef CONFIG_PPC_BOOK3E
508#define CPU_FTRS_ALWAYS (CPU_FTRS_E6500 & CPU_FTRS_E5500 & CPU_FTRS_A2) 504#define CPU_FTRS_ALWAYS (CPU_FTRS_E6500 & CPU_FTRS_E5500)
509#else 505#else
510#define CPU_FTRS_ALWAYS \ 506#define CPU_FTRS_ALWAYS \
511 (CPU_FTRS_POWER4 & CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & \ 507 (CPU_FTRS_POWER4 & CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & \
512 CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \ 508 CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \
513 CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \ 509 CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \
514 CPU_FTRS_POWER8_DD1 & CPU_FTRS_POSSIBLE) 510 CPU_FTRS_POWER8_DD1 & ~CPU_FTR_HVMODE & CPU_FTRS_POSSIBLE)
515#endif 511#endif
516#else 512#else
517enum { 513enum {
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index ca07f9c27335..0652ebe117af 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -39,6 +39,7 @@ struct device_node;
39#define EEH_PROBE_MODE_DEV 0x04 /* From PCI device */ 39#define EEH_PROBE_MODE_DEV 0x04 /* From PCI device */
40#define EEH_PROBE_MODE_DEVTREE 0x08 /* From device tree */ 40#define EEH_PROBE_MODE_DEVTREE 0x08 /* From device tree */
41#define EEH_ENABLE_IO_FOR_LOG 0x10 /* Enable IO for log */ 41#define EEH_ENABLE_IO_FOR_LOG 0x10 /* Enable IO for log */
42#define EEH_EARLY_DUMP_LOG 0x20 /* Dump log immediately */
42 43
43/* 44/*
44 * Delay for PE reset, all in ms 45 * Delay for PE reset, all in ms
@@ -72,6 +73,7 @@ struct device_node;
72#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */ 73#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */
73#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */ 74#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */
74#define EEH_PE_CFG_BLOCKED (1 << 2) /* Block config access */ 75#define EEH_PE_CFG_BLOCKED (1 << 2) /* Block config access */
76#define EEH_PE_RESET (1 << 3) /* PE reset in progress */
75 77
76#define EEH_PE_KEEP (1 << 8) /* Keep PE on hotplug */ 78#define EEH_PE_KEEP (1 << 8) /* Keep PE on hotplug */
77#define EEH_PE_CFG_RESTRICTED (1 << 9) /* Block config on error */ 79#define EEH_PE_CFG_RESTRICTED (1 << 9) /* Block config on error */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 888d8f3f2524..57d289acb803 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -28,8 +28,7 @@
28 the loader. We need to make sure that it is out of the way of the program 28 the loader. We need to make sure that it is out of the way of the program
29 that it will "exec", and that there is sufficient room for the brk. */ 29 that it will "exec", and that there is sufficient room for the brk. */
30 30
31extern unsigned long randomize_et_dyn(unsigned long base); 31#define ELF_ET_DYN_BASE 0x20000000
32#define ELF_ET_DYN_BASE (randomize_et_dyn(0x20000000))
33 32
34#define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0) 33#define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0)
35 34
diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h
index 77ced0b3d81d..43b6bb1a4a9c 100644
--- a/arch/powerpc/include/asm/fsl_guts.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -68,7 +68,10 @@ struct ccsr_guts {
68 u8 res0b4[0xc0 - 0xb4]; 68 u8 res0b4[0xc0 - 0xb4];
69 __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register 69 __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register
70 Called 'elbcvselcr' on 86xx SOCs */ 70 Called 'elbcvselcr' on 86xx SOCs */
71 u8 res0c4[0x224 - 0xc4]; 71 u8 res0c4[0x100 - 0xc4];
72 __be32 rcwsr[16]; /* 0x.0100 - Reset Control Word Status registers
73 There are 16 registers */
74 u8 res140[0x224 - 0x140];
72 __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ 75 __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */
73 __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ 76 __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */
74 u8 res22c[0x604 - 0x22c]; 77 u8 res22c[0x604 - 0x22c];
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 1bbb3013d6aa..8add8b861e8d 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -21,7 +21,12 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
21 21
22#define __ARCH_IRQ_STAT 22#define __ARCH_IRQ_STAT
23 23
24#define local_softirq_pending() __get_cpu_var(irq_stat).__softirq_pending 24#define local_softirq_pending() __this_cpu_read(irq_stat.__softirq_pending)
25
26#define __ARCH_SET_SOFTIRQ_PENDING
27
28#define set_softirq_pending(x) __this_cpu_write(irq_stat.__softirq_pending, (x))
29#define or_softirq_pending(x) __this_cpu_or(irq_stat.__softirq_pending, (x))
25 30
26static inline void ack_bad_irq(unsigned int irq) 31static inline void ack_bad_irq(unsigned int irq)
27{ 32{
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 766b77d527ac..1d53a65b4ec1 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -48,7 +48,7 @@ static inline unsigned int hugepd_shift(hugepd_t hpd)
48#endif /* CONFIG_PPC_BOOK3S_64 */ 48#endif /* CONFIG_PPC_BOOK3S_64 */
49 49
50 50
51static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, 51static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
52 unsigned pdshift) 52 unsigned pdshift)
53{ 53{
54 /* 54 /*
@@ -58,9 +58,9 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
58 */ 58 */
59 unsigned long idx = 0; 59 unsigned long idx = 0;
60 60
61 pte_t *dir = hugepd_page(*hpdp); 61 pte_t *dir = hugepd_page(hpd);
62#ifndef CONFIG_PPC_FSL_BOOK3E 62#ifndef CONFIG_PPC_FSL_BOOK3E
63 idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp); 63 idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(hpd);
64#endif 64#endif
65 65
66 return dir + idx; 66 return dir + idx;
@@ -193,7 +193,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma,
193} 193}
194 194
195#define hugepd_shift(x) 0 195#define hugepd_shift(x) 0
196static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, 196static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
197 unsigned pdshift) 197 unsigned pdshift)
198{ 198{
199 return 0; 199 return 0;
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 9eaf301ac952..a8d2ef30d473 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -855,9 +855,6 @@ static inline void * bus_to_virt(unsigned long address)
855 855
856#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) 856#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
857 857
858void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
859 size_t size, unsigned long flags);
860
861#endif /* __KERNEL__ */ 858#endif /* __KERNEL__ */
862 859
863#endif /* _ASM_POWERPC_IO_H */ 860#endif /* _ASM_POWERPC_IO_H */
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 307347f8ddbd..c8175a3fe560 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -42,7 +42,7 @@ struct machdep_calls {
42 unsigned long newpp, 42 unsigned long newpp,
43 unsigned long vpn, 43 unsigned long vpn,
44 int bpsize, int apsize, 44 int bpsize, int apsize,
45 int ssize, int local); 45 int ssize, unsigned long flags);
46 void (*hpte_updateboltedpp)(unsigned long newpp, 46 void (*hpte_updateboltedpp)(unsigned long newpp,
47 unsigned long ea, 47 unsigned long ea,
48 int psize, int ssize); 48 int psize, int ssize);
@@ -60,7 +60,7 @@ struct machdep_calls {
60 void (*hugepage_invalidate)(unsigned long vsid, 60 void (*hugepage_invalidate)(unsigned long vsid,
61 unsigned long addr, 61 unsigned long addr,
62 unsigned char *hpte_slot_array, 62 unsigned char *hpte_slot_array,
63 int psize, int ssize); 63 int psize, int ssize, int local);
64 /* special for kexec, to be called in real mode, linear mapping is 64 /* special for kexec, to be called in real mode, linear mapping is
65 * destroyed as well */ 65 * destroyed as well */
66 void (*hpte_clear_all)(void); 66 void (*hpte_clear_all)(void);
@@ -142,7 +142,6 @@ struct machdep_calls {
142#endif 142#endif
143 143
144 void (*restart)(char *cmd); 144 void (*restart)(char *cmd);
145 void (*power_off)(void);
146 void (*halt)(void); 145 void (*halt)(void);
147 void (*panic)(char *str); 146 void (*panic)(char *str);
148 void (*cpu_die)(void); 147 void (*cpu_die)(void);
@@ -292,10 +291,6 @@ struct machdep_calls {
292#ifdef CONFIG_ARCH_RANDOM 291#ifdef CONFIG_ARCH_RANDOM
293 int (*get_random_long)(unsigned long *v); 292 int (*get_random_long)(unsigned long *v);
294#endif 293#endif
295
296#ifdef CONFIG_MEMORY_HOTREMOVE
297 int (*remove_memory)(u64, u64);
298#endif
299}; 294};
300 295
301extern void e500_idle(void); 296extern void e500_idle(void);
@@ -343,16 +338,6 @@ extern sys_ctrler_t sys_ctrler;
343 338
344#endif /* CONFIG_PPC_PMAC */ 339#endif /* CONFIG_PPC_PMAC */
345 340
346
347/* Functions to produce codes on the leds.
348 * The SRC code should be unique for the message category and should
349 * be limited to the lower 24 bits (the upper 8 are set by these funcs),
350 * and (for boot & dump) should be sorted numerically in the order
351 * the events occur.
352 */
353/* Print a boot progress message. */
354void ppc64_boot_msg(unsigned int src, const char *msg);
355
356static inline void log_error(char *buf, unsigned int err_type, int fatal) 341static inline void log_error(char *buf, unsigned int err_type, int fatal)
357{ 342{
358 if (ppc_md.log_error) 343 if (ppc_md.log_error)
diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h
index 3d11d3ce79ec..986b9e1e1044 100644
--- a/arch/powerpc/include/asm/mmu-8xx.h
+++ b/arch/powerpc/include/asm/mmu-8xx.h
@@ -56,6 +56,7 @@
56 * additional information from the MI_EPN, and MI_TWC registers. 56 * additional information from the MI_EPN, and MI_TWC registers.
57 */ 57 */
58#define SPRN_MI_RPN 790 58#define SPRN_MI_RPN 790
59#define MI_SPS16K 0x00000008 /* Small page size (0 = 4k, 1 = 16k) */
59 60
60/* Define an RPN value for mapping kernel memory to large virtual 61/* Define an RPN value for mapping kernel memory to large virtual
61 * pages for boot initialization. This has real page number of 0, 62 * pages for boot initialization. This has real page number of 0,
@@ -129,6 +130,7 @@
129 * additional information from the MD_EPN, and MD_TWC registers. 130 * additional information from the MD_EPN, and MD_TWC registers.
130 */ 131 */
131#define SPRN_MD_RPN 798 132#define SPRN_MD_RPN 798
133#define MD_SPS16K 0x00000008 /* Small page size (0 = 4k, 1 = 16k) */
132 134
133/* This is a temporary storage register that could be used to save 135/* This is a temporary storage register that could be used to save
134 * a processor working register during a tablewalk. 136 * a processor working register during a tablewalk.
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index aeebc94b2bce..4f13c3ed7acf 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -316,27 +316,33 @@ static inline unsigned long hpt_hash(unsigned long vpn,
316 return hash & 0x7fffffffffUL; 316 return hash & 0x7fffffffffUL;
317} 317}
318 318
319#define HPTE_LOCAL_UPDATE 0x1
320#define HPTE_NOHPTE_UPDATE 0x2
321
319extern int __hash_page_4K(unsigned long ea, unsigned long access, 322extern int __hash_page_4K(unsigned long ea, unsigned long access,
320 unsigned long vsid, pte_t *ptep, unsigned long trap, 323 unsigned long vsid, pte_t *ptep, unsigned long trap,
321 unsigned int local, int ssize, int subpage_prot); 324 unsigned long flags, int ssize, int subpage_prot);
322extern int __hash_page_64K(unsigned long ea, unsigned long access, 325extern int __hash_page_64K(unsigned long ea, unsigned long access,
323 unsigned long vsid, pte_t *ptep, unsigned long trap, 326 unsigned long vsid, pte_t *ptep, unsigned long trap,
324 unsigned int local, int ssize); 327 unsigned long flags, int ssize);
325struct mm_struct; 328struct mm_struct;
326unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap); 329unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap);
327extern int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long access, unsigned long trap); 330extern int hash_page_mm(struct mm_struct *mm, unsigned long ea,
328extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); 331 unsigned long access, unsigned long trap,
332 unsigned long flags);
333extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap,
334 unsigned long dsisr);
329int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, 335int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
330 pte_t *ptep, unsigned long trap, int local, int ssize, 336 pte_t *ptep, unsigned long trap, unsigned long flags,
331 unsigned int shift, unsigned int mmu_psize); 337 int ssize, unsigned int shift, unsigned int mmu_psize);
332#ifdef CONFIG_TRANSPARENT_HUGEPAGE 338#ifdef CONFIG_TRANSPARENT_HUGEPAGE
333extern int __hash_page_thp(unsigned long ea, unsigned long access, 339extern int __hash_page_thp(unsigned long ea, unsigned long access,
334 unsigned long vsid, pmd_t *pmdp, unsigned long trap, 340 unsigned long vsid, pmd_t *pmdp, unsigned long trap,
335 int local, int ssize, unsigned int psize); 341 unsigned long flags, int ssize, unsigned int psize);
336#else 342#else
337static inline int __hash_page_thp(unsigned long ea, unsigned long access, 343static inline int __hash_page_thp(unsigned long ea, unsigned long access,
338 unsigned long vsid, pmd_t *pmdp, 344 unsigned long vsid, pmd_t *pmdp,
339 unsigned long trap, int local, 345 unsigned long trap, unsigned long flags,
340 int ssize, unsigned int psize) 346 int ssize, unsigned int psize)
341{ 347{
342 BUG(); 348 BUG();
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 9124b0ede1fc..5cd8d2fddba9 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -154,6 +154,10 @@ struct opal_sg_list {
154#define OPAL_HANDLE_HMI 98 154#define OPAL_HANDLE_HMI 98
155#define OPAL_REGISTER_DUMP_REGION 101 155#define OPAL_REGISTER_DUMP_REGION 101
156#define OPAL_UNREGISTER_DUMP_REGION 102 156#define OPAL_UNREGISTER_DUMP_REGION 102
157#define OPAL_WRITE_TPO 103
158#define OPAL_READ_TPO 104
159#define OPAL_IPMI_SEND 107
160#define OPAL_IPMI_RECV 108
157 161
158#ifndef __ASSEMBLY__ 162#ifndef __ASSEMBLY__
159 163
@@ -284,62 +288,6 @@ enum OpalMessageType {
284 OPAL_MSG_TYPE_MAX, 288 OPAL_MSG_TYPE_MAX,
285}; 289};
286 290
287/* Machine check related definitions */
288enum OpalMCE_Version {
289 OpalMCE_V1 = 1,
290};
291
292enum OpalMCE_Severity {
293 OpalMCE_SEV_NO_ERROR = 0,
294 OpalMCE_SEV_WARNING = 1,
295 OpalMCE_SEV_ERROR_SYNC = 2,
296 OpalMCE_SEV_FATAL = 3,
297};
298
299enum OpalMCE_Disposition {
300 OpalMCE_DISPOSITION_RECOVERED = 0,
301 OpalMCE_DISPOSITION_NOT_RECOVERED = 1,
302};
303
304enum OpalMCE_Initiator {
305 OpalMCE_INITIATOR_UNKNOWN = 0,
306 OpalMCE_INITIATOR_CPU = 1,
307};
308
309enum OpalMCE_ErrorType {
310 OpalMCE_ERROR_TYPE_UNKNOWN = 0,
311 OpalMCE_ERROR_TYPE_UE = 1,
312 OpalMCE_ERROR_TYPE_SLB = 2,
313 OpalMCE_ERROR_TYPE_ERAT = 3,
314 OpalMCE_ERROR_TYPE_TLB = 4,
315};
316
317enum OpalMCE_UeErrorType {
318 OpalMCE_UE_ERROR_INDETERMINATE = 0,
319 OpalMCE_UE_ERROR_IFETCH = 1,
320 OpalMCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
321 OpalMCE_UE_ERROR_LOAD_STORE = 3,
322 OpalMCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
323};
324
325enum OpalMCE_SlbErrorType {
326 OpalMCE_SLB_ERROR_INDETERMINATE = 0,
327 OpalMCE_SLB_ERROR_PARITY = 1,
328 OpalMCE_SLB_ERROR_MULTIHIT = 2,
329};
330
331enum OpalMCE_EratErrorType {
332 OpalMCE_ERAT_ERROR_INDETERMINATE = 0,
333 OpalMCE_ERAT_ERROR_PARITY = 1,
334 OpalMCE_ERAT_ERROR_MULTIHIT = 2,
335};
336
337enum OpalMCE_TlbErrorType {
338 OpalMCE_TLB_ERROR_INDETERMINATE = 0,
339 OpalMCE_TLB_ERROR_PARITY = 1,
340 OpalMCE_TLB_ERROR_MULTIHIT = 2,
341};
342
343enum OpalThreadStatus { 291enum OpalThreadStatus {
344 OPAL_THREAD_INACTIVE = 0x0, 292 OPAL_THREAD_INACTIVE = 0x0,
345 OPAL_THREAD_STARTED = 0x1, 293 OPAL_THREAD_STARTED = 0x1,
@@ -452,52 +400,15 @@ struct opal_msg {
452 __be64 params[8]; 400 __be64 params[8];
453}; 401};
454 402
455struct opal_machine_check_event { 403enum {
456 enum OpalMCE_Version version:8; /* 0x00 */ 404 OPAL_IPMI_MSG_FORMAT_VERSION_1 = 1,
457 uint8_t in_use; /* 0x01 */ 405};
458 enum OpalMCE_Severity severity:8; /* 0x02 */
459 enum OpalMCE_Initiator initiator:8; /* 0x03 */
460 enum OpalMCE_ErrorType error_type:8; /* 0x04 */
461 enum OpalMCE_Disposition disposition:8; /* 0x05 */
462 uint8_t reserved_1[2]; /* 0x06 */
463 uint64_t gpr3; /* 0x08 */
464 uint64_t srr0; /* 0x10 */
465 uint64_t srr1; /* 0x18 */
466 union { /* 0x20 */
467 struct {
468 enum OpalMCE_UeErrorType ue_error_type:8;
469 uint8_t effective_address_provided;
470 uint8_t physical_address_provided;
471 uint8_t reserved_1[5];
472 uint64_t effective_address;
473 uint64_t physical_address;
474 uint8_t reserved_2[8];
475 } ue_error;
476
477 struct {
478 enum OpalMCE_SlbErrorType slb_error_type:8;
479 uint8_t effective_address_provided;
480 uint8_t reserved_1[6];
481 uint64_t effective_address;
482 uint8_t reserved_2[16];
483 } slb_error;
484
485 struct {
486 enum OpalMCE_EratErrorType erat_error_type:8;
487 uint8_t effective_address_provided;
488 uint8_t reserved_1[6];
489 uint64_t effective_address;
490 uint8_t reserved_2[16];
491 } erat_error;
492 406
493 struct { 407struct opal_ipmi_msg {
494 enum OpalMCE_TlbErrorType tlb_error_type:8; 408 uint8_t version;
495 uint8_t effective_address_provided; 409 uint8_t netfn;
496 uint8_t reserved_1[6]; 410 uint8_t cmd;
497 uint64_t effective_address; 411 uint8_t data[];
498 uint8_t reserved_2[16];
499 } tlb_error;
500 } u;
501}; 412};
502 413
503/* FSP memory errors handling */ 414/* FSP memory errors handling */
@@ -819,6 +730,9 @@ int64_t opal_rtc_read(__be32 *year_month_day,
819 __be64 *hour_minute_second_millisecond); 730 __be64 *hour_minute_second_millisecond);
820int64_t opal_rtc_write(uint32_t year_month_day, 731int64_t opal_rtc_write(uint32_t year_month_day,
821 uint64_t hour_minute_second_millisecond); 732 uint64_t hour_minute_second_millisecond);
733int64_t opal_tpo_read(uint64_t token, __be32 *year_mon_day, __be32 *hour_min);
734int64_t opal_tpo_write(uint64_t token, uint32_t year_mon_day,
735 uint32_t hour_min);
822int64_t opal_cec_power_down(uint64_t request); 736int64_t opal_cec_power_down(uint64_t request);
823int64_t opal_cec_reboot(void); 737int64_t opal_cec_reboot(void);
824int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 738int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
@@ -963,6 +877,10 @@ int64_t opal_handle_hmi(void);
963int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end); 877int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end);
964int64_t opal_unregister_dump_region(uint32_t id); 878int64_t opal_unregister_dump_region(uint32_t id);
965int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number); 879int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number);
880int64_t opal_ipmi_send(uint64_t interface, struct opal_ipmi_msg *msg,
881 uint64_t msg_len);
882int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
883 uint64_t *msg_len);
966 884
967/* Internal functions */ 885/* Internal functions */
968extern int early_init_dt_scan_opal(unsigned long node, const char *uname, 886extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
@@ -992,8 +910,6 @@ extern int opal_async_wait_response(uint64_t token, struct opal_msg *msg);
992extern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data); 910extern int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data);
993 911
994struct rtc_time; 912struct rtc_time;
995extern int opal_set_rtc_time(struct rtc_time *tm);
996extern void opal_get_rtc_time(struct rtc_time *tm);
997extern unsigned long opal_get_boot_time(void); 913extern unsigned long opal_get_boot_time(void);
998extern void opal_nvram_init(void); 914extern void opal_nvram_init(void);
999extern void opal_flash_init(void); 915extern void opal_flash_init(void);
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index a5139ea6910b..24a386cbb928 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -42,7 +42,6 @@ extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */
42#define get_slb_shadow() (get_paca()->slb_shadow_ptr) 42#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
43 43
44struct task_struct; 44struct task_struct;
45struct opal_machine_check_event;
46 45
47/* 46/*
48 * Defines the layout of the paca. 47 * Defines the layout of the paca.
@@ -153,12 +152,6 @@ struct paca_struct {
153 u64 tm_scratch; /* TM scratch area for reclaim */ 152 u64 tm_scratch; /* TM scratch area for reclaim */
154#endif 153#endif
155 154
156#ifdef CONFIG_PPC_POWERNV
157 /* Pointer to OPAL machine check event structure set by the
158 * early exception handler for use by high level C handler
159 */
160 struct opal_machine_check_event *opal_mc_evt;
161#endif
162#ifdef CONFIG_PPC_BOOK3S_64 155#ifdef CONFIG_PPC_BOOK3S_64
163 /* Exclusive emergency stack pointer for machine check exception. */ 156 /* Exclusive emergency stack pointer for machine check exception. */
164 void *mc_emergency_sp; 157 void *mc_emergency_sp;
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 26fe1ae15212..69c059887a2c 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -379,12 +379,14 @@ static inline int hugepd_ok(hugepd_t hpd)
379} 379}
380#endif 380#endif
381 381
382#define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep)))) 382#define is_hugepd(hpd) (hugepd_ok(hpd))
383#define pgd_huge pgd_huge
383int pgd_huge(pgd_t pgd); 384int pgd_huge(pgd_t pgd);
384#else /* CONFIG_HUGETLB_PAGE */ 385#else /* CONFIG_HUGETLB_PAGE */
385#define is_hugepd(pdep) 0 386#define is_hugepd(pdep) 0
386#define pgd_huge(pgd) 0 387#define pgd_huge(pgd) 0
387#endif /* CONFIG_HUGETLB_PAGE */ 388#endif /* CONFIG_HUGETLB_PAGE */
389#define __hugepd(x) ((hugepd_t) { (x) })
388 390
389struct page; 391struct page;
390extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); 392extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index 945e47adf7db..234e07c47803 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -170,6 +170,25 @@ static inline unsigned long pte_update(pte_t *p,
170#ifdef PTE_ATOMIC_UPDATES 170#ifdef PTE_ATOMIC_UPDATES
171 unsigned long old, tmp; 171 unsigned long old, tmp;
172 172
173#ifdef CONFIG_PPC_8xx
174 unsigned long tmp2;
175
176 __asm__ __volatile__("\
1771: lwarx %0,0,%4\n\
178 andc %1,%0,%5\n\
179 or %1,%1,%6\n\
180 /* 0x200 == Extended encoding, bit 22 */ \
181 /* Bit 22 has to be 1 if neither _PAGE_USER nor _PAGE_RW are set */ \
182 rlwimi %1,%1,32-2,0x200\n /* get _PAGE_USER */ \
183 rlwinm %3,%1,32-1,0x200\n /* get _PAGE_RW */ \
184 or %1,%3,%1\n\
185 xori %1,%1,0x200\n"
186" stwcx. %1,0,%4\n\
187 bne- 1b"
188 : "=&r" (old), "=&r" (tmp), "=m" (*p), "=&r" (tmp2)
189 : "r" (p), "r" (clr), "r" (set), "m" (*p)
190 : "cc" );
191#else /* CONFIG_PPC_8xx */
173 __asm__ __volatile__("\ 192 __asm__ __volatile__("\
1741: lwarx %0,0,%3\n\ 1931: lwarx %0,0,%3\n\
175 andc %1,%0,%4\n\ 194 andc %1,%0,%4\n\
@@ -180,6 +199,7 @@ static inline unsigned long pte_update(pte_t *p,
180 : "=&r" (old), "=&r" (tmp), "=m" (*p) 199 : "=&r" (old), "=&r" (tmp), "=m" (*p)
181 : "r" (p), "r" (clr), "r" (set), "m" (*p) 200 : "r" (p), "r" (clr), "r" (set), "m" (*p)
182 : "cc" ); 201 : "cc" );
202#endif /* CONFIG_PPC_8xx */
183#else /* PTE_ATOMIC_UPDATES */ 203#else /* PTE_ATOMIC_UPDATES */
184 unsigned long old = pte_val(*p); 204 unsigned long old = pte_val(*p);
185 *p = __pte((old & ~clr) | set); 205 *p = __pte((old & ~clr) | set);
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-4k.h b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
index 7b935683f268..132ee1d482c2 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-4k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-4k.h
@@ -57,7 +57,21 @@
57#define pgd_present(pgd) (pgd_val(pgd) != 0) 57#define pgd_present(pgd) (pgd_val(pgd) != 0)
58#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) 58#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
59#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) 59#define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
60#define pgd_page(pgd) virt_to_page(pgd_page_vaddr(pgd)) 60
61#ifndef __ASSEMBLY__
62
63static inline pte_t pgd_pte(pgd_t pgd)
64{
65 return __pte(pgd_val(pgd));
66}
67
68static inline pgd_t pte_pgd(pte_t pte)
69{
70 return __pgd(pte_val(pte));
71}
72extern struct page *pgd_page(pgd_t pgd);
73
74#endif /* !__ASSEMBLY__ */
61 75
62#define pud_offset(pgdp, addr) \ 76#define pud_offset(pgdp, addr) \
63 (((pud_t *) pgd_page_vaddr(*(pgdp))) + \ 77 (((pud_t *) pgd_page_vaddr(*(pgdp))) + \
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index a56b82fb0609..1de35bbd02a6 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -38,4 +38,7 @@
38/* Bits to mask out from a PGD/PUD to get to the PMD page */ 38/* Bits to mask out from a PGD/PUD to get to the PMD page */
39#define PUD_MASKED_BITS 0x1ff 39#define PUD_MASKED_BITS 0x1ff
40 40
41#define pgd_pte(pgd) (pud_pte(((pud_t){ pgd })))
42#define pte_pgd(pte) ((pgd_t)pte_pud(pte))
43
41#endif /* _ASM_POWERPC_PGTABLE_PPC64_64K_H */ 44#endif /* _ASM_POWERPC_PGTABLE_PPC64_64K_H */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 9b4b1904efae..b9dcc936e2d1 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -152,7 +152,7 @@
152#define pmd_none(pmd) (!pmd_val(pmd)) 152#define pmd_none(pmd) (!pmd_val(pmd))
153#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \ 153#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \
154 || (pmd_val(pmd) & PMD_BAD_BITS)) 154 || (pmd_val(pmd) & PMD_BAD_BITS))
155#define pmd_present(pmd) (pmd_val(pmd) != 0) 155#define pmd_present(pmd) (!pmd_none(pmd))
156#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) 156#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
157#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) 157#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
158extern struct page *pmd_page(pmd_t pmd); 158extern struct page *pmd_page(pmd_t pmd);
@@ -164,9 +164,21 @@ extern struct page *pmd_page(pmd_t pmd);
164#define pud_present(pud) (pud_val(pud) != 0) 164#define pud_present(pud) (pud_val(pud) != 0)
165#define pud_clear(pudp) (pud_val(*(pudp)) = 0) 165#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
166#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS) 166#define pud_page_vaddr(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
167#define pud_page(pud) virt_to_page(pud_page_vaddr(pud))
168 167
168extern struct page *pud_page(pud_t pud);
169
170static inline pte_t pud_pte(pud_t pud)
171{
172 return __pte(pud_val(pud));
173}
174
175static inline pud_t pte_pud(pte_t pte)
176{
177 return __pud(pte_val(pte));
178}
179#define pud_write(pud) pte_write(pud_pte(pud))
169#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) 180#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})
181#define pgd_write(pgd) pte_write(pgd_pte(pgd))
170 182
171/* 183/*
172 * Find an entry in a page-table-directory. We combine the address region 184 * Find an entry in a page-table-directory. We combine the address region
@@ -422,7 +434,22 @@ extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
422 pmd_t *pmdp, pmd_t pmd); 434 pmd_t *pmdp, pmd_t pmd);
423extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, 435extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
424 pmd_t *pmd); 436 pmd_t *pmd);
425 437/*
438 *
439 * For core kernel code by design pmd_trans_huge is never run on any hugetlbfs
440 * page. The hugetlbfs page table walking and mangling paths are totally
441 * separated form the core VM paths and they're differentiated by
442 * VM_HUGETLB being set on vm_flags well before any pmd_trans_huge could run.
443 *
444 * pmd_trans_huge() is defined as false at build time if
445 * CONFIG_TRANSPARENT_HUGEPAGE=n to optimize away code blocks at build
446 * time in such case.
447 *
448 * For ppc64 we need to differntiate from explicit hugepages from THP, because
449 * for THP we also track the subpage details at the pmd level. We don't do
450 * that for explicit huge pages.
451 *
452 */
426static inline int pmd_trans_huge(pmd_t pmd) 453static inline int pmd_trans_huge(pmd_t pmd)
427{ 454{
428 /* 455 /*
@@ -431,16 +458,6 @@ static inline int pmd_trans_huge(pmd_t pmd)
431 return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE); 458 return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE);
432} 459}
433 460
434static inline int pmd_large(pmd_t pmd)
435{
436 /*
437 * leaf pte for huge page, bottom two bits != 00
438 */
439 if (pmd_trans_huge(pmd))
440 return pmd_val(pmd) & _PAGE_PRESENT;
441 return 0;
442}
443
444static inline int pmd_trans_splitting(pmd_t pmd) 461static inline int pmd_trans_splitting(pmd_t pmd)
445{ 462{
446 if (pmd_trans_huge(pmd)) 463 if (pmd_trans_huge(pmd))
@@ -451,6 +468,14 @@ static inline int pmd_trans_splitting(pmd_t pmd)
451extern int has_transparent_hugepage(void); 468extern int has_transparent_hugepage(void);
452#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 469#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
453 470
471static inline int pmd_large(pmd_t pmd)
472{
473 /*
474 * leaf pte for huge page, bottom two bits != 00
475 */
476 return ((pmd_val(pmd) & 0x3) != 0x0);
477}
478
454static inline pte_t pmd_pte(pmd_t pmd) 479static inline pte_t pmd_pte(pmd_t pmd)
455{ 480{
456 return __pte(pmd_val(pmd)); 481 return __pte(pmd_val(pmd));
@@ -576,6 +601,5 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
576 */ 601 */
577 return true; 602 return true;
578} 603}
579
580#endif /* __ASSEMBLY__ */ 604#endif /* __ASSEMBLY__ */
581#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ 605#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 316f9a5da173..a8805fee0df9 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -274,11 +274,9 @@ extern void paging_init(void);
274 */ 274 */
275extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); 275extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
276 276
277extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
278 unsigned long end, int write, struct page **pages, int *nr);
279
280extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, 277extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
281 unsigned long end, int write, struct page **pages, int *nr); 278 unsigned long end, int write,
279 struct page **pages, int *nr);
282#ifndef CONFIG_TRANSPARENT_HUGEPAGE 280#ifndef CONFIG_TRANSPARENT_HUGEPAGE
283#define pmd_large(pmd) 0 281#define pmd_large(pmd) 0
284#define has_transparent_hugepage() 0 282#define has_transparent_hugepage() 0
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index dda7ac4c80bd..29c3798cf800 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -451,7 +451,7 @@ extern unsigned long cpuidle_disable;
451enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF}; 451enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
452 452
453extern int powersave_nap; /* set if nap mode can be used in idle loop */ 453extern int powersave_nap; /* set if nap mode can be used in idle loop */
454extern void power7_nap(int check_irq); 454extern unsigned long power7_nap(int check_irq);
455extern void power7_sleep(void); 455extern void power7_sleep(void);
456extern void flush_instruction_cache(void); 456extern void flush_instruction_cache(void);
457extern void hard_reset_now(void); 457extern void hard_reset_now(void);
diff --git a/arch/powerpc/include/asm/pte-8xx.h b/arch/powerpc/include/asm/pte-8xx.h
index d44826e4ff97..daa4616e61c4 100644
--- a/arch/powerpc/include/asm/pte-8xx.h
+++ b/arch/powerpc/include/asm/pte-8xx.h
@@ -48,19 +48,22 @@
48 */ 48 */
49#define _PAGE_RW 0x0400 /* lsb PP bits, inverted in HW */ 49#define _PAGE_RW 0x0400 /* lsb PP bits, inverted in HW */
50#define _PAGE_USER 0x0800 /* msb PP bits */ 50#define _PAGE_USER 0x0800 /* msb PP bits */
51/* set when neither _PAGE_USER nor _PAGE_RW are set */
52#define _PAGE_KNLRO 0x0200
51 53
52#define _PMD_PRESENT 0x0001 54#define _PMD_PRESENT 0x0001
53#define _PMD_BAD 0x0ff0 55#define _PMD_BAD 0x0ff0
54#define _PMD_PAGE_MASK 0x000c 56#define _PMD_PAGE_MASK 0x000c
55#define _PMD_PAGE_8M 0x000c 57#define _PMD_PAGE_8M 0x000c
56 58
57#define _PTE_NONE_MASK _PAGE_ACCESSED 59#define _PTE_NONE_MASK _PAGE_KNLRO
58 60
59/* Until my rework is finished, 8xx still needs atomic PTE updates */ 61/* Until my rework is finished, 8xx still needs atomic PTE updates */
60#define PTE_ATOMIC_UPDATES 1 62#define PTE_ATOMIC_UPDATES 1
61 63
62/* We need to add _PAGE_SHARED to kernel pages */ 64/* We need to add _PAGE_SHARED to kernel pages */
63#define _PAGE_KERNEL_RO (_PAGE_SHARED) 65#define _PAGE_KERNEL_RO (_PAGE_SHARED | _PAGE_KNLRO)
66#define _PAGE_KERNEL_ROX (_PAGE_EXEC | _PAGE_KNLRO)
64#define _PAGE_KERNEL_RW (_PAGE_DIRTY | _PAGE_RW | _PAGE_HWWRITE) 67#define _PAGE_KERNEL_RW (_PAGE_DIRTY | _PAGE_RW | _PAGE_HWWRITE)
65 68
66#endif /* __KERNEL__ */ 69#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index 11ba86e17631..fbdf18cf954c 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -8,7 +8,6 @@ extern void ppc_printk_progress(char *s, unsigned short hex);
8 8
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 */
12extern unsigned long long memory_limit; 11extern unsigned long long memory_limit;
13extern unsigned long klimit; 12extern unsigned long klimit;
14extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 13extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
@@ -24,7 +23,7 @@ extern void reloc_got2(unsigned long);
24#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) 23#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
25 24
26void check_for_initrd(void); 25void check_for_initrd(void);
27void do_init_bootmem(void); 26void initmem_init(void);
28void setup_panic(void); 27void setup_panic(void);
29#define ARCH_PANIC_TIMEOUT 180 28#define ARCH_PANIC_TIMEOUT 180
30 29
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index b034ecdb7c74..ebc4f165690a 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -71,13 +71,12 @@ struct thread_info {
71#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 71#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
72 72
73/* how to get the thread information struct from C */ 73/* how to get the thread information struct from C */
74register unsigned long __current_r1 asm("r1");
74static inline struct thread_info *current_thread_info(void) 75static inline struct thread_info *current_thread_info(void)
75{ 76{
76 register unsigned long sp asm("r1");
77
78 /* gcc4, at least, is smart enough to turn this into a single 77 /* gcc4, at least, is smart enough to turn this into a single
79 * rlwinm for ppc32 and clrrdi for ppc64 */ 78 * rlwinm for ppc32 and clrrdi for ppc64 */
80 return (struct thread_info *)(sp & ~(THREAD_SIZE-1)); 79 return (struct thread_info *)(__current_r1 & ~(THREAD_SIZE-1));
81} 80}
82 81
83#endif /* __ASSEMBLY__ */ 82#endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
index 2def01ed0cb2..23d351ca0303 100644
--- a/arch/powerpc/include/asm/tlbflush.h
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -107,14 +107,14 @@ extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
107 107
108static inline void arch_enter_lazy_mmu_mode(void) 108static inline void arch_enter_lazy_mmu_mode(void)
109{ 109{
110 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 110 struct ppc64_tlb_batch *batch = this_cpu_ptr(&ppc64_tlb_batch);
111 111
112 batch->active = 1; 112 batch->active = 1;
113} 113}
114 114
115static inline void arch_leave_lazy_mmu_mode(void) 115static inline void arch_leave_lazy_mmu_mode(void)
116{ 116{
117 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 117 struct ppc64_tlb_batch *batch = this_cpu_ptr(&ppc64_tlb_batch);
118 118
119 if (batch->index) 119 if (batch->index)
120 __flush_tlb_pending(batch); 120 __flush_tlb_pending(batch);
@@ -125,9 +125,11 @@ static inline void arch_leave_lazy_mmu_mode(void)
125 125
126 126
127extern void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, 127extern void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize,
128 int ssize, int local); 128 int ssize, unsigned long flags);
129extern void flush_hash_range(unsigned long number, int local); 129extern void flush_hash_range(unsigned long number, int local);
130 130extern void flush_hash_hugepage(unsigned long vsid, unsigned long addr,
131 pmd_t *pmdp, unsigned int psize, int ssize,
132 unsigned long flags);
131 133
132static inline void local_flush_tlb_mm(struct mm_struct *mm) 134static inline void local_flush_tlb_mm(struct mm_struct *mm)
133{ 135{
diff --git a/arch/powerpc/include/asm/vga.h b/arch/powerpc/include/asm/vga.h
index a2eac409c1ec..e5f8dd366212 100644
--- a/arch/powerpc/include/asm/vga.h
+++ b/arch/powerpc/include/asm/vga.h
@@ -38,12 +38,10 @@ static inline u16 scr_readw(volatile const u16 *addr)
38 38
39#endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */ 39#endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */
40 40
41extern unsigned long vgacon_remap_base;
42
43#ifdef __powerpc64__ 41#ifdef __powerpc64__
44#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s)) 42#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
45#else 43#else
46#define VGA_MAP_MEM(x,s) (x + vgacon_remap_base) 44#define VGA_MAP_MEM(x,s) (x)
47#endif 45#endif
48 46
49#define vga_readb(x) (*(x)) 47#define vga_readb(x) (*(x))
diff --git a/arch/powerpc/include/asm/xics.h b/arch/powerpc/include/asm/xics.h
index 0d050ea37a04..6997f4a271df 100644
--- a/arch/powerpc/include/asm/xics.h
+++ b/arch/powerpc/include/asm/xics.h
@@ -98,7 +98,7 @@ DECLARE_PER_CPU(struct xics_cppr, xics_cppr);
98 98
99static inline void xics_push_cppr(unsigned int vec) 99static inline void xics_push_cppr(unsigned int vec)
100{ 100{
101 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr); 101 struct xics_cppr *os_cppr = this_cpu_ptr(&xics_cppr);
102 102
103 if (WARN_ON(os_cppr->index >= MAX_NUM_PRIORITIES - 1)) 103 if (WARN_ON(os_cppr->index >= MAX_NUM_PRIORITIES - 1))
104 return; 104 return;
@@ -111,7 +111,7 @@ static inline void xics_push_cppr(unsigned int vec)
111 111
112static inline unsigned char xics_pop_cppr(void) 112static inline unsigned char xics_pop_cppr(void)
113{ 113{
114 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr); 114 struct xics_cppr *os_cppr = this_cpu_ptr(&xics_cppr);
115 115
116 if (WARN_ON(os_cppr->index < 1)) 116 if (WARN_ON(os_cppr->index < 1))
117 return LOWEST_PRIORITY; 117 return LOWEST_PRIORITY;
@@ -121,7 +121,7 @@ static inline unsigned char xics_pop_cppr(void)
121 121
122static inline void xics_set_base_cppr(unsigned char cppr) 122static inline void xics_set_base_cppr(unsigned char cppr)
123{ 123{
124 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr); 124 struct xics_cppr *os_cppr = this_cpu_ptr(&xics_cppr);
125 125
126 /* we only really want to set the priority when there's 126 /* we only really want to set the priority when there's
127 * just one cppr value on the stack 127 * just one cppr value on the stack
@@ -133,7 +133,7 @@ static inline void xics_set_base_cppr(unsigned char cppr)
133 133
134static inline unsigned char xics_cppr_top(void) 134static inline unsigned char xics_cppr_top(void)
135{ 135{
136 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr); 136 struct xics_cppr *os_cppr = this_cpu_ptr(&xics_cppr);
137 137
138 return os_cppr->stack[os_cppr->index]; 138 return os_cppr->stack[os_cppr->index];
139} 139}