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

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
powerpc: Fix userspace build of ptrace.h
powerpc: Fix default_machine_crash_shutdown #ifdef botch
powerpc: Fix logic error in fixup_irqs
powerpc/iseries: Fix possible null pointer dereference in iSeries_pcibios_fixup_resources
powerpc: Linux cannot run with 0 cores
powerpc: Fix feature-fixup tests for gcc 4.5
powerpc: Disable SPARSE_IRQ by default
powerpc: Fix compile errors in prom_init_check for gcc 4.5
powerpc: Fix module building for gcc 4.5 and 64 bit
powerpc/perf_event: Fix for power_pmu_disable()

+184 -37
+2 -2
arch/powerpc/Kconfig
··· 400 401 config SPARSE_IRQ 402 bool "Support sparse irq numbering" 403 - default y 404 help 405 This enables support for sparse irqs. This is useful for distro 406 kernels that want to define a high CONFIG_NR_CPUS value but still ··· 409 ( Sparse IRQs can also be beneficial on NUMA boxes, as they spread 410 out the irq_desc[] array in a more NUMA-friendly way. ) 411 412 - If you don't know what to do here, say Y. 413 414 config NUMA 415 bool "NUMA support"
··· 400 401 config SPARSE_IRQ 402 bool "Support sparse irq numbering" 403 + default n 404 help 405 This enables support for sparse irqs. This is useful for distro 406 kernels that want to define a high CONFIG_NR_CPUS value but still ··· 409 ( Sparse IRQs can also be beneficial on NUMA boxes, as they spread 410 out the irq_desc[] array in a more NUMA-friendly way. ) 411 412 + If you don't know what to do here, say N. 413 414 config NUMA 415 bool "NUMA support"
+2 -2
arch/powerpc/Makefile
··· 92 else 93 KBUILD_CFLAGS += $(call cc-option,-mtune=power4) 94 endif 95 - else 96 - LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 97 endif 98 99 ifeq ($(CONFIG_TUNE_CELL),y) 100 KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
··· 92 else 93 KBUILD_CFLAGS += $(call cc-option,-mtune=power4) 94 endif 95 endif 96 + 97 + LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 98 99 ifeq ($(CONFIG_TUNE_CELL),y) 100 KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
+14 -18
arch/powerpc/include/asm/ptrace.h
··· 24 * 2 of the License, or (at your option) any later version. 25 */ 26 27 - #ifdef __KERNEL__ 28 #include <linux/types.h> 29 - #else 30 - #include <stdint.h> 31 - #endif 32 33 #ifndef __ASSEMBLY__ 34 ··· 360 #ifndef __ASSEMBLY__ 361 362 struct ppc_debug_info { 363 - uint32_t version; /* Only version 1 exists to date */ 364 - uint32_t num_instruction_bps; 365 - uint32_t num_data_bps; 366 - uint32_t num_condition_regs; 367 - uint32_t data_bp_alignment; 368 - uint32_t sizeof_condition; /* size of the DVC register */ 369 - uint64_t features; 370 }; 371 372 #endif /* __ASSEMBLY__ */ ··· 382 #ifndef __ASSEMBLY__ 383 384 struct ppc_hw_breakpoint { 385 - uint32_t version; /* currently, version must be 1 */ 386 - uint32_t trigger_type; /* only some combinations allowed */ 387 - uint32_t addr_mode; /* address match mode */ 388 - uint32_t condition_mode; /* break/watchpoint condition flags */ 389 - uint64_t addr; /* break/watchpoint address */ 390 - uint64_t addr2; /* range end or mask */ 391 - uint64_t condition_value; /* contents of the DVC register */ 392 }; 393 394 #endif /* __ASSEMBLY__ */
··· 24 * 2 of the License, or (at your option) any later version. 25 */ 26 27 #include <linux/types.h> 28 29 #ifndef __ASSEMBLY__ 30 ··· 364 #ifndef __ASSEMBLY__ 365 366 struct ppc_debug_info { 367 + __u32 version; /* Only version 1 exists to date */ 368 + __u32 num_instruction_bps; 369 + __u32 num_data_bps; 370 + __u32 num_condition_regs; 371 + __u32 data_bp_alignment; 372 + __u32 sizeof_condition; /* size of the DVC register */ 373 + __u64 features; 374 }; 375 376 #endif /* __ASSEMBLY__ */ ··· 386 #ifndef __ASSEMBLY__ 387 388 struct ppc_hw_breakpoint { 389 + __u32 version; /* currently, version must be 1 */ 390 + __u32 trigger_type; /* only some combinations allowed */ 391 + __u32 addr_mode; /* address match mode */ 392 + __u32 condition_mode; /* break/watchpoint condition flags */ 393 + __u64 addr; /* break/watchpoint address */ 394 + __u64 addr2; /* range end or mask */ 395 + __u64 condition_value; /* contents of the DVC register */ 396 }; 397 398 #endif /* __ASSEMBLY__ */
+1 -1
arch/powerpc/kernel/crash.c
··· 447 crash_kexec_prepare_cpus(crashing_cpu); 448 cpu_set(crashing_cpu, cpus_in_crash); 449 crash_kexec_stop_spus(); 450 - #ifdef CONFIG_PPC_STD_MMU_64 451 crash_kexec_wait_realmode(crashing_cpu); 452 #endif 453 if (ppc_md.kexec_cpu_down)
··· 447 crash_kexec_prepare_cpus(crashing_cpu); 448 cpu_set(crashing_cpu, cpus_in_crash); 449 crash_kexec_stop_spus(); 450 + #if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP) 451 crash_kexec_wait_realmode(crashing_cpu); 452 #endif 453 if (ppc_md.kexec_cpu_down)
+4 -1
arch/powerpc/kernel/irq.c
··· 295 296 for_each_irq(irq) { 297 desc = irq_to_desc(irq); 298 - if (desc && desc->status & IRQ_PER_CPU) 299 continue; 300 301 cpumask_and(mask, desc->affinity, map);
··· 295 296 for_each_irq(irq) { 297 desc = irq_to_desc(irq); 298 + if (!desc) 299 + continue; 300 + 301 + if (desc->status & IRQ_PER_CPU) 302 continue; 303 304 cpumask_and(mask, desc->affinity, map);
+4 -1
arch/powerpc/kernel/perf_event.c
··· 791 cpuhw = &__get_cpu_var(cpu_hw_events); 792 for (i = 0; i < cpuhw->n_events; ++i) { 793 if (event == cpuhw->event[i]) { 794 - while (++i < cpuhw->n_events) 795 cpuhw->event[i-1] = cpuhw->event[i]; 796 --cpuhw->n_events; 797 ppmu->disable_pmc(event->hw.idx - 1, cpuhw->mmcr); 798 if (event->hw.idx) {
··· 791 cpuhw = &__get_cpu_var(cpu_hw_events); 792 for (i = 0; i < cpuhw->n_events; ++i) { 793 if (event == cpuhw->event[i]) { 794 + while (++i < cpuhw->n_events) { 795 cpuhw->event[i-1] = cpuhw->event[i]; 796 + cpuhw->events[i-1] = cpuhw->events[i]; 797 + cpuhw->flags[i-1] = cpuhw->flags[i]; 798 + } 799 --cpuhw->n_events; 800 ppmu->disable_pmc(event->hw.idx - 1, cpuhw->mmcr); 801 if (event->hw.idx) {
+1 -1
arch/powerpc/kernel/prom_init.c
··· 872 "ibm_architecture_vec structure inconsistent: 0x%x !\n", 873 *cores); 874 } else { 875 - *cores = NR_CPUS / prom_count_smt_threads(); 876 prom_printf("Max number of cores passed to firmware: 0x%x\n", 877 (unsigned long)*cores); 878 }
··· 872 "ibm_architecture_vec structure inconsistent: 0x%x !\n", 873 *cores); 874 } else { 875 + *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); 876 prom_printf("Max number of cores passed to firmware: 0x%x\n", 877 (unsigned long)*cores); 878 }
+6
arch/powerpc/kernel/prom_init_check.sh
··· 52 if [ "${UNDEF:0:9}" = "_restgpr_" ]; then 53 OK=1 54 fi 55 if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then 56 OK=1 57 fi 58 if [ "${UNDEF:0:9}" = "_savegpr_" ]; then 59 OK=1 60 fi 61 if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then
··· 52 if [ "${UNDEF:0:9}" = "_restgpr_" ]; then 53 OK=1 54 fi 55 + if [ "${UNDEF:0:10}" = "_restgpr0_" ]; then 56 + OK=1 57 + fi 58 if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then 59 OK=1 60 fi 61 if [ "${UNDEF:0:9}" = "_savegpr_" ]; then 62 + OK=1 63 + fi 64 + if [ "${UNDEF:0:10}" = "_savegpr0_" ]; then 65 OK=1 66 fi 67 if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then
+2 -2
arch/powerpc/lib/Makefile
··· 12 CFLAGS_REMOVE_feature-fixups.o = -pg 13 14 obj-y := string.o alloc.o \ 15 - checksum_$(CONFIG_WORD_SIZE).o 16 - obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o 17 obj-$(CONFIG_HAS_IOMEM) += devres.o 18 19 obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
··· 12 CFLAGS_REMOVE_feature-fixups.o = -pg 13 14 obj-y := string.o alloc.o \ 15 + checksum_$(CONFIG_WORD_SIZE).o crtsavres.o 16 + obj-$(CONFIG_PPC32) += div64.o copy_32.o 17 obj-$(CONFIG_HAS_IOMEM) += devres.o 18 19 obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
+129
arch/powerpc/lib/crtsavres.S
··· 6 * Written By Michael Meissner 7 * 8 * Based on gcc/config/rs6000/crtsavres.asm from gcc 9 * 10 * This file is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU General Public License as published by the ··· 44 .section ".text" 45 46 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 47 48 /* Routines for saving integer registers, called by the compiler. */ 49 /* Called with r11 pointing to the stack header word of the caller of the */ ··· 229 mtlr 0 230 mr 1,11 231 blr 232 #endif
··· 6 * Written By Michael Meissner 7 * 8 * Based on gcc/config/rs6000/crtsavres.asm from gcc 9 + * 64 bit additions from reading the PPC elf64abi document. 10 * 11 * This file is free software; you can redistribute it and/or modify it 12 * under the terms of the GNU General Public License as published by the ··· 43 .section ".text" 44 45 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 46 + 47 + #ifndef CONFIG_PPC64 48 49 /* Routines for saving integer registers, called by the compiler. */ 50 /* Called with r11 pointing to the stack header word of the caller of the */ ··· 226 mtlr 0 227 mr 1,11 228 blr 229 + 230 + #else /* CONFIG_PPC64 */ 231 + 232 + .globl _savegpr0_14 233 + _savegpr0_14: 234 + std r14,-144(r1) 235 + .globl _savegpr0_15 236 + _savegpr0_15: 237 + std r15,-136(r1) 238 + .globl _savegpr0_16 239 + _savegpr0_16: 240 + std r16,-128(r1) 241 + .globl _savegpr0_17 242 + _savegpr0_17: 243 + std r17,-120(r1) 244 + .globl _savegpr0_18 245 + _savegpr0_18: 246 + std r18,-112(r1) 247 + .globl _savegpr0_19 248 + _savegpr0_19: 249 + std r19,-104(r1) 250 + .globl _savegpr0_20 251 + _savegpr0_20: 252 + std r20,-96(r1) 253 + .globl _savegpr0_21 254 + _savegpr0_21: 255 + std r21,-88(r1) 256 + .globl _savegpr0_22 257 + _savegpr0_22: 258 + std r22,-80(r1) 259 + .globl _savegpr0_23 260 + _savegpr0_23: 261 + std r23,-72(r1) 262 + .globl _savegpr0_24 263 + _savegpr0_24: 264 + std r24,-64(r1) 265 + .globl _savegpr0_25 266 + _savegpr0_25: 267 + std r25,-56(r1) 268 + .globl _savegpr0_26 269 + _savegpr0_26: 270 + std r26,-48(r1) 271 + .globl _savegpr0_27 272 + _savegpr0_27: 273 + std r27,-40(r1) 274 + .globl _savegpr0_28 275 + _savegpr0_28: 276 + std r28,-32(r1) 277 + .globl _savegpr0_29 278 + _savegpr0_29: 279 + std r29,-24(r1) 280 + .globl _savegpr0_30 281 + _savegpr0_30: 282 + std r30,-16(r1) 283 + .globl _savegpr0_31 284 + _savegpr0_31: 285 + std r31,-8(r1) 286 + std r0,16(r1) 287 + blr 288 + 289 + .globl _restgpr0_14 290 + _restgpr0_14: 291 + ld r14,-144(r1) 292 + .globl _restgpr0_15 293 + _restgpr0_15: 294 + ld r15,-136(r1) 295 + .globl _restgpr0_16 296 + _restgpr0_16: 297 + ld r16,-128(r1) 298 + .globl _restgpr0_17 299 + _restgpr0_17: 300 + ld r17,-120(r1) 301 + .globl _restgpr0_18 302 + _restgpr0_18: 303 + ld r18,-112(r1) 304 + .globl _restgpr0_19 305 + _restgpr0_19: 306 + ld r19,-104(r1) 307 + .globl _restgpr0_20 308 + _restgpr0_20: 309 + ld r20,-96(r1) 310 + .globl _restgpr0_21 311 + _restgpr0_21: 312 + ld r21,-88(r1) 313 + .globl _restgpr0_22 314 + _restgpr0_22: 315 + ld r22,-80(r1) 316 + .globl _restgpr0_23 317 + _restgpr0_23: 318 + ld r23,-72(r1) 319 + .globl _restgpr0_24 320 + _restgpr0_24: 321 + ld r24,-64(r1) 322 + .globl _restgpr0_25 323 + _restgpr0_25: 324 + ld r25,-56(r1) 325 + .globl _restgpr0_26 326 + _restgpr0_26: 327 + ld r26,-48(r1) 328 + .globl _restgpr0_27 329 + _restgpr0_27: 330 + ld r27,-40(r1) 331 + .globl _restgpr0_28 332 + _restgpr0_28: 333 + ld r28,-32(r1) 334 + .globl _restgpr0_29 335 + _restgpr0_29: 336 + ld r0,16(r1) 337 + ld r29,-24(r1) 338 + mtlr r0 339 + ld r30,-16(r1) 340 + ld r31,-8(r1) 341 + blr 342 + 343 + .globl _restgpr0_30 344 + _restgpr0_30: 345 + ld r30,-16(r1) 346 + .globl _restgpr0_31 347 + _restgpr0_31: 348 + ld r0,16(r1) 349 + ld r31,-8(r1) 350 + mtlr r0 351 + blr 352 + 353 + #endif /* CONFIG_PPC64 */ 354 + 355 #endif
+9 -8
arch/powerpc/lib/feature-fixups.c
··· 12 * 2 of the License, or (at your option) any later version. 13 */ 14 15 #include <linux/kernel.h> 16 #include <linux/string.h> 17 #include <linux/init.h> ··· 289 290 static void test_cpu_macros(void) 291 { 292 - extern void ftr_fixup_test_FTR_macros; 293 - extern void ftr_fixup_test_FTR_macros_expected; 294 unsigned long size = &ftr_fixup_test_FTR_macros_expected - 295 &ftr_fixup_test_FTR_macros; 296 ··· 302 static void test_fw_macros(void) 303 { 304 #ifdef CONFIG_PPC64 305 - extern void ftr_fixup_test_FW_FTR_macros; 306 - extern void ftr_fixup_test_FW_FTR_macros_expected; 307 unsigned long size = &ftr_fixup_test_FW_FTR_macros_expected - 308 &ftr_fixup_test_FW_FTR_macros; 309 ··· 315 316 static void test_lwsync_macros(void) 317 { 318 - extern void lwsync_fixup_test; 319 - extern void end_lwsync_fixup_test; 320 - extern void lwsync_fixup_test_expected_LWSYNC; 321 - extern void lwsync_fixup_test_expected_SYNC; 322 unsigned long size = &end_lwsync_fixup_test - 323 &lwsync_fixup_test; 324
··· 12 * 2 of the License, or (at your option) any later version. 13 */ 14 15 + #include <linux/types.h> 16 #include <linux/kernel.h> 17 #include <linux/string.h> 18 #include <linux/init.h> ··· 288 289 static void test_cpu_macros(void) 290 { 291 + extern u8 ftr_fixup_test_FTR_macros; 292 + extern u8 ftr_fixup_test_FTR_macros_expected; 293 unsigned long size = &ftr_fixup_test_FTR_macros_expected - 294 &ftr_fixup_test_FTR_macros; 295 ··· 301 static void test_fw_macros(void) 302 { 303 #ifdef CONFIG_PPC64 304 + extern u8 ftr_fixup_test_FW_FTR_macros; 305 + extern u8 ftr_fixup_test_FW_FTR_macros_expected; 306 unsigned long size = &ftr_fixup_test_FW_FTR_macros_expected - 307 &ftr_fixup_test_FW_FTR_macros; 308 ··· 314 315 static void test_lwsync_macros(void) 316 { 317 + extern u8 lwsync_fixup_test; 318 + extern u8 end_lwsync_fixup_test; 319 + extern u8 lwsync_fixup_test_expected_LWSYNC; 320 + extern u8 lwsync_fixup_test_expected_SYNC; 321 unsigned long size = &end_lwsync_fixup_test - 322 &lwsync_fixup_test; 323
+5 -1
arch/powerpc/platforms/iseries/pci.c
··· 445 } 446 447 allocate_device_bars(pdev); 448 - iseries_device_information(pdev, bus, *sub_bus); 449 } 450 451 /*
··· 445 } 446 447 allocate_device_bars(pdev); 448 + if (likely(sub_bus)) 449 + iseries_device_information(pdev, bus, *sub_bus); 450 + else 451 + printk(KERN_ERR "PCI: Device node %s has missing or invalid " 452 + "linux,subbus property\n", node->full_name); 453 } 454 455 /*
+5
scripts/mod/modpost.c
··· 503 strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 || 504 strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0) 505 return 1; 506 /* Do not ignore this symbol */ 507 return 0; 508 }
··· 503 strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 || 504 strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0) 505 return 1; 506 + if (info->hdr->e_machine == EM_PPC64) 507 + /* Special register function linked on all modules during final link of .ko */ 508 + if (strncmp(symname, "_restgpr0_", sizeof("_restgpr0_") - 1) == 0 || 509 + strncmp(symname, "_savegpr0_", sizeof("_savegpr0_") - 1) == 0) 510 + return 1; 511 /* Do not ignore this symbol */ 512 return 0; 513 }