From 5169b8a1659fef9cc093ed3d889a854945a18177 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Wed, 23 May 2007 18:08:13 +1000 Subject: [POWERPC] Update documentation for of_find_node_by_type() The documentation for of_find_node_by_type() incorrectly refers to the "name" parameter - it should be "type". Also the behaviour when from == NULL is not really documented, fix that. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/prom.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 066a6a7a25b..af42ddab3ab 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -1171,11 +1171,12 @@ EXPORT_SYMBOL(of_find_node_by_name); /** * of_find_node_by_type - Find a node by its "device_type" property - * @from: The node to start searching from or NULL, the node - * you pass will not be searched, only the next one - * will; typically, you pass what the previous call - * returned. of_node_put() will be called on it - * @name: The type string to match against + * @from: The node to start searching from, or NULL to start searching + * the entire device tree. The node you pass will not be + * searched, only the next one will; typically, you pass + * what the previous call returned. of_node_put() will be + * called on from for you. + * @type: The type string to match against * * Returns a node pointer with refcount incremented, use * of_node_put() on it when done. -- cgit v1.2.3-18-g5258 From 7d43e57764fe6922703c36d8d0d56a7ead21f03d Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Thu, 24 May 2007 15:41:04 +1000 Subject: [POWERPC] Fix ppc32 single-stepping out of syscalls The ppc32 kernel didn't properly set/clear the TIF_SINGLESTEP flag, causing return from syscalls to not SIGTRAP, thus executing one more instruction before stopping again. This fixes it. The ptrace code is a bit of a mess, and is overdue for at least a -proper- 32/64 bits split and possibly more cleanups but this minimum fix should be ok for 2.6.22 Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/ptrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index f4f391cdd8f..bf76562167c 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -218,6 +218,7 @@ set_single_step(struct task_struct *task) regs->msr |= MSR_SE; #endif } + set_tsk_thread_flag(task, TIF_SINGLESTEP); } static inline void @@ -233,6 +234,7 @@ clear_single_step(struct task_struct *task) regs->msr &= ~MSR_SE; #endif } + clear_tsk_thread_flag(task, TIF_SINGLESTEP); } #endif /* CONFIG_PPC32 */ -- cgit v1.2.3-18-g5258 From 988519acb3dbe7168276a36cbb8fd91fddbffaee Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 25 May 2007 13:19:17 +1000 Subject: [POWERPC] Fix compiler/assembler flags for Ebony platform boot files The recent addition of assembler flags for 44x.c and ebony.c in the bootwrapper to make them compile on certain toolchains was not correct and could break other platforms. This patch switches to using a compiler flag instead, which implies the appropriate assembler flag, and also stops the compiler itself generating instructions which are invalid for the platform in question. Signed-off-by: David Gibson Acked-by: Segher Boessenkool Signed-off-by: Paul Mackerras --- arch/powerpc/boot/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 83788986b93..378bda50b17 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -33,8 +33,8 @@ endif BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -$(obj)/44x.o: BOOTCFLAGS += -Wa,-mbooke -$(obj)/ebony.o: BOOTCFLAGS += -Wa,-mbooke +$(obj)/44x.o: BOOTCFLAGS += -mcpu=440 +$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 zlib := inffast.c inflate.c inftrees.c zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h -- cgit v1.2.3-18-g5258 From 6ad8d010b2f364b739020e514e61b6a73444464b Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Sun, 27 May 2007 15:18:22 +1000 Subject: [POWERPC] Fix possible access to free pages I think we have a subtle race on ppc64 with the tlb batching. The common code expects tlb_flush() to actually flush any pending TLB batch. It does that because it delays all page freeing until after tlb_flush() is called, in order to ensure no stale reference to those pages exist in any TLB, thus causing potential access to the freed pages. However, our tlb_flush only triggers the RCU for freeing page table pages, it does not currently trigger a flush of a pending TLB/hash batch, which is, I think, an error. This fixes it. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- include/asm-powerpc/tlb.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h index 0a17682663d..66714042e43 100644 --- a/include/asm-powerpc/tlb.h +++ b/include/asm-powerpc/tlb.h @@ -38,6 +38,15 @@ extern void pte_free_finish(void); static inline void tlb_flush(struct mmu_gather *tlb) { + struct ppc64_tlb_batch *tlbbatch = &__get_cpu_var(ppc64_tlb_batch); + + /* If there's a TLB batch pending, then we must flush it because the + * pages are going to be freed and we really don't want to have a CPU + * access a freed page because it has a stale TLB + */ + if (tlbbatch->index) + __flush_tlb_pending(tlbbatch); + pte_free_finish(); } -- cgit v1.2.3-18-g5258 From 42d284bc45a9d6625b30c3175563829847406e03 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 28 May 2007 10:19:08 +1000 Subject: [POWERPC] ps3/interrupt.c uses get_hard_smp_processor_id and so needs to include asm/smp.h for a UP build to work. Signed-off-by: Stephen Rothwell Acked-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/interrupt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 9da82c266ba..ec9030dbb5f 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "platform.h" -- cgit v1.2.3-18-g5258 From 18456d015c50bc903fc66c65621170170190a1fd Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 28 May 2007 10:20:45 +1000 Subject: [POWERPC] pasemi idle uses hard_smp_processor_id and so needs to include asm/smp.h so a UP build works. Signed-off-by: Stephen Rothwell Acked-by: Olof Johansson Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pasemi/idle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c index 03cd45d8fef..3c962d5757b 100644 --- a/arch/powerpc/platforms/pasemi/idle.c +++ b/arch/powerpc/platforms/pasemi/idle.c @@ -26,6 +26,7 @@ #include #include +#include #include "pasemi.h" -- cgit v1.2.3-18-g5258 From 0570d4ed4325c0fb2ceb75f45a21d878b1741b61 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 28 May 2007 16:12:59 +1000 Subject: [POWERPC] Create a zImage for legacy iSeries This zImage is really just the stripped vmlinux, but it means that there is one less special case for iSeries and also that the zImages will be built for a combined kernel build that happens to include iSeries. This zImage boots fine on legacy iSeries. Signed-off-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- arch/powerpc/Makefile | 1 - arch/powerpc/boot/Makefile | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 6238b5875fd..fbafd965dcd 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -142,7 +142,6 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ # Default to zImage, override when needed defaultimage-y := zImage -defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage KBUILD_IMAGE := $(defaultimage-y) all: $(KBUILD_IMAGE) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 378bda50b17..cc11697c38e 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -136,6 +136,7 @@ image-$(CONFIG_PPC_EFIKA) += zImage.chrp image-$(CONFIG_PPC_PMAC) += zImage.pmac image-$(CONFIG_PPC_HOLLY) += zImage.holly-elf image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800 +image-$(CONFIG_PPC_ISERIES) += zImage.iseries image-$(CONFIG_DEFAULT_UIMAGE) += uImage ifneq ($(CONFIG_DEVICE_TREE),"") @@ -185,6 +186,9 @@ $(obj)/zImage.initrd.%: vmlinux $(wrapperbits) $(obj)/zImage.%: vmlinux $(wrapperbits) $(call if_changed,wrap,$*) +$(obj)/zImage.iseries: vmlinux + $(STRIP) -s -R .comment $< -o $@ + $(obj)/zImage.ps3: vmlinux $(STRIP) -s -R .comment $< -o $@ -- cgit v1.2.3-18-g5258 From b610b9780bdb2750849f32c2eefef46af58c67f8 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 29 May 2007 15:37:12 +1000 Subject: [POWERPC] Don't use HOSTCFLAGS in BOOTCFLAGS In the bootwrapper code for powerpc, we include HOSTCFLAGS into the BOOTCFLAGS used for building the zImage wrapper code. Since the wrapper code is not host code, this makes no sense. This patch removes the use of HOSTCFLAGS here, instead including directly into BOOTCFLAGS those flags from the normal kernel CFLAGS which also make sense in the bootwrapper code. In particular, this makes the bootwrapper use -msoft-float, preventing the compiler from generating floating point instructions. Previously, under some circumstances the compiler could generate floating point instructions in the bootwrapper which would cause exceptions on embedded CPUS which don't have floating point support. Signed-off-by: David Gibson Acked-by: Josh Boyer Signed-off-by: Paul Mackerras --- arch/powerpc/boot/Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index cc11697c38e..ff2701949ee 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -11,20 +11,18 @@ # bootloader and increase compatibility with OpenFirmware. # # To this end we need to define BOOTCC, etc, as the tools -# needed to build the 32 bit image. These are normally HOSTCC, -# but may be a third compiler if, for example, you are cross -# compiling from an intel box. Once the 64bit ppc gcc is -# stable it will probably simply be a compiler switch to -# compile for 32bit mode. +# needed to build the 32 bit image. That's normally the same +# compiler for the rest of the kernel, with the -m32 flag added. # To make it easier to setup a cross compiler, # CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE # in the toplevel makefile. all: $(obj)/zImage -HOSTCC := gcc -BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ - $(shell $(CROSS32CC) -print-file-name=include) -fPIC +BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -Os -msoft-float -pipe \ + -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ + -isystem $(shell $(CROSS32CC) -print-file-name=include) BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc ifeq ($(call cc-option-yn, -fstack-protector),y) -- cgit v1.2.3-18-g5258 From 66b30922c8a2c880fe61080c5bf87ae6615b9f64 Mon Sep 17 00:00:00 2001 From: Michael Neuling Date: Tue, 29 May 2007 17:01:52 +1000 Subject: [POWERPC] Fix compile warning in pseries xics code In 616883df78bd4b3fcdb6ddc39bd3d4cb902bfa32 request_irq was marked as __must_check so we must... er... check it. Signed-off-by: Michael Neuling Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/xics.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index b854e7f1001..f1df942072b 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c @@ -752,6 +752,7 @@ skip_gserver_check: void xics_request_IPIs(void) { unsigned int ipi; + int rc; ipi = irq_create_mapping(xics_host, XICS_IPI); BUG_ON(ipi == NO_IRQ); @@ -762,11 +763,12 @@ void xics_request_IPIs(void) */ set_irq_handler(ipi, handle_percpu_irq); if (firmware_has_feature(FW_FEATURE_LPAR)) - request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED, - "IPI", NULL); + rc = request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED, + "IPI", NULL); else - request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED, - "IPI", NULL); + rc = request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED, + "IPI", NULL); + BUG_ON(rc); } #endif /* CONFIG_SMP */ -- cgit v1.2.3-18-g5258 From a4c28ab7445f5ca60e56ffd90edb3e9fc1330b71 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Tue, 29 May 2007 20:46:51 +1000 Subject: [POWERPC] Fix return from pte_alloc_one() in out-of-memory case pte_alloc_one() is expected to return NULL if out of memory. But it returns virt_to_page(NULL), which is not NULL. This fixes it. Cc: Paul Mackerras Signed-off-by: Akinobu Mita Signed-off-by: Paul Mackerras --- include/asm-powerpc/pgalloc-64.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/asm-powerpc/pgalloc-64.h b/include/asm-powerpc/pgalloc-64.h index d9a3a8ca58a..94d0294341d 100644 --- a/include/asm-powerpc/pgalloc-64.h +++ b/include/asm-powerpc/pgalloc-64.h @@ -90,7 +90,8 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { - return virt_to_page(pte_alloc_one_kernel(mm, address)); + pte_t *pte = pte_alloc_one_kernel(mm, address); + return pte ? virt_to_page(pte) : NULL; } static inline void pte_free_kernel(pte_t *pte) -- cgit v1.2.3-18-g5258 From f5921697cf5cae68dcbfa881d9e08f3cebef47eb Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Fri, 1 Jun 2007 17:23:26 +1000 Subject: [POWERPC] Compare irq numbers with NO_IRQ not IRQ_NONE There is a thinko in the irq code, it uses IRQ_NONE to indicate no irq, whereas it should be using NO_IRQ. IRQ_NONE is returned from irq handlers to say "not handled". As it happens they currently have the same value (0), so this is just for future proof-ness. Signed-off-by: Michael Ellerman Acked-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/irq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 068377a2a8d..42c8ed6ed52 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -489,7 +489,7 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type, case IRQ_HOST_MAP_LINEAR: rmap = (unsigned int *)(host + 1); for (i = 0; i < revmap_arg; i++) - rmap[i] = IRQ_NONE; + rmap[i] = NO_IRQ; host->revmap_data.linear.size = revmap_arg; smp_wmb(); host->revmap_data.linear.revmap = rmap; @@ -614,7 +614,7 @@ unsigned int irq_create_mapping(struct irq_host *host, * host->ops->map() to update the flags */ virq = irq_find_mapping(host, hwirq); - if (virq != IRQ_NONE) { + if (virq != NO_IRQ) { if (host->ops->remap) host->ops->remap(host, virq, hwirq); pr_debug("irq: -> existing mapping on virq %d\n", virq); @@ -741,7 +741,7 @@ void irq_dispose_mapping(unsigned int virq) switch(host->revmap_type) { case IRQ_HOST_MAP_LINEAR: if (hwirq < host->revmap_data.linear.size) - host->revmap_data.linear.revmap[hwirq] = IRQ_NONE; + host->revmap_data.linear.revmap[hwirq] = NO_IRQ; break; case IRQ_HOST_MAP_TREE: /* Check if radix tree allocated yet */ -- cgit v1.2.3-18-g5258 From e358ae4dd4ca823abc5ee06c61e3915636e60191 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sat, 2 Jun 2007 19:13:44 +1000 Subject: [POWERPC] Don't allow PMAC_APM_EMU for 64-bit In b302887854d6f0c6f9fc3f1080535e7c1bd53134 I switched the apm emulation code to use the generic code but accidentally dropped the PPC32 dependency from the configuration symbol. This adds it back. Signed-off-by: Johannes Berg Signed-off-by: Paul Mackerras --- drivers/macintosh/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index f44c94abd88..ee699a7d621 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig @@ -114,7 +114,7 @@ config PMAC_SMU config PMAC_APM_EMU tristate "APM emulation" select APM_EMULATION - depends on ADB_PMU && PM + depends on ADB_PMU && PM && PPC32 config PMAC_MEDIABAY bool "Support PowerBook hotswap media bay" -- cgit v1.2.3-18-g5258 From f48419666e645208c0156aecab1ee6157303da3c Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Sat, 2 Jun 2007 19:30:20 +1000 Subject: [POWERPC] Fix compile breakage for IBM/AMCC 4xx arch/ppc platforms The IBM/AMCC 405 platforms don't compile anymore in the current kernel version. This fixes the compile breakage. Signed-off-by: Stefan Roese Signed-off-by: Paul Mackerras --- arch/ppc/syslib/ibm_ocp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/ppc/syslib/ibm_ocp.c b/arch/ppc/syslib/ibm_ocp.c index 3f6e55c7918..2ee176610e7 100644 --- a/arch/ppc/syslib/ibm_ocp.c +++ b/arch/ppc/syslib/ibm_ocp.c @@ -1,4 +1,5 @@ #include +#include #include struct ocp_sys_info_data ocp_sys_info = { -- cgit v1.2.3-18-g5258 From 627aa944a17ba82ca3ba87dc1d6ee85bd314ec79 Mon Sep 17 00:00:00 2001 From: Milton Miller Date: Thu, 31 May 2007 01:29:01 +1000 Subject: [POWERPC] Fix zImage.coff generation for 32-bit pmac Commit 9da82a6dee9db4cd5ae7a74ab4f51afb52b6efb9 inadvertently removed the platform override for zImage.coff to be generated with pmaccoff. Rather than add a special makefile rule, change the platform for which the wrapper platform uses the special rules. Signed-off-by: Milton Miller Signed-off-by: Paul Mackerras --- arch/powerpc/boot/wrapper | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index 2ed8b8b3f0e..da77adc7307 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper @@ -129,7 +129,7 @@ case "$platform" in pmac|pseries|chrp) platformo=$object/of.o ;; -pmaccoff) +coff) platformo=$object/of.o lds=$object/zImage.coff.lds ;; @@ -220,7 +220,7 @@ case "$platform" in pseries|chrp) $object/addnote "$ofile" ;; -pmaccoff) +coff) ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" $object/hack-coff "$ofile" ;; -- cgit v1.2.3-18-g5258