cell bug fixes for 2.6.20
cover cell bug fixes for 2.6.20
This seems to be the fallout of merging so many large patches in the recent times, mostly stuff broke by combining recent features.
If everyone likes these patches, please pull them from kernel.org/pub/scm/linux/kernel/git/arnd/cell-2.6.git cell-merge
Arnd <><
--
PATCH 1/9 spufs: return an error in spu_create is isolated create isnt supported
From: Jeremy Kerr <[email protected]>
This changes the spu_create system call to return an error (-ENODEV) if and isolated spu context is requested on hardware that doesn't support isolated mode.
Tested on systemsim with and without isolation support
arch/powerpc/platforms/cell/spufs/inode.c +4 -0
@@ -323,6 +323,10 @@ static int spufs_create_context(struct i == SPU_CREATE_ISOLATE) goto out_unlock; + ret = -ENODEV ; +if ((flags &SPU_CREATE_ISOLATE ) && !isolated_loader) + goto out_unlock; + ret =spufs_mkdir (inode, dentry, flags, mode &S_IRWXUGO );if (ret) goto out_unlock;
--
PATCH 2/9 spufs: always send sigtrap on breakpoint
In reply to Arnd BergmannCurrently, we only send a sigtrap if the current task is being ptraced. This is somewhat inconsistant, and it breaks utrace support in fedora. Removing the check should do the right thing in all cases.
arch/powerpc/platforms/cell/spufs/run.c +4 -6
@@ -350,12 +350,10 @@ out2: (status >> SPU_STOP_STATUS_SHIFT != 0x2104))))) ret = status; -if (unlikely (current->ptrace &PT_PTRACED )) { -if ((status &SPU_STATUS_STOPPED_BY_STOP ) - && (status >>SPU_STOP_STATUS_SHIFT ) ==0x3fff ) { -force_sig (SIGTRAP , current); - ret = -ERESTARTSYS ; - } +if ((status &SPU_STATUS_STOPPED_BY_STOP ) + && (status >>SPU_STOP_STATUS_SHIFT ) ==0x3fff ) { +force_sig (SIGTRAP , current); + ret = -ERESTARTSYS ; } out:
--
Re: [POWERPC 2/9] spufs: always send sigtrap on breakpoint
Quoted 21 lines · Arnd Bergmann
plain text document attachment (spufs-always-sigtrap-on-breakpoint.diff)
Currently, we only send a sigtrap if the current task is being ptraced. This is somewhat inconsistant, and it breaks utrace support in fedora. Removing the check should do the right thing in all cases.Cc Ulrich Weigand <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>arch/powerpc/platforms/cell/spufs/run.c +0
-3@@ -350,12 +350,10 @@ out2: (status >> SPU_STOP_STATUS_SHIFT != 0x2104))))) ret = status; -if (unlikely (current->ptrace &PT_PTRACED )) { -if ((status &SPU_STATUS_STOPPED_BY_STOP ) - && (status >>SPU_STOP_STATUS_SHIFT ) ==0x3fff ) {
arch/powerpc/platforms/cell/spufs/run.c out2: · line 359
Quoted 10 lines
arch/powerpc/platforms/cell/spufs/run.c +4
-3-force_sig (SIGTRAP , current); - ret = -ERESTARTSYS ; - } +if ((status &SPU_STATUS_STOPPED_BY_STOP ) + && (status >>SPU_STOP_STATUS_SHIFT ) ==0x3fff ) { +force_sig (SIGTRAP , current); + ret = -ERESTARTSYS ; } out:
Arnd, could you explain this change a little bit more. Don't you have to consider whether the program is setup to receive SIGTRAP. We know it is code to handle SIGTRAP if it is ptraced. Or, are you asserting that at this point the spu has hit a trap instruction? What does 0x3fff mean?
Luke
Re: [POWERPC 2/9] spufs: always send sigtrap on breakpoint
Quoted 6 lines · Luke Browning
=20
Arnd, could you explain this change a little bit more. =A0Don't you have to consider whether the program is setup to receive SIGTRAP. =A0We know it is code to handle SIGTRAP if it is ptraced. =A0Or, are you asserting that at this point the spu has hit a trap instruction? =A0What does0x3fffmean?
0x3fff is indeed the code returned from the breakpoint instruction, as specified in the JSRE list of stop-and-signal codes. The behaviour is consistant with that of a Linux process entering a breakpoint. This usually only happens while ptracing a task, but there is no reason to treat a task differently when it's not being traced.
It could even be used as well-defined way for an application to create a core dump, similar to abort() in posix.
Arnd <><
PATCH 3/9 spufs: we should only execute init_spu_base on cell
In reply to Arnd BergmannFrom: Stephen Rothwell <[email protected]>
arch/powerpc/platforms/cell/spu_base.c +3 -0
@@ -663,6 +663,9 @@ static int __init init_spu_base(void) {int i, ret; +if (!spu_management_ops) +return 0 ; +/* create sysdev class for spus */ ret =sysdev_class_register (&spu_sysdev_class);if (ret)
Signature · 3 lines
1.4.4 --
PATCH 4/9 cell: fix building without spufs
In reply to Arnd BergmannIt may be desireable to build a kernel for cell without spufs, e.g. as the initial kboot kernel. This requires that the SPU specific parts of the core dump and the xmon code depend on CONFIG_SPU_BASE instead of CONFIG_PPC_CELL.
arch/powerpc/xmon/Makefile +1 -1
@@ -8,5 +8,5 @@ obj-y += xmon.o setjmp.o start.o nonst ifdef CONFIG_XMON_DISASSEMBLY obj-y += ppc-dis.o ppc-opc.o -obj-$(CONFIG_PPC_CELL) += spu-dis.o spu-opc.o +obj-$(CONFIG_SPU_BASE) += spu-dis.o spu-opc.o endif
arch/powerpc/xmon/xmon.c +3 -3
@@ -213,7 +213,7 @@ Commands:\n\ p call a procedure\n\ r print registers\n\ s single step\n" -#ifdef CONFIG_PPC_CELL +#ifdef CONFIG_SPU_BASE" ss stop execution on all spus\n\ sr restore execution on stopped spus\n\ sf # dump spu fields for spu # (in hex)\n\
@@ -2654,7 +2654,7 @@ void __init xmon_setup(void)debugger (NULL ); } -#ifdef CONFIG_PPC_CELL +#ifdef CONFIG_SPU_BASE struct spu_info { struct spu *spu;
@@ -2907,7 +2907,7 @@ static int do_spu_cmd(void) return 0; } -#else /* ! CONFIG_PPC_CELL */ +#else /* ! CONFIG_SPU_BASE */ static int do_spu_cmd (void ) {return -1 ;
include/asm-powerpc/elf.h +1 -1
@@ -411,7 +411,7 @@ do { \/* Keep this the last entry. */ #define R_PPC64_NUM 107 -#ifdef CONFIG_PPC_CELL +#ifdef CONFIG_SPU_BASE /* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */ #define NT_SPU 1
--
PATCH 5/9 ps3: Missed renames of CONFIG_PS3 to CONFIG_PPC_PS3
In reply to Arnd BergmannFrom: Geert Uytterhoeven <[email protected]> When renaming CONFIG_PS3 to CONFIG_PPC_PS3, a few occurrences have been missed.
I also fixed up the alignment in arch/powerpc/platforms/Makefile.
arch/powerpc/platforms/Makefile +3 -3
@@ -5,7 +5,7 @@ obj-$(CONFIG_PPC_PMAC) += powermac/ endif endif -obj-$(CONFIG_PPC_EFIKA) += efika/ +obj-$(CONFIG_PPC_EFIKA) += efika/ obj-$(CONFIG_PPC_CHRP) += chrp/ obj-$(CONFIG_4xx) += 4xx/ obj-$(CONFIG_PPC_83xx) += 83xx/
@@ -14,7 +14,7 @@ obj-$(CONFIG_PPC_PSERIES) += pseries/ obj-$(CONFIG_PPC_ISERIES) += iseries/ obj-$(CONFIG_PPC_MAPLE) += maple/ -obj-$(CONFIG_PPC_PASEMI) += pasemi/ +obj-$(CONFIG_PPC_PASEMI) += pasemi/ obj-$(CONFIG_PPC_CELL) += cell/ -obj-$(CONFIG_PS3) += ps3/ +obj-$(CONFIG_PPC_PS3) += ps3/ obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
drivers/Makefile +1 -1
@@ -77,4 +77,4 @@ obj-$(CONFIG_SUPERH) += sh/ obj-$(CONFIG_GENERIC_TIME) += clocksource/ obj-$(CONFIG_DMA_ENGINE) += dma/ -obj-$(CONFIG_PS3) += ps3/ +obj-$(CONFIG_PPC_PS3) += ps3/
include/asm-powerpc/firmware.h +2 -2
@@ -67,7 +67,7 @@#ifdef CONFIG_PPC_ISERIES FW_FEATURE_ISERIES_POSSIBLE |#endif -#ifdef CONFIG_PS3 +#ifdef CONFIG_PPC_PS3 FW_FEATURE_PS3_POSSIBLE | #endif 0,
@@ -78,7 +78,7 @@#ifdef CONFIG_PPC_ISERIES FW_FEATURE_ISERIES_ALWAYS &#endif -#ifdef CONFIG_PS3 +#ifdef CONFIG_PPC_PS3 FW_FEATURE_PS3_ALWAYS & #endif FW_FEATURE_POSSIBLE,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE) [email protected] ------- The Corporate Village, Da Vincilaan 7-D1 Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium
--
Re: [POWERPC 5/9] ps3: Missed renames of CONFIG_PS3 to CONFIG_PPC_PS3
Quoted 8 lines · Arnd Bergmann
From: Geert Uytterhoeven <[email protected]> When renaming
CONFIG_PS3toCONFIG_PPC_PS3, a few occurrences have been missed.I also fixed up the alignment in
arch/powerpc/platforms/Makefile.Signed-off-by Geert Uytterhoeven <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>
PATCH 6/9 ps3: multiplatform build fixes
In reply to Arnd BergmannA few code paths need to check whether or not they are running on the PS3's LV1 hypervisor before making hcalls. This introduces a new firmware feature bit for this, FW_FEATURE_PS3_LV1.
Now when both PS3 and IBM_CELL_BLADE are enabled, but not PSERIES, FW_FEATURE_PS3_LV1 and FW_FEATURE_LPAR get enabled at compile time, which is a bug. The same problem can also happen for (PPC_ISERIES && !PPC_PSERIES && PPC_SOMETHING_ELSE). In order to solve this, I introduce a new CONFIG_PPC_NATIVE option that is set when at least one platform is selected that can run without a hypervisor and then turns the firmware feature check into a run-time option.
The new cell oprofile support that was recently merged does not work on hypervisor based platforms like the PS3, therefore make it depend on PPC_CELL_NATIVE instead of PPC_CELL. This may change if we get oprofile support for PS3.
include/asm-powerpc/firmware.h +11 -2
@@ -42,6 +42,7 @@#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000)#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000)#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) +#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)#ifndef __ASSEMBLY__
@@ -58,8 +59,10 @@ enum {FW_FEATURE_PSERIES_ALWAYS =0 ,FW_FEATURE_ISERIES_POSSIBLE =FW_FEATURE_ISERIES |FW_FEATURE_LPAR ,FW_FEATURE_ISERIES_ALWAYS =FW_FEATURE_ISERIES |FW_FEATURE_LPAR , -FW_FEATURE_PS3_POSSIBLE =FW_FEATURE_LPAR , -FW_FEATURE_PS3_ALWAYS =FW_FEATURE_LPAR , +FW_FEATURE_PS3_POSSIBLE =FW_FEATURE_LPAR |FW_FEATURE_PS3_LV1 , +FW_FEATURE_PS3_ALWAYS =FW_FEATURE_LPAR |FW_FEATURE_PS3_LV1 , +FW_FEATURE_NATIVE_POSSIBLE =0 , +FW_FEATURE_NATIVE_ALWAYS =0 ,FW_FEATURE_POSSIBLE = #ifdef CONFIG_PPC_PSERIES FW_FEATURE_PSERIES_POSSIBLE |
@@ -70,6 +73,9 @@ enum {#ifdef CONFIG_PPC_PS3 FW_FEATURE_PS3_POSSIBLE |#endif +#ifdef CONFIG_PPC_NATIVE +FW_FEATURE_NATIVE_ALWAYS | +#endif0 ,FW_FEATURE_ALWAYS = #ifdef CONFIG_PPC_PSERIES
@@ -81,6 +87,9 @@ enum {#ifdef CONFIG_PPC_PS3 FW_FEATURE_PS3_ALWAYS &#endif +#ifdef CONFIG_PPC_NATIVE +FW_FEATURE_NATIVE_ALWAYS & +#endif FW_FEATURE_POSSIBLE, #else /* CONFIG_PPC64 */
arch/powerpc/Kconfig +21 -5
@@ -390,6 +390,7 @@ config PPC_PSERIES select PPC_RTAS select RTAS_ERROR_LOGGING select PPC_UDBG_16550 + select PPC_NATIVE default y config PPC_ISERIES
@@ -406,6 +407,7 @@ config PPC_CHRP select PPC_RTAS select PPC_MPC106 select PPC_UDBG_16550 + select PPC_NATIVE default y config PPC_EFIKA
@@ -414,6 +416,7 @@ config PPC_EFIKA select PPC_RTAS select RTAS_PROC select PPC_MPC52xx + select PPC_NATIVE default y config PPC_PMAC
@@ -422,6 +425,7 @@ config PPC_PMAC select MPIC select PPC_INDIRECT_PCI if PPC32 select PPC_MPC106 if PPC32 + select PPC_NATIVE default y config PPC_PMAC64
@@ -441,6 +445,7 @@ config PPC_PREP select PPC_I8259 select PPC_INDIRECT_PCI select PPC_UDBG_16550 + select PPC_NATIVE default y config PPC_MAPLE
@@ -452,6 +457,7 @@ config PPC_MAPLE select GENERIC_TBSYNC select PPC_UDBG_16550 select PPC_970_NAP + select PPC_NATIVE default n help This option enables support for the Maple 970FX Evaluation Board.
@@ -464,6 +470,7 @@ config PPC_PASEMI select MPIC select PPC_UDBG_16550 select GENERIC_TBSYNC + select PPC_NATIVE help This option enables support for PA Semi's PWRficient line of SoC processors, including PA6T-1682M
@@ -478,6 +485,7 @@ config PPC_CELL_NATIVE select PPC_DCR_MMIO select PPC_OF_PLATFORM_PCI select PPC_INDIRECT_IO + select PPC_NATIVE select MPIC default n
@@ -490,11 +498,6 @@ config PPC_IBM_CELL_BLADE select PPC_UDBG_16550 select UDBG_RTAS_CONSOLE -config UDBG_RTAS_CONSOLE - bool "RTAS based debug console" - depends on PPC_RTAS - default n - config PPC_PS3 bool "Sony PS3" depends on PPC_MULTIPLATFORM && PPC64
@@ -503,6 +506,19 @@ config PPC_PS3 This option enables support for the Sony PS3 game console and other platforms using the PS3 hypervisor. +config PPC_NATIVE + bool + depends on PPC_MULTIPLATFORM + help + Support for running natively on the hardware, i.e. without + a hypervisor. This option is not user-selectable but should + be selected by all platforms that need it. + +config UDBG_RTAS_CONSOLE + bool "RTAS based debug console" + depends on PPC_RTAS + default n + config XICS depends on PPC_PSERIES bool
arch/powerpc/platforms/ps3/mm.c +4 -0
@@ -22,6 +22,7 @@#include <linux/module.h> #include <linux/memory_hotplug.h> +#include <asm/firmware.h> #include <asm/lmb.h> #include <asm/udbg.h> #include <asm/ps3.h>
@@ -293,6 +294,9 @@ static int __init ps3_mm_add_memory(voidunsigned long start_pfn;unsigned long nr_pages; +if (!firmware_has_feature (FW_FEATURE_PS3_LV1 )) +return 0 ; +BUG_ON (!mem_init_done); start_addr =USE_LPAR_ADDR ? map.r1.base : map.rm.size;
arch/powerpc/platforms/ps3/setup.c +1 -1
@@ -108,7 +108,7 @@ static int __init ps3_probe(void)if (!of_flat_dt_is_compatible (dt_root,"PS3" ))return 0 ; - powerpc_firmware_features |=FW_FEATURE_LPAR ; + powerpc_firmware_features |=FW_FEATURE_PS3_POSSIBLE ;ps3_os_area_init ();ps3_mm_init ();
drivers/ps3/system-bus.c +4 -0
@@ -27,6 +27,7 @@#include <asm/udbg.h> #include <asm/ps3.h> #include <asm/lv1call.h> +#include <asm/firmware.h> #define dump_mmio_region (_a) _dump_mmio_region(_a, __func__, __LINE__) static void _dump_mmio_region(const struct ps3_mmio_region* r,
@@ -167,6 +168,9 @@ int __init ps3_system_bus_init(void) {int result; +if (!firmware_has_feature (FW_FEATURE_PS3_LV1 )) +return 0 ; + result =bus_register (&ps3_system_bus_type);BUG_ON (result);return result;
arch/powerpc/oprofile/Makefile +1 -1
@@ -11,7 +11,7 @@ DRIVER_OBJS := $(addprefix ../../../driv timer_int.o ) oprofile-y := $(DRIVER_OBJS) common.o backtrace.o -oprofile-$(CONFIG_PPC_CELL) += op_model_cell.o +oprofile-$(CONFIG_PPC_CELL_NATIVE) += op_model_cell.o oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o oprofile-$(CONFIG_6xx) += op_model_7450.o
arch/powerpc/oprofile/common.c +1 -1
@@ -147,7 +147,7 @@ int __init oprofile_arch_init(struct oprswitch (cur_cpu_spec->oprofile_type) {#ifdef CONFIG_PPC64 -#ifdef CONFIG_PPC_CELL +#ifdef CONFIG_PPC_CELL_NATIVE case PPC_OPROFILE_CELL : model = &op_model_cell;break ;
arch/powerpc/mm/Makefile +1 -1
@@ -8,7 +8,7 @@ endif obj-y := fault.o mem.o lmb.o obj-$(CONFIG_PPC32) += init_32.o pgtable_32.o mmu_context_32.o -hash-$(CONFIG_PPC_MULTIPLATFORM) := hash_native_64.o +hash-$(CONFIG_PPC_NATIVE) := hash_native_64.o obj-$(CONFIG_PPC64) += init_64.o pgtable_64.o mmu_context_64.o \ hash_utils_64.o hash_low_64.o tlb_64.o \ slb_low.o slb.o stab.o mmap.o imalloc.o \
--
Re: [Cbe-oss-dev] [POWERPC 6/9] ps3: multiplatform build fixes
Quoted 12 lines · Arnd Bergmann
A few code paths need to check whether or not they are running on the PS3's LV1 hypervisor before making hcalls. This introduces a new firmware feature bit for this,
FW_FEATURE_PS3_LV1.Now when both PS3 and
IBM_CELL_BLADEare enabled, but not PSERIES,FW_FEATURE_PS3_LV1andFW_FEATURE_LPARget enabled at compile time, which is a bug. The same problem can also happen for (PPC_ISERIES&& !PPC_PSERIES &&PPC_SOMETHING_ELSE). In order to solve this, I introduce a newCONFIG_PPC_NATIVEoption that is set when at least one platform is selected that can run without a hypervisor and then turns the firmware feature check into a run-time option.
Quoted 6 lines
The new cell oprofile support that was recently merged does not work on hypervisor based platforms like the PS3, therefore make it depend on
PPC_CELL_NATIVEinstead ofPPC_CELL. This may change if we get oprofile support for PS3.Signed-off-by Arnd Bergmann <[email protected]>
PATCH 7/9 ps3: add a default zImage target
In reply to Arnd BergmannIt's currently not possible to build the default zImage target if PS3 is the only selected platform. This is a hack to fall back to building the pseries style zImage, so the build is successful. This will probably change in the future, if someone writes a PS3 specific boot wrapper.
arch/powerpc/boot/Makefile +1 -0
@@ -155,6 +155,7 @@ $(obj)/uImage: vmlinux $(wrapperbits) image-$(CONFIG_PPC_PSERIES) += zImage.pseries image-$(CONFIG_PPC_MAPLE) += zImage.pseries image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries +image-$(CONFIG_PPC_PS3) += zImage.pseries image-$(CONFIG_PPC_CHRP) += zImage.chrp image-$(CONFIG_PPC_PMAC) += zImage.pmac image-$(CONFIG_DEFAULT_UIMAGE) += uImage
--
Re: [POWERPC 7/9] ps3: add a default zImage target
Quoted 13 lines · Arnd Bergmann
It's currently not possible to build the default zImage target if PS3 is the only selected platform. This is a hack to fall back to building the pseries style zImage, so the build is successful. This will probably change in the future, if someone writes a PS3 specific boot wrapper.
Signed-off-by Arnd Bergmann <[email protected]>Index: linux-2.6/arch/powerpc/boot/Makefile
===================================================================
arch/powerpc/boot/Makefile $(obj)/uImage: vmlinux $(wrapperbits) · line 161
Quoted 7 lines
arch/powerpc/boot/Makefile +1
-0@@ -155,6 +155,7 @@ $(obj)/uImage: vmlinux $(wrapperbits) image-$(CONFIG_PPC_PSERIES) += zImage.pseries image-$(CONFIG_PPC_MAPLE) += zImage.pseries image-$(CONFIG_PPC_IBM_CELL_BLADE) += zImage.pseries +image-$(CONFIG_PPC_PS3) += zImage.pseries image-$(CONFIG_PPC_CHRP) += zImage.chrp image-$(CONFIG_PPC_PMAC) += zImage.pmac image-$(CONFIG_DEFAULT_UIMAGE) += uImage
A better solution here is to make image-$(CONFIG_PPC_PS3) a stripped vmlinux, which the current PS3 bootloader (2.6.16 kboot) will be able to load.
I'll set that up and send out a new patch.
I started work on that zImage bootwrapper, but I have other items I'm tring to finish up.
-Geoff
PATCH 8/9 fix missing #include in sys_ppc32.c
In reply to Arnd Bergmannsys_mmap is declared in asm/syscalls.h
arch/powerpc/kernel/sys_ppc32.c +1 -0
@@ -51,6 +51,7 @@#include <asm/time.h> #include <asm/mmu_context.h> #include <asm/ppc-pci.h> +#include <asm/syscalls.h> /* readdir & getdents */ #define NAME_OFFSET (de) ((int) ((de)->d_name - (char __user *) (de)))
--
PATCH 9/9 fix building without PCI
In reply to Arnd BergmannAt least the ide driver calls pcibus_to_node, which is not defined when CONFIG_PCI is disabled. This adds a nop function for the !PCI case.
include/asm-powerpc/topology.h +7 -0
@@ -32,7 +32,14 @@ static inline int node_to_first_cpu(intint of_node_to_nid (struct device_node *device);struct pci_bus ; +#ifdef CONFIG_PCI extern int pcibus_to_node (struct pci_bus *bus); +#else +static inline int pcibus_to_node (struct pci_bus *bus) +{ +return -1 ; +} +#endif #define pcibus_to_cpumask (bus) (pcibus_to_node(bus) == -1 ? \ CPU_MASK_ALL : \
--