Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
[POWERPC] cell: set ARCH_SPARSEMEM_DEFAULT in Kconfig
[POWERPC] Fix cell "new style" mapping and add debug
[POWERPC] pseries: Force 4k update_flash block and list sizes
[POWERPC] CPM_UART: Fix non-console initialisation
[POWERPC] CPM_UART: Fix non-console transmit
[POWERPC] Make sure initrd and dtb sections get into zImage correctly

+88 -31
+1 -1
arch/powerpc/Kconfig
··· 740 741 config ARCH_SPARSEMEM_DEFAULT 742 def_bool y 743 - depends on SMP && PPC_PSERIES 744 745 config ARCH_POPULATES_NODE_MAP 746 def_bool y
··· 740 741 config ARCH_SPARSEMEM_DEFAULT 742 def_bool y 743 + depends on (SMP && PPC_PSERIES) || PPC_CELL 744 745 config ARCH_POPULATES_NODE_MAP 746 def_bool y
+2 -2
arch/powerpc/boot/wrapper
··· 179 fi 180 181 if [ -n "$initrd" ]; then 182 - addsec $tmp "$initrd" initrd 183 fi 184 185 if [ -n "$dtb" ]; then 186 - addsec $tmp "$dtb" dtb 187 fi 188 189 if [ "$platform" != "miboot" ]; then
··· 179 fi 180 181 if [ -n "$initrd" ]; then 182 + addsec $tmp "$initrd" $isection 183 fi 184 185 if [ -n "$dtb" ]; then 186 + addsec $tmp "$dtb" .kernel:dtb 187 fi 188 189 if [ "$platform" != "miboot" ]; then
+5
arch/powerpc/boot/zImage.lds.S
··· 21 __got2_end = .; 22 } 23 24 . = ALIGN(4096); 25 _vmlinux_start = .; 26 .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
··· 21 __got2_end = .; 22 } 23 24 + . = ALIGN(8); 25 + _dtb_start = .; 26 + .kernel:dtb : { *(.kernel:dtb) } 27 + _dtb_end = .; 28 + 29 . = ALIGN(4096); 30 _vmlinux_start = .; 31 .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
+37 -10
arch/powerpc/kernel/rtas_flash.c
··· 72 #define VALIDATE_BUF_SIZE 4096 73 #define RTAS_MSG_MAXLEN 64 74 75 struct flash_block { 76 char *data; 77 unsigned long length; ··· 87 * into a version/length and translate the pointers 88 * to absolute. 89 */ 90 - #define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) 91 struct flash_block_list { 92 unsigned long num_blocks; 93 struct flash_block_list *next; ··· 99 }; 100 101 static struct flash_block_list_header rtas_firmware_flash_list = {0, NULL}; 102 103 #define FLASH_BLOCK_LIST_VERSION (1UL) 104 ··· 160 return FLASH_IMG_NULL_DATA; 161 } 162 block_size = f->blocks[i].length; 163 - if (block_size <= 0 || block_size > PAGE_SIZE) { 164 return FLASH_IMG_BAD_LEN; 165 } 166 image_size += block_size; ··· 184 185 while (f) { 186 for (i = 0; i < f->num_blocks; i++) 187 - free_page((unsigned long)(f->blocks[i].data)); 188 next = f->next; 189 - free_page((unsigned long)f); 190 f = next; 191 } 192 } ··· 285 return msglen; 286 } 287 288 /* We could be much more efficient here. But to keep this function 289 * simple we allocate a page to the block list no matter how small the 290 * count is. If the system is low on memory it will be just as well ··· 315 * proc file 316 */ 317 if (uf->flist == NULL) { 318 - uf->flist = (struct flash_block_list *) get_zeroed_page(GFP_KERNEL); 319 if (!uf->flist) 320 return -ENOMEM; 321 } ··· 326 next_free = fl->num_blocks; 327 if (next_free == FLASH_BLOCKS_PER_NODE) { 328 /* Need to allocate another block_list */ 329 - fl->next = (struct flash_block_list *)get_zeroed_page(GFP_KERNEL); 330 if (!fl->next) 331 return -ENOMEM; 332 fl = fl->next; 333 next_free = 0; 334 } 335 336 - if (count > PAGE_SIZE) 337 - count = PAGE_SIZE; 338 - p = (char *)get_zeroed_page(GFP_KERNEL); 339 if (!p) 340 return -ENOMEM; 341 342 if(copy_from_user(p, buffer, count)) { 343 - free_page((unsigned long)p); 344 return -EFAULT; 345 } 346 fl->blocks[next_free].data = p; ··· 804 goto cleanup; 805 806 rtas_flash_term_hook = rtas_flash_firmware; 807 return 0; 808 809 cleanup: ··· 828 void __exit rtas_flash_cleanup(void) 829 { 830 rtas_flash_term_hook = NULL; 831 remove_flash_pde(firmware_flash_pde); 832 remove_flash_pde(firmware_update_pde); 833 remove_flash_pde(validate_pde);
··· 72 #define VALIDATE_BUF_SIZE 4096 73 #define RTAS_MSG_MAXLEN 64 74 75 + /* Quirk - RTAS requires 4k list length and block size */ 76 + #define RTAS_BLKLIST_LENGTH 4096 77 + #define RTAS_BLK_SIZE 4096 78 + 79 struct flash_block { 80 char *data; 81 unsigned long length; ··· 83 * into a version/length and translate the pointers 84 * to absolute. 85 */ 86 + #define FLASH_BLOCKS_PER_NODE ((RTAS_BLKLIST_LENGTH - 16) / sizeof(struct flash_block)) 87 struct flash_block_list { 88 unsigned long num_blocks; 89 struct flash_block_list *next; ··· 95 }; 96 97 static struct flash_block_list_header rtas_firmware_flash_list = {0, NULL}; 98 + 99 + /* Use slab cache to guarantee 4k alignment */ 100 + static kmem_cache_t *flash_block_cache = NULL; 101 102 #define FLASH_BLOCK_LIST_VERSION (1UL) 103 ··· 153 return FLASH_IMG_NULL_DATA; 154 } 155 block_size = f->blocks[i].length; 156 + if (block_size <= 0 || block_size > RTAS_BLK_SIZE) { 157 return FLASH_IMG_BAD_LEN; 158 } 159 image_size += block_size; ··· 177 178 while (f) { 179 for (i = 0; i < f->num_blocks; i++) 180 + kmem_cache_free(flash_block_cache, f->blocks[i].data); 181 next = f->next; 182 + kmem_cache_free(flash_block_cache, f); 183 f = next; 184 } 185 } ··· 278 return msglen; 279 } 280 281 + /* constructor for flash_block_cache */ 282 + void rtas_block_ctor(void *ptr, kmem_cache_t *cache, unsigned long flags) 283 + { 284 + memset(ptr, 0, RTAS_BLK_SIZE); 285 + } 286 + 287 /* We could be much more efficient here. But to keep this function 288 * simple we allocate a page to the block list no matter how small the 289 * count is. If the system is low on memory it will be just as well ··· 302 * proc file 303 */ 304 if (uf->flist == NULL) { 305 + uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 306 if (!uf->flist) 307 return -ENOMEM; 308 } ··· 313 next_free = fl->num_blocks; 314 if (next_free == FLASH_BLOCKS_PER_NODE) { 315 /* Need to allocate another block_list */ 316 + fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 317 if (!fl->next) 318 return -ENOMEM; 319 fl = fl->next; 320 next_free = 0; 321 } 322 323 + if (count > RTAS_BLK_SIZE) 324 + count = RTAS_BLK_SIZE; 325 + p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 326 if (!p) 327 return -ENOMEM; 328 329 if(copy_from_user(p, buffer, count)) { 330 + kmem_cache_free(flash_block_cache, p); 331 return -EFAULT; 332 } 333 fl->blocks[next_free].data = p; ··· 791 goto cleanup; 792 793 rtas_flash_term_hook = rtas_flash_firmware; 794 + 795 + flash_block_cache = kmem_cache_create("rtas_flash_cache", 796 + RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0, 797 + rtas_block_ctor, NULL); 798 + if (!flash_block_cache) { 799 + printk(KERN_ERR "%s: failed to create block cache\n", 800 + __FUNCTION__); 801 + rc = -ENOMEM; 802 + goto cleanup; 803 + } 804 return 0; 805 806 cleanup: ··· 805 void __exit rtas_flash_cleanup(void) 806 { 807 rtas_flash_term_hook = NULL; 808 + 809 + if (flash_block_cache) 810 + kmem_cache_destroy(flash_block_cache); 811 + 812 remove_flash_pde(firmware_flash_pde); 813 remove_flash_pde(firmware_update_pde); 814 remove_flash_pde(validate_pde);
+33 -8
arch/powerpc/platforms/cell/spu_base.c
··· 655 656 for (i=0; i < 3; i++) { 657 ret = of_irq_map_one(np, i, &oirq); 658 - if (ret) 659 goto err; 660 - 661 ret = -EINVAL; 662 spu->irqs[i] = irq_create_of_mapping(oirq.controller, 663 oirq.specifier, oirq.size); 664 - if (spu->irqs[i] == NO_IRQ) 665 goto err; 666 } 667 return 0; 668 ··· 686 struct resource resource = { }; 687 int ret; 688 689 - ret = of_address_to_resource(node, 0, &resource); 690 if (ret) 691 goto out; 692 ··· 709 710 ret = spu_map_resource(node, 0, (void __iomem**)&spu->local_store, 711 &spu->local_store_phys); 712 - if (ret) 713 goto out; 714 ret = spu_map_resource(node, 1, (void __iomem**)&spu->problem, 715 &spu->problem_phys); 716 - if (ret) 717 goto out_unmap; 718 ret = spu_map_resource(node, 2, (void __iomem**)&spu->priv2, 719 NULL); 720 - if (ret) 721 goto out_unmap; 722 723 if (!firmware_has_feature(FW_FEATURE_LPAR)) 724 ret = spu_map_resource(node, 3, (void __iomem**)&spu->priv1, 725 NULL); 726 - if (ret) 727 goto out_unmap; 728 return 0; 729 730 out_unmap:
··· 655 656 for (i=0; i < 3; i++) { 657 ret = of_irq_map_one(np, i, &oirq); 658 + if (ret) { 659 + pr_debug("spu_new: failed to get irq %d\n", i); 660 goto err; 661 + } 662 ret = -EINVAL; 663 + pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], 664 + oirq.controller->full_name); 665 spu->irqs[i] = irq_create_of_mapping(oirq.controller, 666 oirq.specifier, oirq.size); 667 + if (spu->irqs[i] == NO_IRQ) { 668 + pr_debug("spu_new: failed to map it !\n"); 669 goto err; 670 + } 671 } 672 return 0; 673 ··· 681 struct resource resource = { }; 682 int ret; 683 684 + ret = of_address_to_resource(node, nr, &resource); 685 if (ret) 686 goto out; 687 ··· 704 705 ret = spu_map_resource(node, 0, (void __iomem**)&spu->local_store, 706 &spu->local_store_phys); 707 + if (ret) { 708 + pr_debug("spu_new: failed to map %s resource 0\n", 709 + node->full_name); 710 goto out; 711 + } 712 ret = spu_map_resource(node, 1, (void __iomem**)&spu->problem, 713 &spu->problem_phys); 714 + if (ret) { 715 + pr_debug("spu_new: failed to map %s resource 1\n", 716 + node->full_name); 717 goto out_unmap; 718 + } 719 ret = spu_map_resource(node, 2, (void __iomem**)&spu->priv2, 720 NULL); 721 + if (ret) { 722 + pr_debug("spu_new: failed to map %s resource 2\n", 723 + node->full_name); 724 goto out_unmap; 725 + } 726 727 if (!firmware_has_feature(FW_FEATURE_LPAR)) 728 ret = spu_map_resource(node, 3, (void __iomem**)&spu->priv1, 729 NULL); 730 + if (ret) { 731 + pr_debug("spu_new: failed to map %s resource 3\n", 732 + node->full_name); 733 goto out_unmap; 734 + } 735 + pr_debug("spu_new: %s maps:\n", node->full_name); 736 + pr_debug(" local store : 0x%016lx -> 0x%p\n", 737 + spu->local_store_phys, spu->local_store); 738 + pr_debug(" problem state : 0x%016lx -> 0x%p\n", 739 + spu->problem_phys, spu->problem); 740 + pr_debug(" priv2 : 0x%p\n", spu->priv2); 741 + pr_debug(" priv1 : 0x%p\n", spu->priv1); 742 + 743 return 0; 744 745 out_unmap:
+1 -1
drivers/serial/cpm_uart/cpm_uart.h
··· 88 89 /* these are located in their respective files */ 90 void cpm_line_cr_cmd(int line, int cmd); 91 - int cpm_uart_init_portdesc(void); 92 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); 93 void cpm_uart_freebuf(struct uart_cpm_port *pinfo); 94
··· 88 89 /* these are located in their respective files */ 90 void cpm_line_cr_cmd(int line, int cmd); 91 + int __init cpm_uart_init_portdesc(void); 92 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); 93 void cpm_uart_freebuf(struct uart_cpm_port *pinfo); 94
+8 -8
drivers/serial/cpm_uart/cpm_uart_core.c
··· 195 if (cpm_uart_tx_pump(port) != 0) { 196 if (IS_SMC(pinfo)) { 197 smcp->smc_smcm |= SMCM_TX; 198 - smcp->smc_smcmr |= SMCMR_TEN; 199 } else { 200 sccp->scc_sccm |= UART_SCCM_TX; 201 - pinfo->sccp->scc_gsmrl |= SCC_GSMRL_ENT; 202 } 203 } 204 } ··· 419 /* Startup rx-int */ 420 if (IS_SMC(pinfo)) { 421 pinfo->smcp->smc_smcm |= SMCM_RX; 422 - pinfo->smcp->smc_smcmr |= SMCMR_REN; 423 } else { 424 pinfo->sccp->scc_sccm |= UART_SCCM_RX; 425 } 426 427 if (!(pinfo->flags & FLAG_CONSOLE)) ··· 1349 pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n"); 1350 pr_info( 1351 "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n"); 1352 - #ifndef CONFIG_SERIAL_CPM_CONSOLE 1353 - ret = cpm_uart_init_portdesc(); 1354 - if (ret) 1355 - return ret; 1356 - #endif 1357 1358 cpm_reg.nr = cpm_uart_nr; 1359 ret = uart_register_driver(&cpm_reg); ··· 1364 int con = cpm_uart_port_map[i]; 1365 cpm_uart_ports[con].port.line = i; 1366 cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; 1367 uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); 1368 } 1369
··· 195 if (cpm_uart_tx_pump(port) != 0) { 196 if (IS_SMC(pinfo)) { 197 smcp->smc_smcm |= SMCM_TX; 198 } else { 199 sccp->scc_sccm |= UART_SCCM_TX; 200 } 201 } 202 } ··· 421 /* Startup rx-int */ 422 if (IS_SMC(pinfo)) { 423 pinfo->smcp->smc_smcm |= SMCM_RX; 424 + pinfo->smcp->smc_smcmr |= (SMCMR_REN | SMCMR_TEN); 425 } else { 426 pinfo->sccp->scc_sccm |= UART_SCCM_RX; 427 + pinfo->sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT); 428 } 429 430 if (!(pinfo->flags & FLAG_CONSOLE)) ··· 1350 pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n"); 1351 pr_info( 1352 "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n"); 1353 + 1354 + /* Don't run this again, if the console driver did it already */ 1355 + if (cpm_uart_nr == 0) 1356 + cpm_uart_init_portdesc(); 1357 1358 cpm_reg.nr = cpm_uart_nr; 1359 ret = uart_register_driver(&cpm_reg); ··· 1366 int con = cpm_uart_port_map[i]; 1367 cpm_uart_ports[con].port.line = i; 1368 cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; 1369 + if (cpm_uart_ports[con].set_lineif) 1370 + cpm_uart_ports[con].set_lineif(&cpm_uart_ports[con]); 1371 uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); 1372 } 1373
+1 -1
drivers/serial/cpm_uart/cpm_uart_cpm1.c
··· 184 } 185 186 /* Setup any dynamic params in the uart desc */ 187 - int cpm_uart_init_portdesc(void) 188 { 189 pr_debug("CPM uart[-]:init portdesc\n"); 190
··· 184 } 185 186 /* Setup any dynamic params in the uart desc */ 187 + int __init cpm_uart_init_portdesc(void) 188 { 189 pr_debug("CPM uart[-]:init portdesc\n"); 190