Skip to content

Commit

Permalink
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/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()
  • Loading branch information
Linus Torvalds committed Jul 8, 2010
2 parents 6741502 + bf23690 commit 31016e9
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 37 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ config IRQ_ALL_CPUS

config SPARSE_IRQ
bool "Support sparse irq numbering"
default y
default n
help
This enables support for sparse irqs. This is useful for distro
kernels that want to define a high CONFIG_NR_CPUS value but still
Expand All @@ -409,7 +409,7 @@ config SPARSE_IRQ
( Sparse IRQs can also be beneficial on NUMA boxes, as they spread
out the irq_desc[] array in a more NUMA-friendly way. )

If you don't know what to do here, say Y.
If you don't know what to do here, say N.

config NUMA
bool "NUMA support"
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ endif
else
KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
endif
else
LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
endif

LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o

ifeq ($(CONFIG_TUNE_CELL),y)
KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
endif
Expand Down
32 changes: 14 additions & 18 deletions arch/powerpc/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
* 2 of the License, or (at your option) any later version.
*/

#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif

#ifndef __ASSEMBLY__

Expand Down Expand Up @@ -364,13 +360,13 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
#ifndef __ASSEMBLY__

struct ppc_debug_info {
uint32_t version; /* Only version 1 exists to date */
uint32_t num_instruction_bps;
uint32_t num_data_bps;
uint32_t num_condition_regs;
uint32_t data_bp_alignment;
uint32_t sizeof_condition; /* size of the DVC register */
uint64_t features;
__u32 version; /* Only version 1 exists to date */
__u32 num_instruction_bps;
__u32 num_data_bps;
__u32 num_condition_regs;
__u32 data_bp_alignment;
__u32 sizeof_condition; /* size of the DVC register */
__u64 features;
};

#endif /* __ASSEMBLY__ */
Expand All @@ -386,13 +382,13 @@ struct ppc_debug_info {
#ifndef __ASSEMBLY__

struct ppc_hw_breakpoint {
uint32_t version; /* currently, version must be 1 */
uint32_t trigger_type; /* only some combinations allowed */
uint32_t addr_mode; /* address match mode */
uint32_t condition_mode; /* break/watchpoint condition flags */
uint64_t addr; /* break/watchpoint address */
uint64_t addr2; /* range end or mask */
uint64_t condition_value; /* contents of the DVC register */
__u32 version; /* currently, version must be 1 */
__u32 trigger_type; /* only some combinations allowed */
__u32 addr_mode; /* address match mode */
__u32 condition_mode; /* break/watchpoint condition flags */
__u64 addr; /* break/watchpoint address */
__u64 addr2; /* range end or mask */
__u64 condition_value; /* contents of the DVC register */
};

#endif /* __ASSEMBLY__ */
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/crash.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
crash_kexec_prepare_cpus(crashing_cpu);
cpu_set(crashing_cpu, cpus_in_crash);
crash_kexec_stop_spus();
#ifdef CONFIG_PPC_STD_MMU_64
#if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP)
crash_kexec_wait_realmode(crashing_cpu);
#endif
if (ppc_md.kexec_cpu_down)
Expand Down
5 changes: 4 additions & 1 deletion arch/powerpc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ void fixup_irqs(const struct cpumask *map)

for_each_irq(irq) {
desc = irq_to_desc(irq);
if (desc && desc->status & IRQ_PER_CPU)
if (!desc)
continue;

if (desc->status & IRQ_PER_CPU)
continue;

cpumask_and(mask, desc->affinity, map);
Expand Down
5 changes: 4 additions & 1 deletion arch/powerpc/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,11 @@ static void power_pmu_disable(struct perf_event *event)
cpuhw = &__get_cpu_var(cpu_hw_events);
for (i = 0; i < cpuhw->n_events; ++i) {
if (event == cpuhw->event[i]) {
while (++i < cpuhw->n_events)
while (++i < cpuhw->n_events) {
cpuhw->event[i-1] = cpuhw->event[i];
cpuhw->events[i-1] = cpuhw->events[i];
cpuhw->flags[i-1] = cpuhw->flags[i];
}
--cpuhw->n_events;
ppmu->disable_pmc(event->hw.idx - 1, cpuhw->mmcr);
if (event->hw.idx) {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ static void __init prom_send_capabilities(void)
"ibm_architecture_vec structure inconsistent: 0x%x !\n",
*cores);
} else {
*cores = NR_CPUS / prom_count_smt_threads();
*cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
prom_printf("Max number of cores passed to firmware: 0x%x\n",
(unsigned long)*cores);
}
Expand Down
6 changes: 6 additions & 0 deletions arch/powerpc/kernel/prom_init_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@ do
if [ "${UNDEF:0:9}" = "_restgpr_" ]; then
OK=1
fi
if [ "${UNDEF:0:10}" = "_restgpr0_" ]; then
OK=1
fi
if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then
OK=1
fi
if [ "${UNDEF:0:9}" = "_savegpr_" ]; then
OK=1
fi
if [ "${UNDEF:0:10}" = "_savegpr0_" ]; then
OK=1
fi
if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then
OK=1
fi
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ CFLAGS_REMOVE_code-patching.o = -pg
CFLAGS_REMOVE_feature-fixups.o = -pg

obj-y := string.o alloc.o \
checksum_$(CONFIG_WORD_SIZE).o
obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o
checksum_$(CONFIG_WORD_SIZE).o crtsavres.o
obj-$(CONFIG_PPC32) += div64.o copy_32.o
obj-$(CONFIG_HAS_IOMEM) += devres.o

obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
Expand Down
129 changes: 129 additions & 0 deletions arch/powerpc/lib/crtsavres.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Written By Michael Meissner
*
* Based on gcc/config/rs6000/crtsavres.asm from gcc
* 64 bit additions from reading the PPC elf64abi document.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -44,6 +45,8 @@

#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE

#ifndef CONFIG_PPC64

/* Routines for saving integer registers, called by the compiler. */
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the integer save area. */
Expand Down Expand Up @@ -226,4 +229,130 @@ _GLOBAL(_rest32gpr_31_x)
mtlr 0
mr 1,11
blr

#else /* CONFIG_PPC64 */

.globl _savegpr0_14
_savegpr0_14:
std r14,-144(r1)
.globl _savegpr0_15
_savegpr0_15:
std r15,-136(r1)
.globl _savegpr0_16
_savegpr0_16:
std r16,-128(r1)
.globl _savegpr0_17
_savegpr0_17:
std r17,-120(r1)
.globl _savegpr0_18
_savegpr0_18:
std r18,-112(r1)
.globl _savegpr0_19
_savegpr0_19:
std r19,-104(r1)
.globl _savegpr0_20
_savegpr0_20:
std r20,-96(r1)
.globl _savegpr0_21
_savegpr0_21:
std r21,-88(r1)
.globl _savegpr0_22
_savegpr0_22:
std r22,-80(r1)
.globl _savegpr0_23
_savegpr0_23:
std r23,-72(r1)
.globl _savegpr0_24
_savegpr0_24:
std r24,-64(r1)
.globl _savegpr0_25
_savegpr0_25:
std r25,-56(r1)
.globl _savegpr0_26
_savegpr0_26:
std r26,-48(r1)
.globl _savegpr0_27
_savegpr0_27:
std r27,-40(r1)
.globl _savegpr0_28
_savegpr0_28:
std r28,-32(r1)
.globl _savegpr0_29
_savegpr0_29:
std r29,-24(r1)
.globl _savegpr0_30
_savegpr0_30:
std r30,-16(r1)
.globl _savegpr0_31
_savegpr0_31:
std r31,-8(r1)
std r0,16(r1)
blr

.globl _restgpr0_14
_restgpr0_14:
ld r14,-144(r1)
.globl _restgpr0_15
_restgpr0_15:
ld r15,-136(r1)
.globl _restgpr0_16
_restgpr0_16:
ld r16,-128(r1)
.globl _restgpr0_17
_restgpr0_17:
ld r17,-120(r1)
.globl _restgpr0_18
_restgpr0_18:
ld r18,-112(r1)
.globl _restgpr0_19
_restgpr0_19:
ld r19,-104(r1)
.globl _restgpr0_20
_restgpr0_20:
ld r20,-96(r1)
.globl _restgpr0_21
_restgpr0_21:
ld r21,-88(r1)
.globl _restgpr0_22
_restgpr0_22:
ld r22,-80(r1)
.globl _restgpr0_23
_restgpr0_23:
ld r23,-72(r1)
.globl _restgpr0_24
_restgpr0_24:
ld r24,-64(r1)
.globl _restgpr0_25
_restgpr0_25:
ld r25,-56(r1)
.globl _restgpr0_26
_restgpr0_26:
ld r26,-48(r1)
.globl _restgpr0_27
_restgpr0_27:
ld r27,-40(r1)
.globl _restgpr0_28
_restgpr0_28:
ld r28,-32(r1)
.globl _restgpr0_29
_restgpr0_29:
ld r0,16(r1)
ld r29,-24(r1)
mtlr r0
ld r30,-16(r1)
ld r31,-8(r1)
blr

.globl _restgpr0_30
_restgpr0_30:
ld r30,-16(r1)
.globl _restgpr0_31
_restgpr0_31:
ld r0,16(r1)
ld r31,-8(r1)
mtlr r0
blr

#endif /* CONFIG_PPC64 */

#endif
17 changes: 9 additions & 8 deletions arch/powerpc/lib/feature-fixups.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* 2 of the License, or (at your option) any later version.
*/

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/init.h>
Expand Down Expand Up @@ -288,8 +289,8 @@ static void test_alternative_case_with_external_branch(void)

static void test_cpu_macros(void)
{
extern void ftr_fixup_test_FTR_macros;
extern void ftr_fixup_test_FTR_macros_expected;
extern u8 ftr_fixup_test_FTR_macros;
extern u8 ftr_fixup_test_FTR_macros_expected;
unsigned long size = &ftr_fixup_test_FTR_macros_expected -
&ftr_fixup_test_FTR_macros;

Expand All @@ -301,8 +302,8 @@ static void test_cpu_macros(void)
static void test_fw_macros(void)
{
#ifdef CONFIG_PPC64
extern void ftr_fixup_test_FW_FTR_macros;
extern void ftr_fixup_test_FW_FTR_macros_expected;
extern u8 ftr_fixup_test_FW_FTR_macros;
extern u8 ftr_fixup_test_FW_FTR_macros_expected;
unsigned long size = &ftr_fixup_test_FW_FTR_macros_expected -
&ftr_fixup_test_FW_FTR_macros;

Expand All @@ -314,10 +315,10 @@ static void test_fw_macros(void)

static void test_lwsync_macros(void)
{
extern void lwsync_fixup_test;
extern void end_lwsync_fixup_test;
extern void lwsync_fixup_test_expected_LWSYNC;
extern void lwsync_fixup_test_expected_SYNC;
extern u8 lwsync_fixup_test;
extern u8 end_lwsync_fixup_test;
extern u8 lwsync_fixup_test_expected_LWSYNC;
extern u8 lwsync_fixup_test_expected_SYNC;
unsigned long size = &end_lwsync_fixup_test -
&lwsync_fixup_test;

Expand Down
6 changes: 5 additions & 1 deletion arch/powerpc/platforms/iseries/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
}

allocate_device_bars(pdev);
iseries_device_information(pdev, bus, *sub_bus);
if (likely(sub_bus))
iseries_device_information(pdev, bus, *sub_bus);
else
printk(KERN_ERR "PCI: Device node %s has missing or invalid "
"linux,subbus property\n", node->full_name);
}

/*
Expand Down
5 changes: 5 additions & 0 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 ||
strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0)
return 1;
if (info->hdr->e_machine == EM_PPC64)
/* Special register function linked on all modules during final link of .ko */
if (strncmp(symname, "_restgpr0_", sizeof("_restgpr0_") - 1) == 0 ||
strncmp(symname, "_savegpr0_", sizeof("_savegpr0_") - 1) == 0)
return 1;
/* Do not ignore this symbol */
return 0;
}
Expand Down

0 comments on commit 31016e9

Please sign in to comment.