diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-23 19:03:21 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-23 19:03:21 -0400 |
commit | 536f8098026bde1368bbfcbcb9682a7637b73df2 (patch) | |
tree | cf83d2e1afa503b6aeba103b55cd1da0af4e7a4c /arch/ppc64 | |
parent | e86ee6682b649183c11013a98be02f25e9ae399d (diff) | |
parent | 3fd07d3bf0077dcc0f5a33d2eb1938ea050da8da (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'arch/ppc64')
-rw-r--r-- | arch/ppc64/Kconfig | 4 | ||||
-rw-r--r-- | arch/ppc64/Makefile | 2 | ||||
-rw-r--r-- | arch/ppc64/kernel/head.S | 6 | ||||
-rw-r--r-- | arch/ppc64/kernel/pSeries_iommu.c | 169 | ||||
-rw-r--r-- | arch/ppc64/kernel/pci.c | 9 | ||||
-rw-r--r-- | arch/ppc64/kernel/prom_init.c | 3 | ||||
-rw-r--r-- | arch/ppc64/kernel/vdso.c | 15 | ||||
-rw-r--r-- | arch/ppc64/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/ppc64/lib/dec_and_lock.c | 47 | ||||
-rw-r--r-- | arch/ppc64/mm/fault.c | 1 |
10 files changed, 112 insertions, 146 deletions
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig index deca68ad644a..c658650af429 100644 --- a/arch/ppc64/Kconfig +++ b/arch/ppc64/Kconfig | |||
@@ -28,10 +28,6 @@ config GENERIC_ISA_DMA | |||
28 | bool | 28 | bool |
29 | default y | 29 | default y |
30 | 30 | ||
31 | config HAVE_DEC_LOCK | ||
32 | bool | ||
33 | default y | ||
34 | |||
35 | config EARLY_PRINTK | 31 | config EARLY_PRINTK |
36 | bool | 32 | bool |
37 | default y | 33 | default y |
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile index 17d2c1eac3b8..521c2a5a2862 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 | ||
109 | defaultimage-$(CONFIG_PPC_PSERIES) := zImage | 109 | defaultimage-$(CONFIG_PPC_PSERIES) := zImage |
110 | defaultimage-$(CONFIG_PPC_PMAC) := vmlinux | 110 | defaultimage-$(CONFIG_PPC_PMAC) := zImage.vmode |
111 | defaultimage-$(CONFIG_PPC_MAPLE) := zImage | 111 | defaultimage-$(CONFIG_PPC_MAPLE) := zImage |
112 | defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux | 112 | defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux |
113 | KBUILD_IMAGE := $(defaultimage-y) | 113 | KBUILD_IMAGE := $(defaultimage-y) |
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S index 58c314738c99..72c61041151a 100644 --- a/arch/ppc64/kernel/head.S +++ b/arch/ppc64/kernel/head.S | |||
@@ -1649,7 +1649,7 @@ _GLOBAL(__secondary_start) | |||
1649 | ld r3,0(r3) | 1649 | ld r3,0(r3) |
1650 | lwz r3,PLATFORM(r3) /* r3 = platform flags */ | 1650 | lwz r3,PLATFORM(r3) /* r3 = platform flags */ |
1651 | andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */ | 1651 | andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */ |
1652 | bne 98f | 1652 | beq 98f /* branch if result is 0 */ |
1653 | mfspr r3,PVR | 1653 | mfspr r3,PVR |
1654 | srwi r3,r3,16 | 1654 | srwi r3,r3,16 |
1655 | cmpwi r3,0x37 /* SStar */ | 1655 | cmpwi r3,0x37 /* SStar */ |
@@ -1813,7 +1813,7 @@ _STATIC(start_here_multiplatform) | |||
1813 | ld r3,0(r3) | 1813 | ld r3,0(r3) |
1814 | lwz r3,PLATFORM(r3) /* r3 = platform flags */ | 1814 | lwz r3,PLATFORM(r3) /* r3 = platform flags */ |
1815 | andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */ | 1815 | andi. r3,r3,PLATFORM_LPAR /* Test if bit 0 is set (LPAR bit) */ |
1816 | bne 98f | 1816 | beq 98f /* branch if result is 0 */ |
1817 | mfspr r3,PVR | 1817 | mfspr r3,PVR |
1818 | srwi r3,r3,16 | 1818 | srwi r3,r3,16 |
1819 | cmpwi r3,0x37 /* SStar */ | 1819 | cmpwi r3,0x37 /* SStar */ |
@@ -1834,7 +1834,7 @@ _STATIC(start_here_multiplatform) | |||
1834 | lwz r3,PLATFORM(r3) /* r3 = platform flags */ | 1834 | lwz r3,PLATFORM(r3) /* r3 = platform flags */ |
1835 | /* Test if bit 0 is set (LPAR bit) */ | 1835 | /* Test if bit 0 is set (LPAR bit) */ |
1836 | andi. r3,r3,PLATFORM_LPAR | 1836 | andi. r3,r3,PLATFORM_LPAR |
1837 | bne 98f | 1837 | bne 98f /* branch if result is !0 */ |
1838 | LOADADDR(r6,_SDR1) /* Only if NOT LPAR */ | 1838 | LOADADDR(r6,_SDR1) /* Only if NOT LPAR */ |
1839 | sub r6,r6,r26 | 1839 | sub r6,r6,r26 |
1840 | ld r6,0(r6) /* get the value of _SDR1 */ | 1840 | ld r6,0(r6) /* get the value of _SDR1 */ |
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c index f0fd7fbd6531..8c6313e7e145 100644 --- a/arch/ppc64/kernel/pSeries_iommu.c +++ b/arch/ppc64/kernel/pSeries_iommu.c | |||
@@ -265,8 +265,10 @@ static void iommu_table_setparms(struct pci_controller *phb, | |||
265 | tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT; | 265 | tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT; |
266 | 266 | ||
267 | /* Test if we are going over 2GB of DMA space */ | 267 | /* Test if we are going over 2GB of DMA space */ |
268 | if (phb->dma_window_base_cur + phb->dma_window_size > (1L << 31)) | 268 | if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) { |
269 | udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); | ||
269 | panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); | 270 | panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); |
271 | } | ||
270 | 272 | ||
271 | phb->dma_window_base_cur += phb->dma_window_size; | 273 | phb->dma_window_base_cur += phb->dma_window_size; |
272 | 274 | ||
@@ -310,92 +312,84 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb, | |||
310 | 312 | ||
311 | static void iommu_bus_setup_pSeries(struct pci_bus *bus) | 313 | static void iommu_bus_setup_pSeries(struct pci_bus *bus) |
312 | { | 314 | { |
313 | struct device_node *dn, *pdn; | 315 | struct device_node *dn; |
314 | struct pci_dn *pci; | ||
315 | struct iommu_table *tbl; | 316 | struct iommu_table *tbl; |
317 | struct device_node *isa_dn, *isa_dn_orig; | ||
318 | struct device_node *tmp; | ||
319 | struct pci_dn *pci; | ||
320 | int children; | ||
316 | 321 | ||
317 | DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self); | 322 | DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self); |
318 | 323 | ||
319 | /* For each (root) bus, we carve up the available DMA space in 256MB | 324 | dn = pci_bus_to_OF_node(bus); |
320 | * pieces. Since each piece is used by one (sub) bus/device, that would | 325 | pci = PCI_DN(dn); |
321 | * give a maximum of 7 devices per PHB. In most cases, this is plenty. | 326 | |
322 | * | 327 | if (bus->self) { |
323 | * The exception is on Python PHBs (pre-POWER4). Here we don't have EADS | 328 | /* This is not a root bus, any setup will be done for the |
324 | * bridges below the PHB to allocate the sectioned tables to, so instead | 329 | * device-side of the bridge in iommu_dev_setup_pSeries(). |
325 | * we allocate a 1GB table at the PHB level. | 330 | */ |
331 | return; | ||
332 | } | ||
333 | |||
334 | /* Check if the ISA bus on the system is under | ||
335 | * this PHB. | ||
326 | */ | 336 | */ |
337 | isa_dn = isa_dn_orig = of_find_node_by_type(NULL, "isa"); | ||
327 | 338 | ||
328 | dn = pci_bus_to_OF_node(bus); | 339 | while (isa_dn && isa_dn != dn) |
329 | pci = dn->data; | 340 | isa_dn = isa_dn->parent; |
330 | 341 | ||
331 | if (!bus->self) { | 342 | if (isa_dn_orig) |
332 | /* Root bus */ | 343 | of_node_put(isa_dn_orig); |
333 | if (is_python(dn)) { | ||
334 | unsigned int *iohole; | ||
335 | |||
336 | DBG("Python root bus %s\n", bus->name); | ||
337 | |||
338 | iohole = (unsigned int *)get_property(dn, "io-hole", 0); | ||
339 | |||
340 | if (iohole) { | ||
341 | /* On first bus we need to leave room for the | ||
342 | * ISA address space. Just skip the first 256MB | ||
343 | * alltogether. This leaves 768MB for the window. | ||
344 | */ | ||
345 | DBG("PHB has io-hole, reserving 256MB\n"); | ||
346 | pci->phb->dma_window_size = 3 << 28; | ||
347 | pci->phb->dma_window_base_cur = 1 << 28; | ||
348 | } else { | ||
349 | /* 1GB window by default */ | ||
350 | pci->phb->dma_window_size = 1 << 30; | ||
351 | pci->phb->dma_window_base_cur = 0; | ||
352 | } | ||
353 | |||
354 | tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); | ||
355 | |||
356 | iommu_table_setparms(pci->phb, dn, tbl); | ||
357 | pci->iommu_table = iommu_init_table(tbl); | ||
358 | } else { | ||
359 | /* Do a 128MB table at root. This is used for the IDE | ||
360 | * controller on some SMP-mode POWER4 machines. It | ||
361 | * doesn't hurt to allocate it on other machines | ||
362 | * -- it'll just be unused since new tables are | ||
363 | * allocated on the EADS level. | ||
364 | * | ||
365 | * Allocate at offset 128MB to avoid having to deal | ||
366 | * with ISA holes; 128MB table for IDE is plenty. | ||
367 | */ | ||
368 | pci->phb->dma_window_size = 1 << 27; | ||
369 | pci->phb->dma_window_base_cur = 1 << 27; | ||
370 | |||
371 | tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); | ||
372 | |||
373 | iommu_table_setparms(pci->phb, dn, tbl); | ||
374 | pci->iommu_table = iommu_init_table(tbl); | ||
375 | |||
376 | /* All child buses have 256MB tables */ | ||
377 | pci->phb->dma_window_size = 1 << 28; | ||
378 | } | ||
379 | } else { | ||
380 | pdn = pci_bus_to_OF_node(bus->parent); | ||
381 | 344 | ||
382 | if (!bus->parent->self && !is_python(pdn)) { | 345 | /* Count number of direct PCI children of the PHB. |
383 | struct iommu_table *tbl; | 346 | * All PCI device nodes have class-code property, so it's |
384 | /* First child and not python means this is the EADS | 347 | * an easy way to find them. |
385 | * level. Allocate new table for this slot with 256MB | 348 | */ |
386 | * window. | 349 | for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling) |
387 | */ | 350 | if (get_property(tmp, "class-code", NULL)) |
351 | children++; | ||
388 | 352 | ||
389 | tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); | 353 | DBG("Children: %d\n", children); |
390 | 354 | ||
391 | iommu_table_setparms(pci->phb, dn, tbl); | 355 | /* Calculate amount of DMA window per slot. Each window must be |
356 | * a power of two (due to pci_alloc_consistent requirements). | ||
357 | * | ||
358 | * Keep 256MB aside for PHBs with ISA. | ||
359 | */ | ||
392 | 360 | ||
393 | pci->iommu_table = iommu_init_table(tbl); | 361 | if (!isa_dn) { |
394 | } else { | 362 | /* No ISA/IDE - just set window size and return */ |
395 | /* Lower than first child or under python, use parent table */ | 363 | pci->phb->dma_window_size = 0x80000000ul; /* To be divided */ |
396 | pci->iommu_table = PCI_DN(pdn)->iommu_table; | 364 | |
397 | } | 365 | while (pci->phb->dma_window_size * children > 0x80000000ul) |
366 | pci->phb->dma_window_size >>= 1; | ||
367 | DBG("No ISA/IDE, window size is %x\n", pci->phb->dma_window_size); | ||
368 | pci->phb->dma_window_base_cur = 0; | ||
369 | |||
370 | return; | ||
398 | } | 371 | } |
372 | |||
373 | /* If we have ISA, then we probably have an IDE | ||
374 | * controller too. Allocate a 128MB table but | ||
375 | * skip the first 128MB to avoid stepping on ISA | ||
376 | * space. | ||
377 | */ | ||
378 | pci->phb->dma_window_size = 0x8000000ul; | ||
379 | pci->phb->dma_window_base_cur = 0x8000000ul; | ||
380 | |||
381 | tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); | ||
382 | |||
383 | iommu_table_setparms(pci->phb, dn, tbl); | ||
384 | pci->iommu_table = iommu_init_table(tbl); | ||
385 | |||
386 | /* Divide the rest (1.75GB) among the children */ | ||
387 | pci->phb->dma_window_size = 0x80000000ul; | ||
388 | while (pci->phb->dma_window_size * children > 0x70000000ul) | ||
389 | pci->phb->dma_window_size >>= 1; | ||
390 | |||
391 | DBG("ISA/IDE, window size is %x\n", pci->phb->dma_window_size); | ||
392 | |||
399 | } | 393 | } |
400 | 394 | ||
401 | 395 | ||
@@ -446,14 +440,29 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus) | |||
446 | static void iommu_dev_setup_pSeries(struct pci_dev *dev) | 440 | static void iommu_dev_setup_pSeries(struct pci_dev *dev) |
447 | { | 441 | { |
448 | struct device_node *dn, *mydn; | 442 | struct device_node *dn, *mydn; |
443 | struct iommu_table *tbl; | ||
449 | 444 | ||
450 | DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, dev->pretty_name); | 445 | DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, dev->pretty_name); |
451 | /* Now copy the iommu_table ptr from the bus device down to the | 446 | |
452 | * pci device_node. This means get_iommu_table() won't need to search | ||
453 | * up the device tree to find it. | ||
454 | */ | ||
455 | mydn = dn = pci_device_to_OF_node(dev); | 447 | mydn = dn = pci_device_to_OF_node(dev); |
456 | 448 | ||
449 | /* If we're the direct child of a root bus, then we need to allocate | ||
450 | * an iommu table ourselves. The bus setup code should have setup | ||
451 | * the window sizes already. | ||
452 | */ | ||
453 | if (!dev->bus->self) { | ||
454 | DBG(" --> first child, no bridge. Allocating iommu table.\n"); | ||
455 | tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); | ||
456 | iommu_table_setparms(PCI_DN(dn)->phb, dn, tbl); | ||
457 | PCI_DN(mydn)->iommu_table = iommu_init_table(tbl); | ||
458 | |||
459 | return; | ||
460 | } | ||
461 | |||
462 | /* If this device is further down the bus tree, search upwards until | ||
463 | * an already allocated iommu table is found and use that. | ||
464 | */ | ||
465 | |||
457 | while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL) | 466 | while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL) |
458 | dn = dn->parent; | 467 | dn = dn->parent; |
459 | 468 | ||
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/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/vdso.c b/arch/ppc64/kernel/vdso.c index 4777676365fe..efa985f05aca 100644 --- a/arch/ppc64/kernel/vdso.c +++ b/arch/ppc64/kernel/vdso.c | |||
@@ -224,10 +224,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack) | |||
224 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 224 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); |
225 | if (vma == NULL) | 225 | if (vma == NULL) |
226 | return -ENOMEM; | 226 | return -ENOMEM; |
227 | if (security_vm_enough_memory(vdso_pages)) { | 227 | |
228 | kmem_cache_free(vm_area_cachep, vma); | ||
229 | return -ENOMEM; | ||
230 | } | ||
231 | memset(vma, 0, sizeof(*vma)); | 228 | memset(vma, 0, sizeof(*vma)); |
232 | 229 | ||
233 | /* | 230 | /* |
@@ -237,8 +234,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack) | |||
237 | */ | 234 | */ |
238 | vdso_base = get_unmapped_area(NULL, vdso_base, | 235 | vdso_base = get_unmapped_area(NULL, vdso_base, |
239 | vdso_pages << PAGE_SHIFT, 0, 0); | 236 | vdso_pages << PAGE_SHIFT, 0, 0); |
240 | if (vdso_base & ~PAGE_MASK) | 237 | if (vdso_base & ~PAGE_MASK) { |
238 | kmem_cache_free(vm_area_cachep, vma); | ||
241 | return (int)vdso_base; | 239 | return (int)vdso_base; |
240 | } | ||
242 | 241 | ||
243 | current->thread.vdso_base = vdso_base; | 242 | current->thread.vdso_base = vdso_base; |
244 | 243 | ||
@@ -266,7 +265,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack) | |||
266 | vma->vm_ops = &vdso_vmops; | 265 | vma->vm_ops = &vdso_vmops; |
267 | 266 | ||
268 | down_write(&mm->mmap_sem); | 267 | down_write(&mm->mmap_sem); |
269 | insert_vm_struct(mm, vma); | 268 | if (insert_vm_struct(mm, vma)) { |
269 | up_write(&mm->mmap_sem); | ||
270 | kmem_cache_free(vm_area_cachep, vma); | ||
271 | return -ENOMEM; | ||
272 | } | ||
270 | mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 273 | mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
271 | up_write(&mm->mmap_sem); | 274 | up_write(&mm->mmap_sem); |
272 | 275 | ||
diff --git a/arch/ppc64/lib/Makefile b/arch/ppc64/lib/Makefile index 76fbfa9f706f..0b6e967de948 100644 --- a/arch/ppc64/lib/Makefile +++ b/arch/ppc64/lib/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for ppc64-specific library files.. | 2 | # Makefile for ppc64-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y := checksum.o dec_and_lock.o string.o strcase.o | 5 | lib-y := checksum.o string.o strcase.o |
6 | lib-y += copypage.o memcpy.o copyuser.o usercopy.o | 6 | lib-y += copypage.o memcpy.o copyuser.o usercopy.o |
7 | 7 | ||
8 | # Lock primitives are defined as no-ops in include/linux/spinlock.h | 8 | # Lock primitives are defined as no-ops in include/linux/spinlock.h |
diff --git a/arch/ppc64/lib/dec_and_lock.c b/arch/ppc64/lib/dec_and_lock.c deleted file mode 100644 index 7b9d4da5cf92..000000000000 --- a/arch/ppc64/lib/dec_and_lock.c +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | /* | ||
2 | * ppc64 version of atomic_dec_and_lock() using cmpxchg | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/module.h> | ||
11 | #include <linux/spinlock.h> | ||
12 | #include <asm/atomic.h> | ||
13 | #include <asm/system.h> | ||
14 | |||
15 | /* | ||
16 | * This is an implementation of the notion of "decrement a | ||
17 | * reference count, and return locked if it decremented to zero". | ||
18 | * | ||
19 | * This implementation can be used on any architecture that | ||
20 | * has a cmpxchg, and where atomic->value is an int holding | ||
21 | * the value of the atomic (i.e. the high bits aren't used | ||
22 | * for a lock or anything like that). | ||
23 | */ | ||
24 | int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) | ||
25 | { | ||
26 | int counter; | ||
27 | int newcount; | ||
28 | |||
29 | for (;;) { | ||
30 | counter = atomic_read(atomic); | ||
31 | newcount = counter - 1; | ||
32 | if (!newcount) | ||
33 | break; /* do it the slow way */ | ||
34 | |||
35 | newcount = cmpxchg(&atomic->counter, counter, newcount); | ||
36 | if (newcount == counter) | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | spin_lock(lock); | ||
41 | if (atomic_dec_and_test(atomic)) | ||
42 | return 1; | ||
43 | spin_unlock(lock); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | EXPORT_SYMBOL(_atomic_dec_and_lock); | ||
diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c index 7fbc68bbb739..be3f25cf3e9f 100644 --- a/arch/ppc64/mm/fault.c +++ b/arch/ppc64/mm/fault.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <asm/system.h> | 38 | #include <asm/system.h> |
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | #include <asm/kdebug.h> | 40 | #include <asm/kdebug.h> |
41 | #include <asm/siginfo.h> | ||
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Check whether the instruction at regs->nip is a store using | 44 | * Check whether the instruction at regs->nip is a store using |