aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/asm-offsets.c7
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/dma-iommu.c4
-rw-r--r--arch/powerpc/kernel/head_64.S9
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S8
-rw-r--r--arch/powerpc/kernel/iommu.c12
-rw-r--r--arch/powerpc/kernel/lparcfg.c10
-rw-r--r--arch/powerpc/kernel/machine_kexec.c25
-rw-r--r--arch/powerpc/kernel/pci-common.c5
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/powerpc/kernel/prom.c5
-rw-r--r--arch/powerpc/kernel/setup_64.c6
-rw-r--r--arch/powerpc/kernel/vio.c7
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S4
14 files changed, 81 insertions, 37 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 9937fe44555f..19ee491e9e23 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -56,6 +56,10 @@
56#include "head_booke.h" 56#include "head_booke.h"
57#endif 57#endif
58 58
59#if defined(CONFIG_FSL_BOOKE)
60#include "../mm/mmu_decl.h"
61#endif
62
59int main(void) 63int main(void)
60{ 64{
61 DEFINE(THREAD, offsetof(struct task_struct, thread)); 65 DEFINE(THREAD, offsetof(struct task_struct, thread));
@@ -382,6 +386,9 @@ int main(void)
382 DEFINE(PGD_T_LOG2, PGD_T_LOG2); 386 DEFINE(PGD_T_LOG2, PGD_T_LOG2);
383 DEFINE(PTE_T_LOG2, PTE_T_LOG2); 387 DEFINE(PTE_T_LOG2, PTE_T_LOG2);
384#endif 388#endif
389#ifdef CONFIG_FSL_BOOKE
390 DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam));
391#endif
385 392
386#ifdef CONFIG_KVM_EXIT_TIMING 393#ifdef CONFIG_KVM_EXIT_TIMING
387 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu, 394 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu,
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index b33f0417a4bf..bb37b1d19a58 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -113,7 +113,7 @@ struct cache {
113 struct cache *next_local; /* next cache of >= level */ 113 struct cache *next_local; /* next cache of >= level */
114}; 114};
115 115
116static DEFINE_PER_CPU(struct cache_dir *, cache_dir); 116static DEFINE_PER_CPU(struct cache_dir *, cache_dir_pcpu);
117 117
118/* traversal/modification of this list occurs only at cpu hotplug time; 118/* traversal/modification of this list occurs only at cpu hotplug time;
119 * access is serialized by cpu hotplug locking 119 * access is serialized by cpu hotplug locking
@@ -468,9 +468,9 @@ static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_i
468 468
469 cache_dir->kobj = kobj; 469 cache_dir->kobj = kobj;
470 470
471 WARN_ON_ONCE(per_cpu(cache_dir, cpu_id) != NULL); 471 WARN_ON_ONCE(per_cpu(cache_dir_pcpu, cpu_id) != NULL);
472 472
473 per_cpu(cache_dir, cpu_id) = cache_dir; 473 per_cpu(cache_dir_pcpu, cpu_id) = cache_dir;
474 474
475 return cache_dir; 475 return cache_dir;
476err: 476err:
@@ -820,13 +820,13 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)
820 820
821 /* Prevent userspace from seeing inconsistent state - remove 821 /* Prevent userspace from seeing inconsistent state - remove
822 * the sysfs hierarchy first */ 822 * the sysfs hierarchy first */
823 cache_dir = per_cpu(cache_dir, cpu_id); 823 cache_dir = per_cpu(cache_dir_pcpu, cpu_id);
824 824
825 /* careful, sysfs population may have failed */ 825 /* careful, sysfs population may have failed */
826 if (cache_dir) 826 if (cache_dir)
827 remove_cache_dir(cache_dir); 827 remove_cache_dir(cache_dir);
828 828
829 per_cpu(cache_dir, cpu_id) = NULL; 829 per_cpu(cache_dir_pcpu, cpu_id) = NULL;
830 830
831 /* clear the CPU's bit in its cache chain, possibly freeing 831 /* clear the CPU's bit in its cache chain, possibly freeing
832 * cache objects */ 832 * cache objects */
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 14183af1b3fb..2983adac8cc3 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -79,10 +79,10 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
79 "Warning: IOMMU offset too big for device mask\n"); 79 "Warning: IOMMU offset too big for device mask\n");
80 if (tbl) 80 if (tbl)
81 printk(KERN_INFO 81 printk(KERN_INFO
82 "mask: 0x%08lx, table offset: 0x%08lx\n", 82 "mask: 0x%08llx, table offset: 0x%08lx\n",
83 mask, tbl->it_offset); 83 mask, tbl->it_offset);
84 else 84 else
85 printk(KERN_INFO "mask: 0x%08lx, table unavailable\n", 85 printk(KERN_INFO "mask: 0x%08llx, table unavailable\n",
86 mask); 86 mask);
87 return 0; 87 return 0;
88 } else 88 } else
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index b4bcf5a930fa..ebaedafc8e67 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1518,6 +1518,15 @@ _GLOBAL(pmac_secondary_start)
1518 /* turn on 64-bit mode */ 1518 /* turn on 64-bit mode */
1519 bl .enable_64b_mode 1519 bl .enable_64b_mode
1520 1520
1521 li r0,0
1522 mfspr r3,SPRN_HID4
1523 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
1524 sync
1525 mtspr SPRN_HID4,r3
1526 isync
1527 sync
1528 slbia
1529
1521 /* get TOC pointer (real address) */ 1530 /* get TOC pointer (real address) */
1522 bl .relative_toc 1531 bl .relative_toc
1523 1532
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 11b549acc034..36ffb3504a4f 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -389,10 +389,6 @@ skpinv: addi r6,r6,1 /* Increment */
389#endif 389#endif
390#endif 390#endif
391 391
392 mfspr r3,SPRN_TLB1CFG
393 andi. r3,r3,0xfff
394 lis r4,num_tlbcam_entries@ha
395 stw r3,num_tlbcam_entries@l(r4)
396/* 392/*
397 * Decide what sort of machine this is and initialize the MMU. 393 * Decide what sort of machine this is and initialize the MMU.
398 */ 394 */
@@ -711,7 +707,7 @@ interrupt_base:
711 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD) 707 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD)
712 708
713#ifdef CONFIG_PPC_E500MC 709#ifdef CONFIG_PPC_E500MC
714 EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_EE) 710 EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_STD)
715#endif 711#endif
716 712
717 /* Debug Interrupt */ 713 /* Debug Interrupt */
@@ -909,7 +905,7 @@ KernelSPE:
909_GLOBAL(loadcam_entry) 905_GLOBAL(loadcam_entry)
910 lis r4,TLBCAM@ha 906 lis r4,TLBCAM@ha
911 addi r4,r4,TLBCAM@l 907 addi r4,r4,TLBCAM@l
912 mulli r5,r3,20 908 mulli r5,r3,TLBCAM_SIZE
913 add r3,r5,r4 909 add r3,r5,r4
914 lwz r4,0(r3) 910 lwz r4,0(r3)
915 mtspr SPRN_MAS0,r4 911 mtspr SPRN_MAS0,r4
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 1bfa706b96e7..fd51578e29dd 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -239,12 +239,12 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
239 if (printk_ratelimit()) { 239 if (printk_ratelimit()) {
240 printk(KERN_INFO "iommu_free: invalid entry\n"); 240 printk(KERN_INFO "iommu_free: invalid entry\n");
241 printk(KERN_INFO "\tentry = 0x%lx\n", entry); 241 printk(KERN_INFO "\tentry = 0x%lx\n", entry);
242 printk(KERN_INFO "\tdma_addr = 0x%lx\n", (u64)dma_addr); 242 printk(KERN_INFO "\tdma_addr = 0x%llx\n", (u64)dma_addr);
243 printk(KERN_INFO "\tTable = 0x%lx\n", (u64)tbl); 243 printk(KERN_INFO "\tTable = 0x%llx\n", (u64)tbl);
244 printk(KERN_INFO "\tbus# = 0x%lx\n", (u64)tbl->it_busno); 244 printk(KERN_INFO "\tbus# = 0x%llx\n", (u64)tbl->it_busno);
245 printk(KERN_INFO "\tsize = 0x%lx\n", (u64)tbl->it_size); 245 printk(KERN_INFO "\tsize = 0x%llx\n", (u64)tbl->it_size);
246 printk(KERN_INFO "\tstartOff = 0x%lx\n", (u64)tbl->it_offset); 246 printk(KERN_INFO "\tstartOff = 0x%llx\n", (u64)tbl->it_offset);
247 printk(KERN_INFO "\tindex = 0x%lx\n", (u64)tbl->it_index); 247 printk(KERN_INFO "\tindex = 0x%llx\n", (u64)tbl->it_index);
248 WARN_ON(1); 248 WARN_ON(1);
249 } 249 }
250 return; 250 return;
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index d051e8cbcd03..182e0f642f36 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -240,7 +240,7 @@ static void parse_ppp_data(struct seq_file *m)
240 if (rc) 240 if (rc)
241 return; 241 return;
242 242
243 seq_printf(m, "partition_entitled_capacity=%ld\n", 243 seq_printf(m, "partition_entitled_capacity=%lld\n",
244 ppp_data.entitlement); 244 ppp_data.entitlement);
245 seq_printf(m, "group=%d\n", ppp_data.group_num); 245 seq_printf(m, "group=%d\n", ppp_data.group_num);
246 seq_printf(m, "system_active_processors=%d\n", 246 seq_printf(m, "system_active_processors=%d\n",
@@ -265,7 +265,7 @@ static void parse_ppp_data(struct seq_file *m)
265 ppp_data.unallocated_weight); 265 ppp_data.unallocated_weight);
266 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight); 266 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight);
267 seq_printf(m, "capped=%d\n", ppp_data.capped); 267 seq_printf(m, "capped=%d\n", ppp_data.capped);
268 seq_printf(m, "unallocated_capacity=%ld\n", 268 seq_printf(m, "unallocated_capacity=%lld\n",
269 ppp_data.unallocated_entitlement); 269 ppp_data.unallocated_entitlement);
270} 270}
271 271
@@ -509,10 +509,10 @@ static ssize_t update_ppp(u64 *entitlement, u8 *weight)
509 } else 509 } else
510 return -EINVAL; 510 return -EINVAL;
511 511
512 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 512 pr_debug("%s: current_entitled = %llu, current_weight = %u\n",
513 __func__, ppp_data.entitlement, ppp_data.weight); 513 __func__, ppp_data.entitlement, ppp_data.weight);
514 514
515 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 515 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
516 __func__, new_entitled, new_weight); 516 __func__, new_entitled, new_weight);
517 517
518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight); 518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
@@ -558,7 +558,7 @@ static ssize_t update_mpp(u64 *entitlement, u8 *weight)
558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight); 559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight);
560 560
561 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 561 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
562 __func__, new_entitled, new_weight); 562 __func__, new_entitled, new_weight);
563 563
564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight); 564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index b3abebb7ee64..d59e2b1bdcba 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -93,10 +93,35 @@ void __init reserve_crashkernel(void)
93 KDUMP_KERNELBASE); 93 KDUMP_KERNELBASE);
94 94
95 crashk_res.start = KDUMP_KERNELBASE; 95 crashk_res.start = KDUMP_KERNELBASE;
96#else
97 if (!crashk_res.start) {
98 /*
99 * unspecified address, choose a region of specified size
100 * can overlap with initrd (ignoring corruption when retained)
101 * ppc64 requires kernel and some stacks to be in first segemnt
102 */
103 crashk_res.start = KDUMP_KERNELBASE;
104 }
105
106 crash_base = PAGE_ALIGN(crashk_res.start);
107 if (crash_base != crashk_res.start) {
108 printk("Crash kernel base must be aligned to 0x%lx\n",
109 PAGE_SIZE);
110 crashk_res.start = crash_base;
111 }
112
96#endif 113#endif
97 crash_size = PAGE_ALIGN(crash_size); 114 crash_size = PAGE_ALIGN(crash_size);
98 crashk_res.end = crashk_res.start + crash_size - 1; 115 crashk_res.end = crashk_res.start + crash_size - 1;
99 116
117 /* The crash region must not overlap the current kernel */
118 if (overlaps_crashkernel(__pa(_stext), _end - _stext)) {
119 printk(KERN_WARNING
120 "Crash kernel can not overlap current kernel\n");
121 crashk_res.start = crashk_res.end = 0;
122 return;
123 }
124
100 /* Crash kernel trumps memory limit */ 125 /* Crash kernel trumps memory limit */
101 if (memory_limit && memory_limit <= crashk_res.end) { 126 if (memory_limit && memory_limit <= crashk_res.end) {
102 memory_limit = crashk_res.end + 1; 127 memory_limit = crashk_res.end + 1;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index da5a3855a0c4..19b12d2cbb4b 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -16,8 +16,6 @@
16 * 2 of the License, or (at your option) any later version. 16 * 2 of the License, or (at your option) any later version.
17 */ 17 */
18 18
19#define DEBUG
20
21#include <linux/kernel.h> 19#include <linux/kernel.h>
22#include <linux/pci.h> 20#include <linux/pci.h>
23#include <linux/string.h> 21#include <linux/string.h>
@@ -258,7 +256,8 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
258 } else { 256 } else {
259 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 257 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
260 oirq.size, oirq.specifier[0], oirq.specifier[1], 258 oirq.size, oirq.specifier[0], oirq.specifier[1],
261 oirq.controller->full_name); 259 oirq.controller ? oirq.controller->full_name :
260 "<default>");
262 261
263 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 262 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
264 oirq.size); 263 oirq.size);
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 586962f65c2a..ea8eda8c87cf 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -470,7 +470,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
470 if (bus->self) { 470 if (bus->self) {
471 pr_debug("IO mapping for PCI-PCI bridge %s\n", 471 pr_debug("IO mapping for PCI-PCI bridge %s\n",
472 pci_name(bus->self)); 472 pci_name(bus->self));
473 pr_debug(" virt=0x%016lx...0x%016lx\n", 473 pr_debug(" virt=0x%016llx...0x%016llx\n",
474 bus->resource[0]->start + _IO_BASE, 474 bus->resource[0]->start + _IO_BASE,
475 bus->resource[0]->end + _IO_BASE); 475 bus->resource[0]->end + _IO_BASE);
476 return 0; 476 return 0;
@@ -502,7 +502,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
502 hose->io_base_phys - phys_page); 502 hose->io_base_phys - phys_page);
503 503
504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name); 504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name);
505 pr_debug(" phys=0x%016lx, virt=0x%p (alloc=0x%p)\n", 505 pr_debug(" phys=0x%016llx, virt=0x%p (alloc=0x%p)\n",
506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc); 506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n", 507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n",
508 hose->pci_io_size, size_page); 508 hose->pci_io_size, size_page);
@@ -517,7 +517,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
517 hose->io_resource.start += io_virt_offset; 517 hose->io_resource.start += io_virt_offset;
518 hose->io_resource.end += io_virt_offset; 518 hose->io_resource.end += io_virt_offset;
519 519
520 pr_debug(" hose->io_resource=0x%016lx...0x%016lx\n", 520 pr_debug(" hose->io_resource=0x%016llx...0x%016llx\n",
521 hose->io_resource.start, hose->io_resource.end); 521 hose->io_resource.start, hose->io_resource.end);
522 522
523 return 0; 523 return 0;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c09cffafb6ee..f00f83109ab3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -590,6 +590,11 @@ static void __init check_cpu_slb_size(unsigned long node)
590{ 590{
591 u32 *slb_size_ptr; 591 u32 *slb_size_ptr;
592 592
593 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
594 if (slb_size_ptr != NULL) {
595 mmu_slb_size = *slb_size_ptr;
596 return;
597 }
593 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL); 598 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
594 if (slb_size_ptr != NULL) { 599 if (slb_size_ptr != NULL) {
595 mmu_slb_size = *slb_size_ptr; 600 mmu_slb_size = *slb_size_ptr;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d8bd2161e738..2d34196bba8c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -434,8 +434,8 @@ void __init setup_system(void)
434 printk("Starting Linux PPC64 %s\n", init_utsname()->version); 434 printk("Starting Linux PPC64 %s\n", init_utsname()->version);
435 435
436 printk("-----------------------------------------------------\n"); 436 printk("-----------------------------------------------------\n");
437 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 437 printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size);
438 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); 438 printk("physicalMemorySize = 0x%llx\n", lmb_phys_mem_size());
439 if (ppc64_caches.dline_size != 0x80) 439 if (ppc64_caches.dline_size != 0x80)
440 printk("ppc64_caches.dcache_line_size = 0x%x\n", 440 printk("ppc64_caches.dcache_line_size = 0x%x\n",
441 ppc64_caches.dline_size); 441 ppc64_caches.dline_size);
@@ -493,7 +493,7 @@ static void __init emergency_stack_init(void)
493 * bringup, we need to get at them in real mode. This means they 493 * bringup, we need to get at them in real mode. This means they
494 * must also be within the RMO region. 494 * must also be within the RMO region.
495 */ 495 */
496 limit = min(0x10000000UL, lmb.rmo_size); 496 limit = min(0x10000000ULL, lmb.rmo_size);
497 497
498 for_each_possible_cpu(i) { 498 for_each_possible_cpu(i) {
499 unsigned long sp; 499 unsigned long sp;
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 94aa7b011b27..d3694498f3af 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -492,14 +492,14 @@ static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size,
492 struct vio_dev *viodev = to_vio_dev(dev); 492 struct vio_dev *viodev = to_vio_dev(dev);
493 void *ret; 493 void *ret;
494 494
495 if (vio_cmo_alloc(viodev, roundup(size, IOMMU_PAGE_SIZE))) { 495 if (vio_cmo_alloc(viodev, roundup(size, PAGE_SIZE))) {
496 atomic_inc(&viodev->cmo.allocs_failed); 496 atomic_inc(&viodev->cmo.allocs_failed);
497 return NULL; 497 return NULL;
498 } 498 }
499 499
500 ret = dma_iommu_ops.alloc_coherent(dev, size, dma_handle, flag); 500 ret = dma_iommu_ops.alloc_coherent(dev, size, dma_handle, flag);
501 if (unlikely(ret == NULL)) { 501 if (unlikely(ret == NULL)) {
502 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE)); 502 vio_cmo_dealloc(viodev, roundup(size, PAGE_SIZE));
503 atomic_inc(&viodev->cmo.allocs_failed); 503 atomic_inc(&viodev->cmo.allocs_failed);
504 } 504 }
505 505
@@ -513,7 +513,7 @@ static void vio_dma_iommu_free_coherent(struct device *dev, size_t size,
513 513
514 dma_iommu_ops.free_coherent(dev, size, vaddr, dma_handle); 514 dma_iommu_ops.free_coherent(dev, size, vaddr, dma_handle);
515 515
516 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE)); 516 vio_cmo_dealloc(viodev, roundup(size, PAGE_SIZE));
517} 517}
518 518
519static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page, 519static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page,
@@ -572,6 +572,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
572 if (unlikely(!ret)) { 572 if (unlikely(!ret)) {
573 vio_cmo_dealloc(viodev, alloc_size); 573 vio_cmo_dealloc(viodev, alloc_size);
574 atomic_inc(&viodev->cmo.allocs_failed); 574 atomic_inc(&viodev->cmo.allocs_failed);
575 return ret;
575 } 576 }
576 577
577 for (sgl = sglist, count = 0; count < ret; count++, sgl++) 578 for (sgl = sglist, count = 0; count < ret; count++, sgl++)
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 47bf15cd2c9e..161b9b9691f0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -87,7 +87,9 @@ SECTIONS
87 /* The dummy segment contents for the bug workaround mentioned above 87 /* The dummy segment contents for the bug workaround mentioned above
88 near PHDRS. */ 88 near PHDRS. */
89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { 89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) {
90 LONG(0xf177) 90 LONG(0)
91 LONG(0)
92 LONG(0)
91 } :kernel :dummy 93 } :kernel :dummy
92 94
93/* 95/*