[PATCH 2/7] spufs: switchable spu contexts

Arnd Bergmann arnd at arndb.de
Fri Aug 26 08:04:11 EST 2005


Add some infrastructure for saving and restoring the context of an
SPE. This patch creates a new structure that can hold the whole
state of a physical SPE in memory. It also contains code that
avoids races during the context switch and the binary code that
is loaded to the SPU in order to access its registers.

The actual PPE- and SPE-side context switch code are two separate
patches.

From: Mark Nutter <mnutter at us.ibm.com>
Signed-off-by: Arnd Bergmann <arndb at de.ibm.com>

--

 arch/ppc64/kernel/spu_base.c        |   27 ++
 fs/spufs/Makefile                   |    4 
 fs/spufs/context.c                  |   18 +
 fs/spufs/spu_restore_dump.h_shipped |  342 ++++++++++++++++++++++++++++++++++++
 fs/spufs/spu_save_dump.h_shipped    |  290 ++++++++++++++++++++++++++++++
 fs/spufs/spufs.h                    |    2 
 fs/spufs/switch.c                   |  174 ++++++++++++++++++
 include/asm-ppc64/spu.h             |   76 ++++++++
 include/asm-ppc64/spu_csa.h         |  256 ++++++++++++++++++++++++++
 9 files changed, 1185 insertions(+), 4 deletions(-)

diff -urN linux-2.6.13-rc6.fix/arch/ppc64/kernel/spu_base.c linux-2.6.13-rc6/arch/ppc64/kernel/spu_base.c
--- linux-2.6.13-rc6.fix/arch/ppc64/kernel/spu_base.c	2005-08-23 00:25:53.201118036 +0200
+++ linux-2.6.13-rc6/arch/ppc64/kernel/spu_base.c	2005-08-23 00:21:50.242294578 +0200
@@ -62,7 +62,9 @@
 static void spu_restart_dma(struct spu *spu)
 {
 	struct spu_priv2 __iomem *priv2 = spu->priv2;
-	out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND);
+
+	if (!test_bit(SPU_CONTEXT_SWITCH_PENDING_nr, &spu->flags))
+		out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND);
 }
 
 static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
@@ -72,6 +74,11 @@
 
 	pr_debug("%s\n", __FUNCTION__);
 
+	if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags)) {
+		printk("%s: invalid access during switch!\n", __func__);
+		return 1;
+	}
+
 	if (REGION_ID(ea) != USER_REGION_ID) {
 		pr_debug("invalid region access at %016lx\n", ea);
 		return 1;
@@ -98,6 +105,7 @@
 	return 0;
 }	
 
+extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX
 static int __spu_trap_data_map(struct spu *spu, unsigned long ea)
 {
 	unsigned long dsisr;
@@ -107,8 +115,21 @@
 	priv1 = spu->priv1;
 	dsisr = in_be64(&priv1->mfc_dsisr_RW);
 
-	wake_up(&spu->stop_wq);
+	/* Handle kernel space hash faults immediately.
+	   User hash faults need to be deferred to process context. */
+	if ((dsisr & MFC_DSISR_PTE_NOT_FOUND)
+	    && REGION_ID(ea) != USER_REGION_ID
+	    && hash_page(ea, _PAGE_PRESENT, 0x300) == 0) {
+		spu_restart_dma(spu);
+		return 0;
+	}
+
+	if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags)) {
+		printk("%s: invalid access during switch!\n", __func__);
+		return 1;
+	}
 
+	wake_up(&spu->stop_wq);
 	return 0;
 }
 
@@ -378,7 +399,6 @@
 }
 EXPORT_SYMBOL(spu_free);
 
-extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX
 static int spu_handle_mm_fault(struct spu *spu)
 {
 	struct spu_priv1 __iomem *priv1;
@@ -646,6 +666,7 @@
 	spu->slb_replace = 0;
 	spu->mm = NULL;
 	spu->class_0_pending = 0;
+	spu->flags = 0UL;
 	spin_lock_init(&spu->register_lock);
 
 	out_be64(&spu->priv1->mfc_sdr_RW, mfspr(SPRN_SDR1));
diff -urN linux-2.6.13-rc6.fix/fs/spufs/Makefile linux-2.6.13-rc6/fs/spufs/Makefile
--- linux-2.6.13-rc6.fix/fs/spufs/Makefile	2005-08-22 23:47:52.087135000 +0200
+++ linux-2.6.13-rc6/fs/spufs/Makefile	2005-08-22 23:50:30.742186383 +0200
@@ -1,3 +1,5 @@
 obj-$(CONFIG_SPU_FS) += spufs.o
 
-spufs-y += inode.o file.o context.o
+spufs-y += inode.o file.o context.o switch.o
+
+$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h
diff -urN linux-2.6.13-rc6.fix/fs/spufs/context.c linux-2.6.13-rc6/fs/spufs/context.c
--- linux-2.6.13-rc6.fix/fs/spufs/context.c	2005-08-22 23:47:52.088135000 +0200
+++ linux-2.6.13-rc6/fs/spufs/context.c	2005-08-22 23:50:30.743186743 +0200
@@ -22,6 +22,7 @@
 
 #include <linux/slab.h>
 #include <asm/spu.h>
+#include <asm/spu_csa.h>
 #include "spufs.h"
 
 struct spu_context *alloc_spu_context(void)
@@ -30,9 +31,25 @@
 	ctx = kmalloc(sizeof *ctx, GFP_KERNEL);
 	if (!ctx)
 		goto out;
+	/* Future enhancement: do not call spu_alloc()
+	 * here.  This step should be deferred until
+	 * spu_run()!!
+	 *
+	 * More work needs to be done to read(),
+	 * write(), mmap(), etc., so that operations
+	 * are performed on CSA when the context is
+	 * not currently being run.  In this way we
+	 * can support arbitrarily large number of
+	 * entries in /spu, allow state queries, etc.
+	 */
 	ctx->spu = spu_alloc();
 	if (!ctx->spu)
 		goto out_free;
+	spu_init_csa(&ctx->csa);
+	if (!ctx->csa.lscsa) {
+		spu_free(ctx->spu);
+		goto out_free;
+	}
 	init_rwsem(&ctx->backing_sema);
 	spin_lock_init(&ctx->mmio_lock);
 	kref_init(&ctx->kref);
@@ -50,6 +67,7 @@
 	ctx = container_of(kref, struct spu_context, kref);
 	if (ctx->spu)
 		spu_free(ctx->spu);
+	spu_fini_csa(&ctx->csa);
 	kfree(ctx);
 }
 
diff -urN linux-2.6.13-rc6.fix/fs/spufs/spu_restore_dump.h_shipped linux-2.6.13-rc6/fs/spufs/spu_restore_dump.h_shipped
--- linux-2.6.13-rc6.fix/fs/spufs/spu_restore_dump.h_shipped	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13-rc6/fs/spufs/spu_restore_dump.h_shipped	2005-08-22 23:50:30.750189261 +0200
@@ -0,0 +1,342 @@
+/* spu_restore_dump.h: Copyright (C) 2005 IBM.
+ * Hex-dump auto generated from spu_restore.c.
+ * Do not edit!
+ */
+static unsigned int spu_restore_code[] __page_aligned = {
+0x40800000, 0x409ff801, 0x24000080, 0x24fd8081,
+0x1cd80081, 0x33009d80, 0x42054003, 0x33800284,
+0x1c010204, 0x40200000, 0x40200000, 0x40200000,
+0x34000190, 0x34004191, 0x34008192, 0x3400c193,
+0x141fc205, 0x23fffd84, 0x1c100183, 0x217ffa85,
+0x30813000, 0x30813201, 0x30813402, 0x30813603,
+0x30813804, 0x30813a05, 0x30813c06, 0x30813e07,
+0x30814008, 0x30814209, 0x3081440a, 0x3081460b,
+0x3081480c, 0x30814a0d, 0x30814c0e, 0x30814e0f,
+0x00003ffc, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x420a4002, 0x3f8101b8, 0x40a00003, 0x00200000,
+0x1c010104, 0x34000107, 0x40800018, 0x3ec00108,
+0x40a48005, 0x3ec00212, 0x40800436, 0x3ec20122,
+0x18015c13, 0x3ec20232, 0x42448006, 0x3ec6010b,
+0x40800805, 0xb141c188, 0x18019c31, 0x3ec40106,
+0x42648009, 0x3ec40208, 0x40800c07, 0x3ec6020d,
+0x18025c09, 0x2886010a, 0x4284800c, 0x34000215,
+0x4080100a, 0x3ec8010e, 0x18031c0c, 0x3ec80210,
+0x42a48011, 0x3ecc0116, 0x4080140f, 0x3ece011b,
+0x18045c11, 0x3ece021d, 0x42c48014, 0xb3454992,
+0x40801812, 0x3eca0113, 0x18051c14, 0x3eca0215,
+0x42e48019, 0x00200000, 0x40801c17, 0x2886021a,
+0x18065c18, 0x388d8123, 0x4304801c, 0x3ecc0219,
+0x4080201a, 0x18071c1c, 0x43248021, 0x3ac6811e,
+0x4080241f, 0x3ac68220, 0x18085c21, 0xb4c8c1a2,
+0x43448025, 0x3ac7c122, 0x40802823, 0x3ac7c224,
+0x18095c25, 0x00200000, 0x43648027, 0x288d8126,
+0x40802c26, 0x388d8233, 0x1809dc27, 0x3ac8c128,
+0x4384802c, 0x3ac8c229, 0x4080302a, 0x3ac9812b,
+0x180b1c2c, 0x3ac9822d, 0x43a48030, 0x3aca812e,
+0x4080342f, 0xb6ecd8b2, 0x180c1c30, 0x3aca8231,
+0x43c48035, 0x3acbc132, 0x40803833, 0x3acbc234,
+0x180d5c35, 0x288d8237, 0x43e48037, 0x34004136,
+0x40200001, 0x3accc139, 0x180ddc37, 0x3accc238,
+0xb0cd8186, 0x28814106, 0x34004206, 0xb0c18488,
+0x28814206, 0x3881c105, 0xb0a1418b, 0x2881c105,
+0x3881c205, 0xb0a1460d, 0x2881c205, 0x34008105,
+0xb0a1418e, 0x28828105, 0x34008205, 0xb0a14890,
+0x28828205, 0x3883c105, 0xb0a14193, 0x2883c105,
+0x3883c205, 0xb0a14a15, 0x2883c205, 0x3400c105,
+0xb0a14196, 0x28848105, 0x3400c205, 0xb0a14c19,
+0x28848205, 0x3885c105, 0xb0a1419b, 0x2885c105,
+0x3885c205, 0xb0a14e1d, 0x2885c205, 0x34010105,
+0xb0a1419e, 0x28868105, 0x34010205, 0xb0a150a0,
+0x28868205, 0x3887c105, 0xb0a141a2, 0x2887c105,
+0x3887c205, 0xb0a152a4, 0x2887c205, 0x34014105,
+0xb0a141a8, 0x2888c105, 0x34014205, 0x3580001c,
+0xb0a153a9, 0x2888c205, 0x38898105, 0xb0a141ab,
+0x28898105, 0x38898205, 0xb0a1562d, 0x28898205,
+0x34018105, 0xb0a141ae, 0x288a8105, 0x34018205,
+0xb0a15831, 0x288a8205, 0x388bc105, 0xb0a141b2,
+0x288bc105, 0x388bc205, 0xb0a15ab4, 0x288bc205,
+0x3401c105, 0xb06141b9, 0x288cc103, 0x3401c202,
+0xb0409bb8, 0x288cc202, 0x4020003a, 0x35000000,
+0x40800002, 0x40804004, 0x40805a05, 0x21a00802,
+0x21a00883, 0x3f810183, 0x21a00903, 0x21a00984,
+0x21a00a02, 0x21a00a85, 0x40200001, 0x3580000a,
+0x40200006, 0x00200000, 0x40200007, 0x00200000,
+0x40200008, 0x00200000, 0x40200009, 0x00200000,
+0x4020000a, 0x35000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x4204c002, 0x40848004, 0x40800005, 0x00200000,
+0x40802006, 0x21a00802, 0x21a00883, 0x3f810182,
+0x21a00902, 0x21a00984, 0x21a00a05, 0x21a00a86,
+0x40200001, 0x3580000a, 0x40200007, 0x00200000,
+0x40200008, 0x00200000, 0x40200009, 0x00200000,
+0x4020000a, 0x00200000, 0x4020000b, 0x35000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x40a00002, 0x420a4004, 0x40803c05, 0x40800006,
+0x40802207, 0x21a00802, 0x21a00883, 0x21a00904,
+0x21a00985, 0x21a00a06, 0x21a00a87, 0x3580000a,
+0x40200001, 0x00200000, 0x40200008, 0x00200000,
+0x40200009, 0x00200000, 0x4020000a, 0x00200000,
+0x4020000b, 0x35000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x24004080, 0x24fd0081, 0x1cd00081, 0x01a00182,
+0x34028083, 0x3ec00084, 0xb040c104, 0x01a00203,
+0x4020000f, 0x127fdb89, 0x40200010, 0x3ec10084,
+0x40200011, 0x00200000, 0x40200012, 0x00200000,
+0xb7408184, 0x082e9d03, 0x337fd700, 0x40800002,
+0x408000bb, 0x21a00082, 0x21a00b3b, 0x127f6c8a,
+0x40200013, 0x00200000, 0x40200014, 0x00200000,
+0x40200015, 0x00200000, 0x40200016, 0x00200000,
+0x40200017, 0x337f6780, 0x082e9d03, 0x127fde8a,
+0x40200018, 0x00200000, 0x40200019, 0x00200000,
+0x4020001a, 0x00200000, 0x4020001b, 0x00200000,
+0x4020001c, 0x337fd980, 0x4204c006, 0x30823402,
+0x3b818102, 0x20000202, 0x30823202, 0x3b818102,
+0x21a00382, 0x127fb589, 0x4020001d, 0x00200000,
+0x4020001e, 0x00200000, 0x4020001f, 0x00200000,
+0x40200020, 0x00200000, 0x337fb100, 0x21a00bbb,
+0x01a00c02, 0x01a00d82, 0x30823602, 0x3b818102,
+0x21a00e02, 0x30823802, 0x3b818102, 0x21a00f02,
+0x30823e02, 0x30823003, 0x3b818102, 0x774001a1,
+0x21a00702, 0x30823c02, 0x3b818102, 0x21a00082,
+0x30823a02, 0x3b818103, 0x40844002, 0x00200000,
+0x18008302, 0x21a00b03, 0x40844203, 0x00200000,
+0x4200480e, 0x34000104, 0x1800c303, 0x34000185,
+0x3b808204, 0x3b80c282, 0x1cffc203, 0x5c020184,
+0x21005504, 0x0f610183, 0x42094004, 0x3880c203,
+0x3b810183, 0x3580018a, 0x40200022, 0x00200000,
+0x40200023, 0x00200000, 0x40200024, 0x00200000,
+0x40200025, 0x00200000, 0x40200026, 0x35000180,
+0x409ffe03, 0x34000704, 0x1c010705, 0x3ec00706,
+0x41004007, 0x3ec10708, 0x1c020709, 0x1200498a,
+0x3ec2070a, 0xb0610186, 0x24000703, 0x34000283,
+0xb060c388, 0x24000283, 0x34000483, 0xb040c10a,
+0x24000482, 0x32004480, 0x409ffe03, 0x34000704,
+0x1c010705, 0x3ec00706, 0x413d8007, 0x3ec10708,
+0x1c020709, 0x1200408a, 0x3ec2070a, 0xb0610186,
+0x24000703, 0x34000283, 0xb060c388, 0x24000283,
+0x34000483, 0xb040c10a, 0x24000482, 0x32003b80,
+0x409ffe03, 0x34000704, 0x1c010705, 0x3ec00706,
+0x1c020707, 0x3ec10708, 0x41201009, 0x3ec2070a,
+0x1c03070b, 0x12003690, 0x41193f8d, 0x3ec3070c,
+0xb0610186, 0x60ffc00d, 0x24000703, 0x34000283,
+0xb040c108, 0x24000282, 0x34000382, 0xb040848a,
+0x24000382, 0x34000582, 0xb040868c, 0x24000582,
+0x40200027, 0x32002e80, 0x409ffe02, 0x34000703,
+0x1c010704, 0x3ec00705, 0x41004006, 0x3ec10707,
+0x1c020708, 0x3ec20709, 0x4120100a, 0x12002990,
+0x1c03070c, 0x3ec3070b, 0x41193f8d, 0xb040c105,
+0x60ffc00d, 0x24000702, 0x34000202, 0xb0408307,
+0x24000202, 0x34000402, 0xb0408509, 0x24000402,
+0x34000602, 0xb040868b, 0x24000602, 0x32002180,
+0x409ffe02, 0x34000703, 0x1c010704, 0x3ec00705,
+0x413d8006, 0x3ec10707, 0x1c020708, 0x3ec20709,
+0x4120100a, 0x12001c90, 0x1c03070c, 0x3ec3070b,
+0x41193f8d, 0xb040c105, 0x60ffc00d, 0x24000702,
+0x34000202, 0xb0408307, 0x24000202, 0x34000402,
+0xb0408509, 0x24000402, 0x34000602, 0xb040868b,
+0x24000602, 0x32001480, 0x409ffe03, 0x30801204,
+0x1c010705, 0x3ec00706, 0x40200028, 0x1200118a,
+0x40200029, 0x3ec10707, 0x4020002a, 0xb0610186,
+0x20801203, 0x34000283, 0xb040c107, 0x24000282,
+0x4020002b, 0x32000c80, 0x409ffe02, 0x34000703,
+0x1c010704, 0x3ec00705, 0x41201006, 0x3ec10707,
+0x1c020708, 0x3ec20709, 0x1c03070a, 0x3ec3070b,
+0x41193f8c, 0xb040c105, 0x60ffc00c, 0x24000702,
+0x34000202, 0xb0408307, 0x24000202, 0x34000402,
+0xb0408309, 0x24000402, 0x34000502, 0xb040860b,
+0x4020002c, 0x24000502, 0x40800003, 0x00400000,
+0x1c300081, 0x34004080, 0x4020002d, 0x3580000a,
+0x4020002e, 0x00200000, 0x4020002f, 0x00200000,
+0x40200030, 0x00200000, 0x40200031, 0x00200000,
+0x40200032, 0x35000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000888, 0x00000000, 0x00000000, 0x00000000,
+0x000007b8, 0x00000000, 0x00000000, 0x00000000,
+0x00000820, 0x00000000, 0x00000000, 0x00000000,
+0x000008c8, 0x00000000, 0x00000000, 0x00000000,
+0x000007b8, 0x00000000, 0x00000000, 0x00000000,
+0x00000750, 0x00000000, 0x00000000, 0x00000000,
+0x00000708, 0x00000000, 0x00000000, 0x00000000,
+0x000006c0, 0x00000000, 0x00000000, 0x00000000,
+0x000008c8, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x72657475, 0x726e2063, 0x6f64653a, 0x2025640a,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
diff -urN linux-2.6.13-rc6.fix/fs/spufs/spu_save_dump.h_shipped linux-2.6.13-rc6/fs/spufs/spu_save_dump.h_shipped
--- linux-2.6.13-rc6.fix/fs/spufs/spu_save_dump.h_shipped	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13-rc6/fs/spufs/spu_save_dump.h_shipped	2005-08-22 23:50:30.753190340 +0200
@@ -0,0 +1,290 @@
+/* spu_save_dump.h: Copyright (C) 2005 IBM.
+ * Hex-dump auto generated from spu_save.c.
+ * Do not edit!
+ */
+static unsigned int spu_save_code[] __page_aligned = {
+0x2080f000, 0x2080f201, 0x2080f402, 0x2080f603,
+0x2080f804, 0x2080fa05, 0x2080fc06, 0x2080fe07,
+0x20810008, 0x20810209, 0x2081040a, 0x2081060b,
+0x2081080c, 0x20810a0d, 0x20810c0e, 0x20810e0f,
+0x42044003, 0x33800184, 0x1c010204, 0x40200000,
+0x24000190, 0x24004191, 0x24008192, 0x2400c193,
+0x141fc205, 0x23fffd84, 0x1c100183, 0x217ffb85,
+0x40800000, 0x409ff801, 0x24000080, 0x24fd8081,
+0x1cd80081, 0x33009780, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x4208c002, 0x3f8101b8, 0x40a00003, 0x00200000,
+0x1c010104, 0x34000107, 0x40800018, 0x3ec00108,
+0x40a48005, 0x3ec00212, 0x40800436, 0x3ec20122,
+0x18015c13, 0x3ec20232, 0x42448006, 0x3ec6010b,
+0x40800805, 0xb141c188, 0x18019c31, 0x3ec40106,
+0x42648009, 0x3ec40208, 0x40800c07, 0x3ec6020d,
+0x18025c09, 0x2886010a, 0x4284800c, 0x34000215,
+0x4080100a, 0x3ec8010e, 0x18031c0c, 0x3ec80210,
+0x42a48011, 0x3ecc0116, 0x4080140f, 0x3ece011b,
+0x18045c11, 0x3ece021d, 0x42c48014, 0xb3454992,
+0x40801812, 0x3eca0113, 0x18051c14, 0x3eca0215,
+0x42e48019, 0x00200000, 0x40801c17, 0x2886021a,
+0x18065c18, 0x388d8123, 0x4304801c, 0x3ecc0219,
+0x4080201a, 0x18071c1c, 0x43248021, 0x3ac6811e,
+0x4080241f, 0x3ac68220, 0x18085c21, 0xb4c8c1a2,
+0x43448025, 0x3ac7c122, 0x40802823, 0x3ac7c224,
+0x18095c25, 0x00200000, 0x43648027, 0x288d8126,
+0x40802c26, 0x388d8233, 0x1809dc27, 0x3ac8c128,
+0x4384802c, 0x3ac8c229, 0x4080302a, 0x3ac9812b,
+0x180b1c2c, 0x3ac9822d, 0x43a48030, 0x3aca812e,
+0x4080342f, 0xb6ecd8b2, 0x180c1c30, 0x3aca8231,
+0x43c48035, 0x3acbc132, 0x40803833, 0x3acbc234,
+0x180d5c35, 0x288d8237, 0x43e48037, 0x34004136,
+0x40200001, 0x3accc139, 0x180ddc37, 0x3accc238,
+0xb0cd8186, 0x28814106, 0x34004206, 0xb0c18488,
+0x28814206, 0x3881c105, 0xb0a1418b, 0x2881c105,
+0x3881c205, 0xb0a1460d, 0x2881c205, 0x34008105,
+0xb0a1418e, 0x28828105, 0x34008205, 0xb0a14890,
+0x28828205, 0x3883c105, 0xb0a14193, 0x2883c105,
+0x3883c205, 0xb0a14a15, 0x2883c205, 0x3400c105,
+0xb0a14196, 0x28848105, 0x3400c205, 0xb0a14c19,
+0x28848205, 0x3885c105, 0xb0a1419b, 0x2885c105,
+0x3885c205, 0xb0a14e1d, 0x2885c205, 0x34010105,
+0xb0a1419e, 0x28868105, 0x34010205, 0xb0a150a0,
+0x28868205, 0x3887c105, 0xb0a141a2, 0x2887c105,
+0x3887c205, 0xb0a152a4, 0x2887c205, 0x34014105,
+0xb0a141a8, 0x2888c105, 0x34014205, 0x3580001c,
+0xb0a153a9, 0x2888c205, 0x38898105, 0xb0a141ab,
+0x28898105, 0x38898205, 0xb0a1562d, 0x28898205,
+0x34018105, 0xb0a141ae, 0x288a8105, 0x34018205,
+0xb0a15831, 0x288a8205, 0x388bc105, 0xb0a141b2,
+0x288bc105, 0x388bc205, 0xb0a15ab4, 0x288bc205,
+0x3401c105, 0xb06141b9, 0x288cc103, 0x3401c202,
+0xb0409bb8, 0x288cc202, 0x4020003a, 0x35000000,
+0x40800002, 0x40804004, 0x40805a05, 0x21a00802,
+0x21a00883, 0x3f810183, 0x21a00903, 0x21a00984,
+0x21a00a02, 0x21a00a85, 0x40200001, 0x3580000a,
+0x40200006, 0x00200000, 0x40200007, 0x00200000,
+0x40200008, 0x00200000, 0x40200009, 0x00200000,
+0x4020000a, 0x35000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x40a00002, 0x4208c004, 0x40803c05, 0x40800006,
+0x40801207, 0x21a00802, 0x21a00883, 0x21a00904,
+0x21a00985, 0x21a00a06, 0x21a00a87, 0x3580000a,
+0x40200001, 0x00200000, 0x40200008, 0x00200000,
+0x40200009, 0x00200000, 0x4020000a, 0x00200000,
+0x4020000b, 0x35000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x4203c002, 0x40848004, 0x40800005, 0x00200000,
+0x40801006, 0x21a00802, 0x21a00883, 0x3f810182,
+0x21a00902, 0x21a00984, 0x21a00a05, 0x21a00a86,
+0x40200001, 0x3580000a, 0x40200007, 0x00200000,
+0x40200008, 0x00200000, 0x40200009, 0x00200000,
+0x4020000a, 0x00200000, 0x4020000b, 0x35000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x40800002, 0x40806603, 0x21a00a02, 0x21a00a83,
+0x40200001, 0x3580000a, 0x40200004, 0x00200000,
+0x40200005, 0x00200000, 0x40200006, 0x00200000,
+0x40200007, 0x00200000, 0x40200008, 0x35000000,
+0x24004080, 0x24fd0081, 0x1cd00081, 0x01a00182,
+0x34028083, 0x3ec00084, 0xb040c104, 0x01a00203,
+0x40843005, 0x3ec10084, 0xb7408184, 0x01a00582,
+0x4203c03b, 0x40842806, 0x34219d83, 0x3ac15d84,
+0xb040c104, 0x28815d82, 0x40200007, 0x01a00603,
+0x40800002, 0x34215d84, 0x408000bc, 0x3ac19d85,
+0xb0610185, 0x28819d83, 0x082e9d03, 0x21a00082,
+0x21a00b3c, 0x127f618a, 0x40200008, 0x00200000,
+0x40200009, 0x00200000, 0x4020000a, 0x00200000,
+0x4020000b, 0x00200000, 0x4020000c, 0x337f5c80,
+0x082e9d03, 0x127fc389, 0x4020000d, 0x00200000,
+0x4020000e, 0x00200000, 0x4020000f, 0x00200000,
+0x40200010, 0x00200000, 0x337fbf00, 0x73000002,
+0x40840003, 0x40840805, 0x2880dd82, 0x01a00402,
+0x40843806, 0x34205d83, 0x3ac15d84, 0xb040c104,
+0x28815d82, 0x01a00782, 0x082e9d03, 0x3421dd84,
+0x3ac19d85, 0xb0410105, 0x28819d82, 0x127fa68a,
+0x40200011, 0x00200000, 0x40200012, 0x00200000,
+0x40200013, 0x00200000, 0x40200014, 0x00200000,
+0x40200015, 0x337fa180, 0x082e9d03, 0x127fc089,
+0x40200016, 0x00200000, 0x40200017, 0x00200000,
+0x40200018, 0x00200000, 0x40200019, 0x00200000,
+0x337fbc00, 0x127fcb89, 0x4020001a, 0x00200000,
+0x4020001b, 0x00200000, 0x4020001c, 0x00200000,
+0x4020001d, 0x00200000, 0x337fc700, 0x21a00bbc,
+0x01a00c02, 0x01a00d82, 0x40800003, 0x00003ffb,
+0x1c300081, 0x34004080, 0x4020001e, 0x3580000a,
+0x4020001f, 0x00200000, 0x40200020, 0x00200000,
+0x40200021, 0x00200000, 0x40200022, 0x00200000,
+0x40200023, 0x35000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x72657475, 0x726e2063, 0x6f64653a, 0x2025640a,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+0x00000000, 0x00000000, 0x00000000, 0x00000000,
+};
diff -urN linux-2.6.13-rc6.fix/fs/spufs/spufs.h linux-2.6.13-rc6/fs/spufs/spufs.h
--- linux-2.6.13-rc6.fix/fs/spufs/spufs.h	2005-08-22 23:47:52.095138000 +0200
+++ linux-2.6.13-rc6/fs/spufs/spufs.h	2005-08-22 23:50:30.754190699 +0200
@@ -28,6 +28,7 @@
 #include <linux/fs.h>
 
 #include <asm/spu.h>
+#include <asm/spu_csa.h>
 
 /* The magic number for our file system */
 enum {
@@ -36,6 +37,7 @@
 
 struct spu_context {
 	struct spu *spu;		  /* pointer to a physical SPU */
+	struct spu_state csa;		  /* SPU context save area. */
 	struct rw_semaphore backing_sema; /* protects the above */
 	spinlock_t mmio_lock;		  /* protects mmio access */
 
diff -urN linux-2.6.13-rc6.fix/fs/spufs/switch.c linux-2.6.13-rc6/fs/spufs/switch.c
--- linux-2.6.13-rc6.fix/fs/spufs/switch.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13-rc6/fs/spufs/switch.c	2005-08-22 23:50:40.591265801 +0200
@@ -0,0 +1,174 @@
+/*
+ * spu_switch.c
+ *
+ * (C) Copyright IBM Corp. 2005
+ *
+ * Author: Mark Nutter <mnutter at us.ibm.com>
+ *
+ * Host-side part of SPU context switch sequence outlined in
+ * Synergistic Processor Element, Book IV.
+ *
+ * A fully premptive switch of an SPE is very expensive in terms
+ * of time and system resources.  SPE Book IV indicates that SPE
+ * allocation should follow a "serially reusable device" model,
+ * in which the SPE is assigned a task until it completes.  When
+ * this is not possible, this sequence may be used to premptively
+ * save, and then later (optionally) restore the context of a
+ * program executing on an SPE.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/stddef.h>
+#include <linux/unistd.h>
+
+#include <asm/io.h>
+#include <asm/spu.h>
+#include <asm/spu_csa.h>
+#include <asm/mmu_context.h>
+
+#include "spu_save_dump.h"
+#include "spu_restore_dump.h"
+
+/**
+ * spu_save - SPU context save, with locking.
+ * @prev: pointer to SPU context save area, to be saved.
+ * @spu: pointer to SPU iomem structure.
+ *
+ * Acquire locks, perform the save operation then return.
+ */
+int spu_save(struct spu_state *prev, struct spu *spu)
+{
+	/* XXX missing */
+
+	return 0;
+}
+
+/**
+ * spu_restore - SPU context restore, with harvest and locking.
+ * @new: pointer to SPU context save area, to be restored.
+ * @spu: pointer to SPU iomem structure.
+ *
+ * Perform harvest + restore, as we may not be coming
+ * from a previous succesful save operation, and the
+ * hardware state is unknown.
+ */
+int spu_restore(struct spu_state *new, struct spu *spu)
+{
+	/* XXX missing */
+
+	return 0;
+}
+
+/**
+ * spu_switch - SPU context switch (save + restore).
+ * @prev: pointer to SPU context save area, to be saved.
+ * @new: pointer to SPU context save area, to be restored.
+ * @spu: pointer to SPU iomem structure.
+ *
+ * Perform save, then restore.  Only harvest if the
+ * save fails, as cleanup is otherwise not needed.
+ */
+int spu_switch(struct spu_state *prev, struct spu_state *new, struct spu *spu)
+{
+	/* XXX missing */
+
+	return 0;
+}
+
+static void init_prob(struct spu_state *csa)
+{
+	csa->spu_chnlcnt_RW[9] = 1;
+	csa->spu_chnlcnt_RW[21] = 16;
+	csa->spu_chnlcnt_RW[23] = 1;
+	csa->spu_chnlcnt_RW[28] = 1;
+	csa->spu_chnlcnt_RW[30] = 1;
+	csa->prob.spu_runcntl_RW = SPU_RUNCNTL_STOP;
+}
+
+static void init_priv1(struct spu_state *csa)
+{
+	/* Enable decode, relocate, tlbie response, master runcntl. */
+	csa->priv1.mfc_sr1_RW = MFC_STATE1_LOCAL_STORAGE_DECODE_MASK |
+	    MFC_STATE1_MASTER_RUN_CONTROL_MASK |
+	    MFC_STATE1_PROBLEM_STATE_MASK |
+	    MFC_STATE1_RELOCATE_MASK | MFC_STATE1_BUS_TLBIE_MASK;
+
+	/* Set storage description.  */
+	csa->priv1.mfc_sdr_RW = mfspr(SPRN_SDR1);
+
+	/* Enable OS-specific set of interrupts. */
+	csa->priv1.int_mask_class0_RW = CLASS0_ENABLE_DMA_ALIGNMENT_INTR |
+	    CLASS0_ENABLE_INVALID_DMA_COMMAND_INTR |
+	    CLASS0_ENABLE_SPU_ERROR_INTR;
+	csa->priv1.int_mask_class1_RW = CLASS1_ENABLE_SEGMENT_FAULT_INTR |
+	    CLASS1_ENABLE_STORAGE_FAULT_INTR;
+	csa->priv1.int_mask_class2_RW = CLASS2_ENABLE_MAILBOX_INTR |
+	    CLASS2_ENABLE_SPU_STOP_INTR | CLASS2_ENABLE_SPU_HALT_INTR;
+}
+
+static void init_priv2(struct spu_state *csa)
+{
+	csa->priv2.spu_lslr_RW = LS_ADDR_MASK;
+	csa->priv2.mfc_control_RW = MFC_CNTL_RESUME_DMA_QUEUE |
+	    MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION |
+	    MFC_CNTL_DMA_QUEUES_EMPTY_MASK;
+}
+
+/**
+ * spu_alloc_csa - allocate and initialize an SPU context save area.
+ *
+ * Allocate and initialize the contents of an SPU context save area.
+ * This includes enabling address translation, interrupt masks, etc.,
+ * as appropriate for the given OS environment.
+ *
+ * Note that storage for the 'lscsa' is allocated separately,
+ * as it is by far the largest of the context save regions,
+ * and may need to be pinned or otherwise specially aligned.
+ */
+void spu_init_csa(struct spu_state *csa)
+{
+	struct spu_lscsa *lscsa;
+
+	if (!csa)
+		return;
+	memset(csa, 0, sizeof(struct spu_state));
+
+	lscsa = vmalloc(sizeof(struct spu_lscsa));
+	if (!lscsa)
+		return;
+
+	memset(lscsa, 0, sizeof(struct spu_lscsa));
+	csa->lscsa = lscsa;
+
+	init_prob(csa);
+	init_priv1(csa);
+	init_priv2(csa);
+}
+
+void spu_fini_csa(struct spu_state *csa)
+{
+	vfree(csa->lscsa);
+}
diff -urN linux-2.6.13-rc6.fix/include/asm-ppc64/spu.h linux-2.6.13-rc6/include/asm-ppc64/spu.h
--- linux-2.6.13-rc6.fix/include/asm-ppc64/spu.h	2005-08-22 23:47:52.098139000 +0200
+++ linux-2.6.13-rc6/include/asm-ppc64/spu.h	2005-08-23 00:26:27.970341701 +0200
@@ -28,6 +28,81 @@
 #define LS_ORDER (6)		/* 256 kb */
 
 #define LS_SIZE (PAGE_SIZE << LS_ORDER)
+#define LS_ADDR_MASK (LS_SIZE - 1)
+
+#define MFC_PUT_CMD             0x20
+#define MFC_PUTS_CMD            0x28
+#define MFC_PUTR_CMD            0x30
+#define MFC_PUTF_CMD            0x22
+#define MFC_PUTB_CMD            0x21
+#define MFC_PUTFS_CMD           0x2A
+#define MFC_PUTBS_CMD           0x29
+#define MFC_PUTRF_CMD           0x32
+#define MFC_PUTRB_CMD           0x31
+#define MFC_PUTL_CMD            0x24
+#define MFC_PUTRL_CMD           0x34
+#define MFC_PUTLF_CMD           0x26
+#define MFC_PUTLB_CMD           0x25
+#define MFC_PUTRLF_CMD          0x36
+#define MFC_PUTRLB_CMD          0x35
+
+#define MFC_GET_CMD             0x40
+#define MFC_GETS_CMD            0x48
+#define MFC_GETF_CMD            0x42
+#define MFC_GETB_CMD            0x41
+#define MFC_GETFS_CMD           0x4A
+#define MFC_GETBS_CMD           0x49
+#define MFC_GETL_CMD            0x44
+#define MFC_GETLF_CMD           0x46
+#define MFC_GETLB_CMD           0x45
+
+#define MFC_SDCRT_CMD           0x80
+#define MFC_SDCRTST_CMD         0x81
+#define MFC_SDCRZ_CMD           0x89
+#define MFC_SDCRS_CMD           0x8D
+#define MFC_SDCRF_CMD           0x8F
+
+#define MFC_GETLLAR_CMD         0xD0
+#define MFC_PUTLLC_CMD          0xB4
+#define MFC_PUTLLUC_CMD         0xB0
+#define MFC_PUTQLLUC_CMD        0xB8
+#define MFC_SNDSIG_CMD          0xA0
+#define MFC_SNDSIGB_CMD         0xA1
+#define MFC_SNDSIGF_CMD         0xA2
+#define MFC_BARRIER_CMD         0xC0
+#define MFC_EIEIO_CMD           0xC8
+#define MFC_SYNC_CMD            0xCC
+
+#define MFC_MIN_DMA_SIZE_SHIFT  4       /* 16 bytes */
+#define MFC_MAX_DMA_SIZE_SHIFT  14      /* 16384 bytes */
+#define MFC_MIN_DMA_SIZE        (1 << MFC_MIN_DMA_SIZE_SHIFT)
+#define MFC_MAX_DMA_SIZE        (1 << MFC_MAX_DMA_SIZE_SHIFT)
+#define MFC_MIN_DMA_SIZE_MASK   (MFC_MIN_DMA_SIZE - 1)
+#define MFC_MAX_DMA_SIZE_MASK   (MFC_MAX_DMA_SIZE - 1)
+#define MFC_MIN_DMA_LIST_SIZE   0x0008  /*   8 bytes */
+#define MFC_MAX_DMA_LIST_SIZE   0x4000  /* 16K bytes */
+
+#define MFC_TAGID_TO_TAGMASK(tag_id)  (1 << (tag_id & 0x1F))
+
+/* Events for Channels 0-2 */
+#define MFC_DMA_TAG_STATUS_UPDATE_EVENT     0x00000001
+#define MFC_DMA_TAG_CMD_STALL_NOTIFY_EVENT  0x00000002
+#define MFC_DMA_QUEUE_AVAILABLE_EVENT       0x00000008
+#define MFC_SPU_MAILBOX_WRITTEN_EVENT       0x00000010
+#define MFC_DECREMENTER_EVENT               0x00000020
+#define MFC_PU_INT_MAILBOX_AVAILABLE_EVENT  0x00000040
+#define MFC_PU_MAILBOX_AVAILABLE_EVENT      0x00000080
+#define MFC_SIGNAL_2_EVENT                  0x00000100
+#define MFC_SIGNAL_1_EVENT                  0x00000200
+#define MFC_LLR_LOST_EVENT                  0x00000400
+#define MFC_PRIV_ATTN_EVENT                 0x00000800
+#define MFC_MULTI_SRC_EVENT                 0x00001000
+
+/* Flags indicating progress during context switch. */
+#define SPU_CONTEXT_SWITCH_PENDING_nr	0UL
+#define SPU_CONTEXT_SWITCH_ACTIVE_nr	1UL
+#define SPU_CONTEXT_SWITCH_PENDING	(1UL << SPU_CONTEXT_SWITCH_PENDING_nr)
+#define SPU_CONTEXT_SWITCH_ACTIVE	(1UL << SPU_CONTEXT_SWITCH_ACTIVE_nr)
 
 struct spu {
 	char *name;
@@ -40,6 +115,7 @@
 	int number;
 	u32 isrc;
 	u32 node;
+	u64 flags;
 	struct kref kref;
 	size_t ls_size;
 	unsigned int slb_replace;
diff -urN linux-2.6.13-rc6.fix/include/asm-ppc64/spu_csa.h linux-2.6.13-rc6/include/asm-ppc64/spu_csa.h
--- linux-2.6.13-rc6.fix/include/asm-ppc64/spu_csa.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13-rc6/include/asm-ppc64/spu_csa.h	2005-08-22 23:50:30.760192858 +0200
@@ -0,0 +1,256 @@
+/*
+ * spu_csa.h: Definitions for SPU context save area (CSA).
+ *
+ * (C) Copyright IBM 2005
+ *
+ * Author: Mark Nutter <mnutter at us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _SPU_CSA_H_
+#define _SPU_CSA_H_
+
+/*
+ * Total number of 128-bit registers.
+ */
+#define NR_SPU_GPRS         	128
+#define NR_SPU_SPRS         	9
+#define NR_SPU_REGS_PAD	    	7
+#define NR_SPU_SPILL_REGS   	144	/* GPRS + SPRS + PAD */
+#define SIZEOF_SPU_SPILL_REGS	NR_SPU_SPILL_REGS * 16
+
+#define SPU_SAVE_COMPLETE      	0x3FFB
+#define SPU_RESTORE_COMPLETE   	0x3FFC
+
+/*
+ * Definitions for various 'stopped' status conditions,
+ * to be recreated during context restore.
+ */
+#define SPU_STOPPED_STATUS_P    1
+#define SPU_STOPPED_STATUS_I    2
+#define SPU_STOPPED_STATUS_H    3
+#define SPU_STOPPED_STATUS_S    4
+#define SPU_STOPPED_STATUS_S_I  5
+#define SPU_STOPPED_STATUS_S_P  6
+#define SPU_STOPPED_STATUS_P_H  7
+#define SPU_STOPPED_STATUS_P_I  8
+#define SPU_STOPPED_STATUS_R    9
+
+#ifndef  __ASSEMBLY__
+/**
+ * spu_reg128 - generic 128-bit register definition.
+ */
+struct spu_reg128 {
+	u32 slot[4];
+};
+
+/**
+ * struct spu_lscsa - Local Store Context Save Area.
+ * @gprs: Array of saved registers.
+ * @fpcr: Saved floating point status control register.
+ * @decr: Saved decrementer value.
+ * @decr_status: Indicates decrementer run status.
+ * @ppu_mb: Saved PPU mailbox data.
+ * @ppuint_mb: Saved PPU interrupting mailbox data.
+ * @tag_mask: Saved tag group mask.
+ * @event_mask: Saved event mask.
+ * @srr0: Saved SRR0.
+ * @stopped_status: Conditions to be recreated by restore.
+ * @ls: Saved contents of Local Storage Area.
+ *
+ * The LSCSA represents state that is primarily saved and
+ * restored by SPU-side code.
+ */
+struct spu_lscsa {
+	struct spu_reg128 gprs[128];
+	struct spu_reg128 fpcr;
+	struct spu_reg128 decr;
+	struct spu_reg128 decr_status;
+	struct spu_reg128 ppu_mb;
+	struct spu_reg128 ppuint_mb;
+	struct spu_reg128 tag_mask;
+	struct spu_reg128 event_mask;
+	struct spu_reg128 srr0;
+	struct spu_reg128 stopped_status;
+	struct spu_reg128 pad[7];	/* 'ls' must be 128-byte aligned. */
+	unsigned char ls[LS_SIZE];
+};
+
+#ifdef __KERNEL__
+
+/*
+ * struct spu_problem_collapsed - condensed problem state area, w/o pads.
+ */
+struct spu_problem_collapsed {
+	u64 spc_mssync_RW;
+	u32 mfc_lsa_W;
+	u32 unused_pad0;
+	u64 mfc_ea_W;
+	union mfc_tag_size_class_cmd mfc_union_W;
+	u32 dma_qstatus_R;
+	u32 dma_querytype_RW;
+	u32 dma_querymask_RW;
+	u32 dma_tagstatus_R;
+	u32 pu_mb_R;
+	u32 spu_mb_W;
+	u32 mb_stat_R;
+	u32 spu_runcntl_RW;
+	u32 spu_status_R;
+	u32 spu_spc_R;
+	u32 spu_npc_RW;
+	u32 signal_notify1;
+	u32 signal_notify2;
+	u32 unused_pad1;
+};
+
+/*
+ * struct spu_priv1_collapsed - condensed privileged 1 area, w/o pads.
+ */
+struct spu_priv1_collapsed {
+	u64 mfc_sr1_RW;
+	u64 mfc_lpid_RW;
+	u64 spu_idr_RW;
+	u64 mfc_vr_RO;
+	u64 spu_vr_RO;
+	u64 int_mask_class0_RW;
+	u64 int_mask_class1_RW;
+	u64 int_mask_class2_RW;
+	u64 int_stat_class0_RW;
+	u64 int_stat_class1_RW;
+	u64 int_stat_class2_RW;
+	u64 int_route_RW;
+	u64 mfc_atomic_flush_RW;
+	u64 resource_allocation_groupID_RW;
+	u64 resource_allocation_enable_RW;
+	u64 mfc_fir_R;
+	u64 mfc_fir_status_or_W;
+	u64 mfc_fir_status_and_W;
+	u64 mfc_fir_mask_R;
+	u64 mfc_fir_mask_or_W;
+	u64 mfc_fir_mask_and_W;
+	u64 mfc_fir_chkstp_enable_RW;
+	u64 smf_sbi_signal_sel;
+	u64 smf_ato_signal_sel;
+	u64 mfc_sdr_RW;
+	u64 tlb_index_hint_RO;
+	u64 tlb_index_W;
+	u64 tlb_vpn_RW;
+	u64 tlb_rpn_RW;
+	u64 tlb_invalidate_entry_W;
+	u64 tlb_invalidate_all_W;
+	u64 smm_hid;
+	u64 mfc_accr_RW;
+	u64 mfc_dsisr_RW;
+	u64 mfc_dar_RW;
+	u64 rmt_index_RW;
+	u64 rmt_data1_RW;
+	u64 mfc_dsir_R;
+	u64 mfc_lsacr_RW;
+	u64 mfc_lscrr_R;
+	u64 mfc_tclass_id_RW;
+	u64 mfc_rm_boundary;
+	u64 smf_dma_signal_sel;
+	u64 smm_signal_sel;
+	u64 mfc_cer_R;
+	u64 pu_ecc_cntl_RW;
+	u64 pu_ecc_stat_RW;
+	u64 spu_ecc_addr_RW;
+	u64 spu_err_mask_RW;
+	u64 spu_trig0_sel;
+	u64 spu_trig1_sel;
+	u64 spu_trig2_sel;
+	u64 spu_trig3_sel;
+	u64 spu_trace_sel;
+	u64 spu_event0_sel;
+	u64 spu_event1_sel;
+	u64 spu_event2_sel;
+	u64 spu_event3_sel;
+	u64 spu_trace_cntl;
+};
+
+/*
+ * struct spu_priv2_collapsed - condensed priviliged 2 area, w/o pads.
+ */
+struct spu_priv2_collapsed {
+	u64 slb_index_W;
+	u64 slb_esid_RW;
+	u64 slb_vsid_RW;
+	u64 slb_invalidate_entry_W;
+	u64 slb_invalidate_all_W;
+	struct mfc_cq_sr spuq[16];
+	struct mfc_cq_sr puq[8];
+	u64 mfc_control_RW;
+	u64 puint_mb_R;
+	u64 spu_privcntl_RW;
+	u64 spu_lslr_RW;
+	u64 spu_chnlcntptr_RW;
+	u64 spu_chnlcnt_RW;
+	u64 spu_chnldata_RW;
+	u64 spu_cfg_RW;
+	u64 spu_pm_trace_tag_status_RW;
+	u64 spu_tag_status_query_RW;
+	u64 spu_cmd_buf1_RW;
+	u64 spu_cmd_buf2_RW;
+	u64 spu_atomic_status_RW;
+};
+
+/**
+ * struct spu_state
+ * @lscsa: Local Store Context Save Area.
+ * @prob: Collapsed Problem State Area, w/o pads.
+ * @priv1: Collapsed Privileged 1 Area, w/o pads.
+ * @priv2: Collapsed Privileged 2 Area, w/o pads.
+ * @spu_chnlcnt_RW: Array of saved channel counts.
+ * @spu_chnldata_RW: Array of saved channel data.
+ * @suspend_time: Time stamp when decrementer disabled.
+ * @slb_esid_RW: Array of saved SLB esid entries.
+ * @slb_vsid_RW: Array of saved SLB vsid entries.
+ *
+ * Structure representing the whole of the SPU
+ * context save area (CSA).  This struct contains
+ * all of the state necessary to suspend and then
+ * later optionally resume execution of an SPU
+ * context.
+ *
+ * The @lscsa region is by far the largest, and is
+ * allocated separately so that it may either be
+ * pinned or mapped to/from application memory, as
+ * appropriate for the OS environment.
+ */
+struct spu_state {
+	struct spu_lscsa *lscsa;
+	struct spu_problem_collapsed prob;
+	struct spu_priv1_collapsed priv1;
+	struct spu_priv2_collapsed priv2;
+	u64 spu_chnlcnt_RW[32];
+	u64 spu_chnldata_RW[32];
+	u32 spu_mailbox_data[4];
+	u32 pu_mailbox_data[1];
+	unsigned long suspend_time;
+	u64 slb_esid_RW[8];
+	u64 slb_vsid_RW[8];
+};
+
+extern void spu_init_csa(struct spu_state *csa);
+extern void spu_fini_csa(struct spu_state *csa);
+extern int spu_save(struct spu_state *prev, struct spu *spu);
+extern int spu_restore(struct spu_state *new, struct spu *spu);
+extern int spu_switch(struct spu_state *prev, struct spu_state *new,
+		      struct spu *spu);
+
+#endif /* __KERNEL__ */
+#endif /* !__ASSEMBLY__ */
+#endif /* _SPU_CSA_H_ */




More information about the Linuxppc64-dev mailing list