aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-09-25 08:51:50 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-25 08:51:50 -0400
commite5baa396af7560382d2cf3f0871d616b61fc284c (patch)
tree6afc166894b8c8b3b2cf6add72a726be14ae2443 /arch/ppc64
parentd6a4c847e43c851cc0ddf73087a730227223f989 (diff)
parentef6bd6eb90ad72ee8ee7ba8b271f27102e9a90c1 (diff)
Merge from Linus' tree.
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/Makefile2
-rw-r--r--arch/ppc64/kernel/of_device.c7
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c181
-rw-r--r--arch/ppc64/kernel/pci.c9
-rw-r--r--arch/ppc64/kernel/pmac_setup.c18
-rw-r--r--arch/ppc64/kernel/pmac_time.c4
-rw-r--r--arch/ppc64/kernel/prom_init.c3
-rw-r--r--arch/ppc64/kernel/ptrace.c1
-rw-r--r--arch/ppc64/mm/hash_native.c5
-rw-r--r--arch/ppc64/mm/hugetlbpage.c7
10 files changed, 132 insertions, 105 deletions
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index a8877881bb48..40675b3f924d 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -107,7 +107,7 @@ install: vmlinux
107 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 107 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
108 108
109defaultimage-$(CONFIG_PPC_PSERIES) := zImage 109defaultimage-$(CONFIG_PPC_PSERIES) := zImage
110defaultimage-$(CONFIG_PPC_PMAC) := vmlinux 110defaultimage-$(CONFIG_PPC_PMAC) := zImage.vmode
111defaultimage-$(CONFIG_PPC_MAPLE) := zImage 111defaultimage-$(CONFIG_PPC_MAPLE) := zImage
112defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux 112defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
113KBUILD_IMAGE := $(defaultimage-y) 113KBUILD_IMAGE := $(defaultimage-y)
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c
index da580812ddfe..9f200f0f2ad5 100644
--- a/arch/ppc64/kernel/of_device.c
+++ b/arch/ppc64/kernel/of_device.c
@@ -233,7 +233,9 @@ void of_device_unregister(struct of_device *ofdev)
233 device_unregister(&ofdev->dev); 233 device_unregister(&ofdev->dev);
234} 234}
235 235
236struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id) 236struct of_device* of_platform_device_create(struct device_node *np,
237 const char *bus_id,
238 struct device *parent)
237{ 239{
238 struct of_device *dev; 240 struct of_device *dev;
239 241
@@ -245,7 +247,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
245 dev->node = np; 247 dev->node = np;
246 dev->dma_mask = 0xffffffffUL; 248 dev->dma_mask = 0xffffffffUL;
247 dev->dev.dma_mask = &dev->dma_mask; 249 dev->dev.dma_mask = &dev->dma_mask;
248 dev->dev.parent = NULL; 250 dev->dev.parent = parent;
249 dev->dev.bus = &of_platform_bus_type; 251 dev->dev.bus = &of_platform_bus_type;
250 dev->dev.release = of_release_dev; 252 dev->dev.release = of_release_dev;
251 253
@@ -259,6 +261,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
259 return dev; 261 return dev;
260} 262}
261 263
264
262EXPORT_SYMBOL(of_match_device); 265EXPORT_SYMBOL(of_match_device);
263EXPORT_SYMBOL(of_platform_bus_type); 266EXPORT_SYMBOL(of_platform_bus_type);
264EXPORT_SYMBOL(of_register_driver); 267EXPORT_SYMBOL(of_register_driver);
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index 2b5e622732f4..5914f61a152e 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -281,8 +281,10 @@ static void iommu_table_setparms(struct pci_controller *phb,
281 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT; 281 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT;
282 282
283 /* Test if we are going over 2GB of DMA space */ 283 /* Test if we are going over 2GB of DMA space */
284 if (phb->dma_window_base_cur + phb->dma_window_size > (1L << 31)) 284 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) {
285 udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
285 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); 286 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
287 }
286 288
287 phb->dma_window_base_cur += phb->dma_window_size; 289 phb->dma_window_base_cur += phb->dma_window_size;
288 290
@@ -326,92 +328,85 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
326 328
327static void iommu_bus_setup_pSeries(struct pci_bus *bus) 329static void iommu_bus_setup_pSeries(struct pci_bus *bus)
328{ 330{
329 struct device_node *dn, *pdn; 331 struct device_node *dn;
330 struct pci_dn *pci;
331 struct iommu_table *tbl; 332 struct iommu_table *tbl;
333 struct device_node *isa_dn, *isa_dn_orig;
334 struct device_node *tmp;
335 struct pci_dn *pci;
336 int children;
332 337
333 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self); 338 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self);
334 339
335 /* For each (root) bus, we carve up the available DMA space in 256MB 340 dn = pci_bus_to_OF_node(bus);
336 * pieces. Since each piece is used by one (sub) bus/device, that would 341 pci = PCI_DN(dn);
337 * give a maximum of 7 devices per PHB. In most cases, this is plenty. 342
338 * 343 if (bus->self) {
339 * The exception is on Python PHBs (pre-POWER4). Here we don't have EADS 344 /* This is not a root bus, any setup will be done for the
340 * bridges below the PHB to allocate the sectioned tables to, so instead 345 * device-side of the bridge in iommu_dev_setup_pSeries().
341 * we allocate a 1GB table at the PHB level. 346 */
347 return;
348 }
349
350 /* Check if the ISA bus on the system is under
351 * this PHB.
342 */ 352 */
353 isa_dn = isa_dn_orig = of_find_node_by_type(NULL, "isa");
343 354
344 dn = pci_bus_to_OF_node(bus); 355 while (isa_dn && isa_dn != dn)
345 pci = dn->data; 356 isa_dn = isa_dn->parent;
346 357
347 if (!bus->self) { 358 if (isa_dn_orig)
348 /* Root bus */ 359 of_node_put(isa_dn_orig);
349 if (is_python(dn)) {
350 unsigned int *iohole;
351
352 DBG("Python root bus %s\n", bus->name);
353
354 iohole = (unsigned int *)get_property(dn, "io-hole", 0);
355
356 if (iohole) {
357 /* On first bus we need to leave room for the
358 * ISA address space. Just skip the first 256MB
359 * alltogether. This leaves 768MB for the window.
360 */
361 DBG("PHB has io-hole, reserving 256MB\n");
362 pci->phb->dma_window_size = 3 << 28;
363 pci->phb->dma_window_base_cur = 1 << 28;
364 } else {
365 /* 1GB window by default */
366 pci->phb->dma_window_size = 1 << 30;
367 pci->phb->dma_window_base_cur = 0;
368 }
369
370 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
371
372 iommu_table_setparms(pci->phb, dn, tbl);
373 pci->iommu_table = iommu_init_table(tbl);
374 } else {
375 /* Do a 128MB table at root. This is used for the IDE
376 * controller on some SMP-mode POWER4 machines. It
377 * doesn't hurt to allocate it on other machines
378 * -- it'll just be unused since new tables are
379 * allocated on the EADS level.
380 *
381 * Allocate at offset 128MB to avoid having to deal
382 * with ISA holes; 128MB table for IDE is plenty.
383 */
384 pci->phb->dma_window_size = 1 << 27;
385 pci->phb->dma_window_base_cur = 1 << 27;
386
387 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
388
389 iommu_table_setparms(pci->phb, dn, tbl);
390 pci->iommu_table = iommu_init_table(tbl);
391
392 /* All child buses have 256MB tables */
393 pci->phb->dma_window_size = 1 << 28;
394 }
395 } else {
396 pdn = pci_bus_to_OF_node(bus->parent);
397 360
398 if (!bus->parent->self && !is_python(pdn)) { 361 /* Count number of direct PCI children of the PHB.
399 struct iommu_table *tbl; 362 * All PCI device nodes have class-code property, so it's
400 /* First child and not python means this is the EADS 363 * an easy way to find them.
401 * level. Allocate new table for this slot with 256MB 364 */
402 * window. 365 for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
403 */ 366 if (get_property(tmp, "class-code", NULL))
367 children++;
404 368
405 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 369 DBG("Children: %d\n", children);
406 370
407 iommu_table_setparms(pci->phb, dn, tbl); 371 /* Calculate amount of DMA window per slot. Each window must be
372 * a power of two (due to pci_alloc_consistent requirements).
373 *
374 * Keep 256MB aside for PHBs with ISA.
375 */
408 376
409 pci->iommu_table = iommu_init_table(tbl); 377 if (!isa_dn) {
410 } else { 378 /* No ISA/IDE - just set window size and return */
411 /* Lower than first child or under python, use parent table */ 379 pci->phb->dma_window_size = 0x80000000ul; /* To be divided */
412 pci->iommu_table = PCI_DN(pdn)->iommu_table; 380
413 } 381 while (pci->phb->dma_window_size * children > 0x80000000ul)
382 pci->phb->dma_window_size >>= 1;
383 DBG("No ISA/IDE, window size is 0x%lx\n",
384 pci->phb->dma_window_size);
385 pci->phb->dma_window_base_cur = 0;
386
387 return;
414 } 388 }
389
390 /* If we have ISA, then we probably have an IDE
391 * controller too. Allocate a 128MB table but
392 * skip the first 128MB to avoid stepping on ISA
393 * space.
394 */
395 pci->phb->dma_window_size = 0x8000000ul;
396 pci->phb->dma_window_base_cur = 0x8000000ul;
397
398 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
399
400 iommu_table_setparms(pci->phb, dn, tbl);
401 pci->iommu_table = iommu_init_table(tbl);
402
403 /* Divide the rest (1.75GB) among the children */
404 pci->phb->dma_window_size = 0x80000000ul;
405 while (pci->phb->dma_window_size * children > 0x70000000ul)
406 pci->phb->dma_window_size >>= 1;
407
408 DBG("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);
409
415} 410}
416 411
417 412
@@ -462,21 +457,36 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
462static void iommu_dev_setup_pSeries(struct pci_dev *dev) 457static void iommu_dev_setup_pSeries(struct pci_dev *dev)
463{ 458{
464 struct device_node *dn, *mydn; 459 struct device_node *dn, *mydn;
460 struct iommu_table *tbl;
461
462 DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, pci_name(dev));
465 463
466 DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, dev->pretty_name);
467 /* Now copy the iommu_table ptr from the bus device down to the
468 * pci device_node. This means get_iommu_table() won't need to search
469 * up the device tree to find it.
470 */
471 mydn = dn = pci_device_to_OF_node(dev); 464 mydn = dn = pci_device_to_OF_node(dev);
472 465
466 /* If we're the direct child of a root bus, then we need to allocate
467 * an iommu table ourselves. The bus setup code should have setup
468 * the window sizes already.
469 */
470 if (!dev->bus->self) {
471 DBG(" --> first child, no bridge. Allocating iommu table.\n");
472 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
473 iommu_table_setparms(PCI_DN(dn)->phb, dn, tbl);
474 PCI_DN(mydn)->iommu_table = iommu_init_table(tbl);
475
476 return;
477 }
478
479 /* If this device is further down the bus tree, search upwards until
480 * an already allocated iommu table is found and use that.
481 */
482
473 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL) 483 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL)
474 dn = dn->parent; 484 dn = dn->parent;
475 485
476 if (dn && dn->data) { 486 if (dn && dn->data) {
477 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table; 487 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table;
478 } else { 488 } else {
479 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name); 489 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, pci_name(dev));
480 } 490 }
481} 491}
482 492
@@ -510,7 +520,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
510 int *dma_window = NULL; 520 int *dma_window = NULL;
511 struct pci_dn *pci; 521 struct pci_dn *pci;
512 522
513 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name); 523 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
514 524
515 /* dev setup for LPAR is a little tricky, since the device tree might 525 /* dev setup for LPAR is a little tricky, since the device tree might
516 * contain the dma-window properties per-device and not neccesarily 526 * contain the dma-window properties per-device and not neccesarily
@@ -532,9 +542,8 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
532 * slots on POWER4 machines. 542 * slots on POWER4 machines.
533 */ 543 */
534 if (dma_window == NULL || pdn->parent == NULL) { 544 if (dma_window == NULL || pdn->parent == NULL) {
535 /* Fall back to regular (non-LPAR) dev setup */ 545 DBG("No dma window for device, linking to parent\n");
536 DBG("No dma window for device, falling back to regular setup\n"); 546 PCI_DN(dn)->iommu_table = PCI_DN(pdn)->iommu_table;
537 iommu_dev_setup_pSeries(dev);
538 return; 547 return;
539 } else { 548 } else {
540 DBG("Found DMA window, allocating table\n"); 549 DBG("Found DMA window, allocating table\n");
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index 861138ad092c..ff4be1da69d5 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -246,11 +246,14 @@ static unsigned int pci_parse_of_flags(u32 addr0)
246 unsigned int flags = 0; 246 unsigned int flags = 0;
247 247
248 if (addr0 & 0x02000000) { 248 if (addr0 & 0x02000000) {
249 flags |= IORESOURCE_MEM; 249 flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
250 flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
251 flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
250 if (addr0 & 0x40000000) 252 if (addr0 & 0x40000000)
251 flags |= IORESOURCE_PREFETCH; 253 flags |= IORESOURCE_PREFETCH
254 | PCI_BASE_ADDRESS_MEM_PREFETCH;
252 } else if (addr0 & 0x01000000) 255 } else if (addr0 & 0x01000000)
253 flags |= IORESOURCE_IO; 256 flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO;
254 return flags; 257 return flags;
255} 258}
256 259
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 1f5118078f7d..bb0c3bfbb7e2 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -434,15 +434,23 @@ static int pmac_check_legacy_ioport(unsigned int baseport)
434 434
435static int __init pmac_declare_of_platform_devices(void) 435static int __init pmac_declare_of_platform_devices(void)
436{ 436{
437 struct device_node *np; 437 struct device_node *np, *npp;
438 438
439 np = find_devices("u3"); 439 npp = of_find_node_by_name(NULL, "u3");
440 if (np) { 440 if (npp) {
441 for (np = np->child; np != NULL; np = np->sibling) 441 for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) {
442 if (strncmp(np->name, "i2c", 3) == 0) { 442 if (strncmp(np->name, "i2c", 3) == 0) {
443 of_platform_device_create(np, "u3-i2c"); 443 of_platform_device_create(np, "u3-i2c", NULL);
444 of_node_put(np);
444 break; 445 break;
445 } 446 }
447 }
448 of_node_put(npp);
449 }
450 npp = of_find_node_by_type(NULL, "smu");
451 if (npp) {
452 of_platform_device_create(npp, "smu", NULL);
453 of_node_put(npp);
446 } 454 }
447 455
448 return 0; 456 return 0;
diff --git a/arch/ppc64/kernel/pmac_time.c b/arch/ppc64/kernel/pmac_time.c
index 6c8c99295e7a..9d8c97decd32 100644
--- a/arch/ppc64/kernel/pmac_time.c
+++ b/arch/ppc64/kernel/pmac_time.c
@@ -84,7 +84,7 @@ void pmac_get_rtc_time(struct rtc_time *tm)
84 84
85#ifdef CONFIG_PMAC_SMU 85#ifdef CONFIG_PMAC_SMU
86 case SYS_CTRLER_SMU: 86 case SYS_CTRLER_SMU:
87 smu_get_rtc_time(tm); 87 smu_get_rtc_time(tm, 1);
88 break; 88 break;
89#endif /* CONFIG_PMAC_SMU */ 89#endif /* CONFIG_PMAC_SMU */
90 default: 90 default:
@@ -128,7 +128,7 @@ int pmac_set_rtc_time(struct rtc_time *tm)
128 128
129#ifdef CONFIG_PMAC_SMU 129#ifdef CONFIG_PMAC_SMU
130 case SYS_CTRLER_SMU: 130 case SYS_CTRLER_SMU:
131 return smu_set_rtc_time(tm); 131 return smu_set_rtc_time(tm, 1);
132#endif /* CONFIG_PMAC_SMU */ 132#endif /* CONFIG_PMAC_SMU */
133 default: 133 default:
134 return -ENODEV; 134 return -ENODEV;
diff --git a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
index 9979919cdf92..f252670874a4 100644
--- a/arch/ppc64/kernel/prom_init.c
+++ b/arch/ppc64/kernel/prom_init.c
@@ -1711,6 +1711,7 @@ static void __init flatten_device_tree(void)
1711 unsigned long offset = reloc_offset(); 1711 unsigned long offset = reloc_offset();
1712 unsigned long mem_start, mem_end, room; 1712 unsigned long mem_start, mem_end, room;
1713 struct boot_param_header *hdr; 1713 struct boot_param_header *hdr;
1714 struct prom_t *_prom = PTRRELOC(&prom);
1714 char *namep; 1715 char *namep;
1715 u64 *rsvmap; 1716 u64 *rsvmap;
1716 1717
@@ -1765,6 +1766,7 @@ static void __init flatten_device_tree(void)
1765 RELOC(dt_struct_end) = PAGE_ALIGN(mem_start); 1766 RELOC(dt_struct_end) = PAGE_ALIGN(mem_start);
1766 1767
1767 /* Finish header */ 1768 /* Finish header */
1769 hdr->boot_cpuid_phys = _prom->cpu;
1768 hdr->magic = OF_DT_HEADER; 1770 hdr->magic = OF_DT_HEADER;
1769 hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start); 1771 hdr->totalsize = RELOC(dt_struct_end) - RELOC(dt_header_start);
1770 hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start); 1772 hdr->off_dt_struct = RELOC(dt_struct_start) - RELOC(dt_header_start);
@@ -1854,7 +1856,6 @@ static void __init prom_find_boot_cpu(void)
1854 1856
1855 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); 1857 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu);
1856 1858
1857 prom_setprop(cpu_pkg, "linux,boot-cpu", NULL, 0);
1858 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); 1859 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval));
1859 _prom->cpu = getprop_rval; 1860 _prom->cpu = getprop_rval;
1860 1861
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
index 85ed3188a91d..b1c044ca5756 100644
--- a/arch/ppc64/kernel/ptrace.c
+++ b/arch/ppc64/kernel/ptrace.c
@@ -219,6 +219,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
219 219
220 case PTRACE_SET_DEBUGREG: 220 case PTRACE_SET_DEBUGREG:
221 ret = ptrace_set_debugreg(child, addr, data); 221 ret = ptrace_set_debugreg(child, addr, data);
222 break;
222 223
223 case PTRACE_DETACH: 224 case PTRACE_DETACH:
224 ret = ptrace_detach(child, data); 225 ret = ptrace_detach(child, data);
diff --git a/arch/ppc64/mm/hash_native.c b/arch/ppc64/mm/hash_native.c
index 29b074505d3e..874cf96938ff 100644
--- a/arch/ppc64/mm/hash_native.c
+++ b/arch/ppc64/mm/hash_native.c
@@ -342,15 +342,14 @@ static void native_flush_hash_range(unsigned long number, int local)
342 hpte_t *hptep; 342 hpte_t *hptep;
343 unsigned long hpte_v; 343 unsigned long hpte_v;
344 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 344 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
345 345 unsigned long large;
346 /* XXX fix for large ptes */
347 unsigned long large = 0;
348 346
349 local_irq_save(flags); 347 local_irq_save(flags);
350 348
351 j = 0; 349 j = 0;
352 for (i = 0; i < number; i++) { 350 for (i = 0; i < number; i++) {
353 va = batch->vaddr[j]; 351 va = batch->vaddr[j];
352 large = pte_huge(batch->pte[i]);
354 if (large) 353 if (large)
355 vpn = va >> HPAGE_SHIFT; 354 vpn = va >> HPAGE_SHIFT;
356 else 355 else
diff --git a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
index 338771ec70d7..0ea0994ed974 100644
--- a/arch/ppc64/mm/hugetlbpage.c
+++ b/arch/ppc64/mm/hugetlbpage.c
@@ -710,10 +710,13 @@ repeat:
710 hpte_group = ((~hash & htab_hash_mask) * 710 hpte_group = ((~hash & htab_hash_mask) *
711 HPTES_PER_GROUP) & ~0x7UL; 711 HPTES_PER_GROUP) & ~0x7UL;
712 slot = ppc_md.hpte_insert(hpte_group, va, prpn, 712 slot = ppc_md.hpte_insert(hpte_group, va, prpn,
713 HPTE_V_LARGE, rflags); 713 HPTE_V_LARGE |
714 HPTE_V_SECONDARY,
715 rflags);
714 if (slot == -1) { 716 if (slot == -1) {
715 if (mftb() & 0x1) 717 if (mftb() & 0x1)
716 hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; 718 hpte_group = ((hash & htab_hash_mask) *
719 HPTES_PER_GROUP)&~0x7UL;
717 720
718 ppc_md.hpte_remove(hpte_group); 721 ppc_md.hpte_remove(hpte_group);
719 goto repeat; 722 goto repeat;