aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries')
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c21
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S4
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c11
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c10
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/ras.c4
-rw-r--r--arch/powerpc/platforms/pseries/setup.c65
10 files changed, 55 insertions, 70 deletions
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index 1062f71f5a85..39049e4884fb 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -75,7 +75,7 @@ static atomic_t dtl_count;
75 */ 75 */
76static void consume_dtle(struct dtl_entry *dtle, u64 index) 76static void consume_dtle(struct dtl_entry *dtle, u64 index)
77{ 77{
78 struct dtl_ring *dtlr = &__get_cpu_var(dtl_rings); 78 struct dtl_ring *dtlr = this_cpu_ptr(&dtl_rings);
79 struct dtl_entry *wp = dtlr->write_ptr; 79 struct dtl_entry *wp = dtlr->write_ptr;
80 struct lppaca *vpa = local_paca->lppaca_ptr; 80 struct lppaca *vpa = local_paca->lppaca_ptr;
81 81
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 1bbb78fab530..fa41f0da5b6f 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -12,7 +12,6 @@
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h> 13#include <linux/of_address.h>
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <linux/vmalloc.h>
16#include <linux/memory.h> 15#include <linux/memory.h>
17#include <linux/memory_hotplug.h> 16#include <linux/memory_hotplug.h>
18 17
@@ -66,22 +65,6 @@ unsigned long pseries_memory_block_size(void)
66} 65}
67 66
68#ifdef CONFIG_MEMORY_HOTREMOVE 67#ifdef CONFIG_MEMORY_HOTREMOVE
69static int pseries_remove_memory(u64 start, u64 size)
70{
71 int ret;
72
73 /* Remove htab bolted mappings for this section of memory */
74 start = (unsigned long)__va(start);
75 ret = remove_section_mapping(start, start + size);
76
77 /* Ensure all vmalloc mappings are flushed in case they also
78 * hit that section of memory
79 */
80 vm_unmap_aliases();
81
82 return ret;
83}
84
85static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) 68static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
86{ 69{
87 unsigned long block_sz, start_pfn; 70 unsigned long block_sz, start_pfn;
@@ -261,10 +244,6 @@ static int __init pseries_memory_hotplug_init(void)
261 if (firmware_has_feature(FW_FEATURE_LPAR)) 244 if (firmware_has_feature(FW_FEATURE_LPAR))
262 of_reconfig_notifier_register(&pseries_mem_nb); 245 of_reconfig_notifier_register(&pseries_mem_nb);
263 246
264#ifdef CONFIG_MEMORY_HOTREMOVE
265 ppc_md.remove_memory = pseries_remove_memory;
266#endif
267
268 return 0; 247 return 0;
269} 248}
270machine_device_initcall(pseries, pseries_memory_hotplug_init); 249machine_device_initcall(pseries, pseries_memory_hotplug_init);
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 3fda3f17b84e..ccd53f91e8aa 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -18,7 +18,7 @@
18 18
19#ifdef CONFIG_TRACEPOINTS 19#ifdef CONFIG_TRACEPOINTS
20 20
21#ifndef CONFIG_JUMP_LABEL 21#ifndef HAVE_JUMP_LABEL
22 .section ".toc","aw" 22 .section ".toc","aw"
23 23
24 .globl hcall_tracepoint_refcount 24 .globl hcall_tracepoint_refcount
@@ -78,7 +78,7 @@ hcall_tracepoint_refcount:
78 mr r5,BUFREG; \ 78 mr r5,BUFREG; \
79 __HCALL_INST_POSTCALL 79 __HCALL_INST_POSTCALL
80 80
81#ifdef CONFIG_JUMP_LABEL 81#ifdef HAVE_JUMP_LABEL
82#define HCALL_BRANCH(LABEL) \ 82#define HCALL_BRANCH(LABEL) \
83 ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key) 83 ARCH_STATIC_BRANCH(LABEL, hcall_tracepoint_key)
84#else 84#else
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index 4575f0c9e521..f02ec3ab428c 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -110,7 +110,7 @@ static void probe_hcall_entry(void *ignored, unsigned long opcode, unsigned long
110 if (opcode > MAX_HCALL_OPCODE) 110 if (opcode > MAX_HCALL_OPCODE)
111 return; 111 return;
112 112
113 h = &__get_cpu_var(hcall_stats)[opcode / 4]; 113 h = this_cpu_ptr(&hcall_stats[opcode / 4]);
114 h->tb_start = mftb(); 114 h->tb_start = mftb();
115 h->purr_start = mfspr(SPRN_PURR); 115 h->purr_start = mfspr(SPRN_PURR);
116} 116}
@@ -123,7 +123,7 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, unsigned long
123 if (opcode > MAX_HCALL_OPCODE) 123 if (opcode > MAX_HCALL_OPCODE)
124 return; 124 return;
125 125
126 h = &__get_cpu_var(hcall_stats)[opcode / 4]; 126 h = this_cpu_ptr(&hcall_stats[opcode / 4]);
127 h->num_calls++; 127 h->num_calls++;
128 h->tb_total += mftb() - h->tb_start; 128 h->tb_total += mftb() - h->tb_start;
129 h->purr_total += mfspr(SPRN_PURR) - h->purr_start; 129 h->purr_total += mfspr(SPRN_PURR) - h->purr_start;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 3e5bfdafee63..1d3d52dc3ff3 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -199,7 +199,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
199 199
200 local_irq_save(flags); /* to protect tcep and the page behind it */ 200 local_irq_save(flags); /* to protect tcep and the page behind it */
201 201
202 tcep = __get_cpu_var(tce_page); 202 tcep = __this_cpu_read(tce_page);
203 203
204 /* This is safe to do since interrupts are off when we're called 204 /* This is safe to do since interrupts are off when we're called
205 * from iommu_alloc{,_sg}() 205 * from iommu_alloc{,_sg}()
@@ -212,7 +212,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
212 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, 212 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
213 direction, attrs); 213 direction, attrs);
214 } 214 }
215 __get_cpu_var(tce_page) = tcep; 215 __this_cpu_write(tce_page, tcep);
216 } 216 }
217 217
218 rpn = __pa(uaddr) >> TCE_SHIFT; 218 rpn = __pa(uaddr) >> TCE_SHIFT;
@@ -398,7 +398,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
398 long l, limit; 398 long l, limit;
399 399
400 local_irq_disable(); /* to protect tcep and the page behind it */ 400 local_irq_disable(); /* to protect tcep and the page behind it */
401 tcep = __get_cpu_var(tce_page); 401 tcep = __this_cpu_read(tce_page);
402 402
403 if (!tcep) { 403 if (!tcep) {
404 tcep = (__be64 *)__get_free_page(GFP_ATOMIC); 404 tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
@@ -406,7 +406,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
406 local_irq_enable(); 406 local_irq_enable();
407 return -ENOMEM; 407 return -ENOMEM;
408 } 408 }
409 __get_cpu_var(tce_page) = tcep; 409 __this_cpu_write(tce_page, tcep);
410 } 410 }
411 411
412 proto_tce = TCE_PCI_READ | TCE_PCI_WRITE; 412 proto_tce = TCE_PCI_READ | TCE_PCI_WRITE;
@@ -574,8 +574,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
574 while (isa_dn && isa_dn != dn) 574 while (isa_dn && isa_dn != dn)
575 isa_dn = isa_dn->parent; 575 isa_dn = isa_dn->parent;
576 576
577 if (isa_dn_orig) 577 of_node_put(isa_dn_orig);
578 of_node_put(isa_dn_orig);
579 578
580 /* Count number of direct PCI children of the PHB. */ 579 /* Count number of direct PCI children of the PHB. */
581 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling) 580 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index f6880d2a40fb..469751d92004 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -284,7 +284,7 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot,
284 unsigned long newpp, 284 unsigned long newpp,
285 unsigned long vpn, 285 unsigned long vpn,
286 int psize, int apsize, 286 int psize, int apsize,
287 int ssize, int local) 287 int ssize, unsigned long inv_flags)
288{ 288{
289 unsigned long lpar_rc; 289 unsigned long lpar_rc;
290 unsigned long flags = (newpp & 7) | H_AVPN; 290 unsigned long flags = (newpp & 7) | H_AVPN;
@@ -442,7 +442,7 @@ static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
442static void pSeries_lpar_hugepage_invalidate(unsigned long vsid, 442static void pSeries_lpar_hugepage_invalidate(unsigned long vsid,
443 unsigned long addr, 443 unsigned long addr,
444 unsigned char *hpte_slot_array, 444 unsigned char *hpte_slot_array,
445 int psize, int ssize) 445 int psize, int ssize, int local)
446{ 446{
447 int i, index = 0; 447 int i, index = 0;
448 unsigned long s_addr = addr; 448 unsigned long s_addr = addr;
@@ -515,7 +515,7 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
515 unsigned long vpn; 515 unsigned long vpn;
516 unsigned long i, pix, rc; 516 unsigned long i, pix, rc;
517 unsigned long flags = 0; 517 unsigned long flags = 0;
518 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 518 struct ppc64_tlb_batch *batch = this_cpu_ptr(&ppc64_tlb_batch);
519 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); 519 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
520 unsigned long param[9]; 520 unsigned long param[9];
521 unsigned long hash, index, shift, hidx, slot; 521 unsigned long hash, index, shift, hidx, slot;
@@ -705,7 +705,7 @@ void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
705 705
706 local_irq_save(flags); 706 local_irq_save(flags);
707 707
708 depth = &__get_cpu_var(hcall_trace_depth); 708 depth = this_cpu_ptr(&hcall_trace_depth);
709 709
710 if (*depth) 710 if (*depth)
711 goto out; 711 goto out;
@@ -730,7 +730,7 @@ void __trace_hcall_exit(long opcode, unsigned long retval,
730 730
731 local_irq_save(flags); 731 local_irq_save(flags);
732 732
733 depth = &__get_cpu_var(hcall_trace_depth); 733 depth = this_cpu_ptr(&hcall_trace_depth);
734 734
735 if (*depth) 735 if (*depth)
736 goto out; 736 goto out;
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 11a3b617ef5d..054a0ed5c7ee 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -715,6 +715,8 @@ static int nvram_pstore_init(void)
715 nvram_pstore_info.buf = oops_data; 715 nvram_pstore_info.buf = oops_data;
716 nvram_pstore_info.bufsize = oops_data_sz; 716 nvram_pstore_info.bufsize = oops_data_sz;
717 717
718 spin_lock_init(&nvram_pstore_info.buf_lock);
719
718 rc = pstore_register(&nvram_pstore_info); 720 rc = pstore_register(&nvram_pstore_info);
719 if (rc != 0) 721 if (rc != 0)
720 pr_err("nvram: pstore_register() failed, defaults to " 722 pr_err("nvram: pstore_register() failed, defaults to "
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 67e48594040c..fe16a50700de 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -134,7 +134,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
134 of_node_put(pdn); 134 of_node_put(pdn);
135 135
136 if (rc) { 136 if (rc) {
137 pr_err("no ibm,pcie-link-speed-stats property\n"); 137 pr_debug("no ibm,pcie-link-speed-stats property\n");
138 return 0; 138 return 0;
139 } 139 }
140 140
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 5a4d0fc03b03..c3b2a7e81ddb 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -302,8 +302,8 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs)
302 /* If it isn't an extended log we can use the per cpu 64bit buffer */ 302 /* If it isn't an extended log we can use the per cpu 64bit buffer */
303 h = (struct rtas_error_log *)&savep[1]; 303 h = (struct rtas_error_log *)&savep[1];
304 if (!rtas_error_extended(h)) { 304 if (!rtas_error_extended(h)) {
305 memcpy(&__get_cpu_var(mce_data_buf), h, sizeof(__u64)); 305 memcpy(this_cpu_ptr(&mce_data_buf), h, sizeof(__u64));
306 errhdr = (struct rtas_error_log *)&__get_cpu_var(mce_data_buf); 306 errhdr = (struct rtas_error_log *)this_cpu_ptr(&mce_data_buf);
307 } else { 307 } else {
308 int len, error_log_length; 308 int len, error_log_length;
309 309
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ed8a90022a3d..e445b6701f50 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -500,7 +500,11 @@ static void __init pSeries_setup_arch(void)
500 500
501 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 501 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
502 long rc; 502 long rc;
503 if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) { 503
504 rc = pSeries_enable_reloc_on_exc();
505 if (rc == H_P2) {
506 pr_info("Relocation on exceptions not supported\n");
507 } else if (rc != H_SUCCESS) {
504 pr_warn("Unable to enable relocation on exceptions: " 508 pr_warn("Unable to enable relocation on exceptions: "
505 "%ld\n", rc); 509 "%ld\n", rc);
506 } 510 }
@@ -660,6 +664,34 @@ static void __init pSeries_init_early(void)
660 pr_debug(" <- pSeries_init_early()\n"); 664 pr_debug(" <- pSeries_init_early()\n");
661} 665}
662 666
667/**
668 * pseries_power_off - tell firmware about how to power off the system.
669 *
670 * This function calls either the power-off rtas token in normal cases
671 * or the ibm,power-off-ups token (if present & requested) in case of
672 * a power failure. If power-off token is used, power on will only be
673 * possible with power button press. If ibm,power-off-ups token is used
674 * it will allow auto poweron after power is restored.
675 */
676static void pseries_power_off(void)
677{
678 int rc;
679 int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
680
681 if (rtas_flash_term_hook)
682 rtas_flash_term_hook(SYS_POWER_OFF);
683
684 if (rtas_poweron_auto == 0 ||
685 rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) {
686 rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1);
687 printk(KERN_INFO "RTAS power-off returned %d\n", rc);
688 } else {
689 rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL);
690 printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc);
691 }
692 for (;;);
693}
694
663/* 695/*
664 * Called very early, MMU is off, device-tree isn't unflattened 696 * Called very early, MMU is off, device-tree isn't unflattened
665 */ 697 */
@@ -742,6 +774,8 @@ static int __init pSeries_probe(void)
742 else 774 else
743 hpte_init_native(); 775 hpte_init_native();
744 776
777 pm_power_off = pseries_power_off;
778
745 pr_debug("Machine is%s LPAR !\n", 779 pr_debug("Machine is%s LPAR !\n",
746 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not"); 780 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
747 781
@@ -755,34 +789,6 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
755 return PCI_PROBE_NORMAL; 789 return PCI_PROBE_NORMAL;
756} 790}
757 791
758/**
759 * pSeries_power_off - tell firmware about how to power off the system.
760 *
761 * This function calls either the power-off rtas token in normal cases
762 * or the ibm,power-off-ups token (if present & requested) in case of
763 * a power failure. If power-off token is used, power on will only be
764 * possible with power button press. If ibm,power-off-ups token is used
765 * it will allow auto poweron after power is restored.
766 */
767static void pSeries_power_off(void)
768{
769 int rc;
770 int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups");
771
772 if (rtas_flash_term_hook)
773 rtas_flash_term_hook(SYS_POWER_OFF);
774
775 if (rtas_poweron_auto == 0 ||
776 rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) {
777 rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1);
778 printk(KERN_INFO "RTAS power-off returned %d\n", rc);
779 } else {
780 rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL);
781 printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc);
782 }
783 for (;;);
784}
785
786#ifndef CONFIG_PCI 792#ifndef CONFIG_PCI
787void pSeries_final_fixup(void) { } 793void pSeries_final_fixup(void) { }
788#endif 794#endif
@@ -797,7 +803,6 @@ define_machine(pseries) {
797 .pcibios_fixup = pSeries_final_fixup, 803 .pcibios_fixup = pSeries_final_fixup,
798 .pci_probe_mode = pSeries_pci_probe_mode, 804 .pci_probe_mode = pSeries_pci_probe_mode,
799 .restart = rtas_restart, 805 .restart = rtas_restart,
800 .power_off = pSeries_power_off,
801 .halt = rtas_halt, 806 .halt = rtas_halt,
802 .panic = rtas_os_term, 807 .panic = rtas_os_term,
803 .get_boot_time = rtas_get_boot_time, 808 .get_boot_time = rtas_get_boot_time,