]> err.no Git - linux-2.6/blobdiff - arch/powerpc/platforms/ps3/spu.c
Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[linux-2.6] / arch / powerpc / platforms / ps3 / spu.c
index 651437cb2c183f0fab1938bd42cde56ef5f48670..5ad41189b494e030e9a6e943f81bb0653cabb40f 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/spu_priv1.h>
 #include <asm/lv1call.h>
 
+#include "../cell/spufs/spufs.h"
 #include "platform.h"
 
 /* spu_management_ops */
@@ -182,15 +183,18 @@ static int __init setup_areas(struct spu *spu)
 {
        struct table {char* name; unsigned long addr; unsigned long size;};
 
-       spu_pdata(spu)->shadow = __ioremap(
-               spu_pdata(spu)->shadow_addr, sizeof(struct spe_shadow),
-               pgprot_val(PAGE_READONLY) | _PAGE_NO_CACHE | _PAGE_GUARDED);
+       spu_pdata(spu)->shadow = ioremap_flags(spu_pdata(spu)->shadow_addr,
+                                              sizeof(struct spe_shadow),
+                                              pgprot_val(PAGE_READONLY) |
+                                              _PAGE_NO_CACHE);
        if (!spu_pdata(spu)->shadow) {
                pr_debug("%s:%d: ioremap shadow failed\n", __func__, __LINE__);
                goto fail_ioremap;
        }
 
-       spu->local_store = ioremap(spu->local_store_phys, LS_SIZE);
+       spu->local_store = (__force void *)ioremap_flags(spu->local_store_phys,
+               LS_SIZE, _PAGE_NO_CACHE);
+
        if (!spu->local_store) {
                pr_debug("%s:%d: ioremap local_store failed\n",
                        __func__, __LINE__);
@@ -199,6 +203,7 @@ static int __init setup_areas(struct spu *spu)
 
        spu->problem = ioremap(spu->problem_phys,
                sizeof(struct spu_problem));
+
        if (!spu->problem) {
                pr_debug("%s:%d: ioremap problem failed\n", __func__, __LINE__);
                goto fail_ioremap;
@@ -206,6 +211,7 @@ static int __init setup_areas(struct spu *spu)
 
        spu->priv2 = ioremap(spu_pdata(spu)->priv2_addr,
                sizeof(struct spu_priv2));
+
        if (!spu->priv2) {
                pr_debug("%s:%d: ioremap priv2 failed\n", __func__, __LINE__);
                goto fail_ioremap;
@@ -400,17 +406,49 @@ static int __init ps3_enumerate_spus(int (*fn)(void *data))
                }
        }
 
-       if (result)
+       if (result) {
                printk(KERN_WARNING "%s:%d: Error initializing spus\n",
                        __func__, __LINE__);
+               return result;
+       }
 
-       return result;
+       return num_resource_id;
+}
+
+static int ps3_init_affinity(void)
+{
+       return 0;
+}
+
+/**
+ * ps3_enable_spu - Enable SPU run control.
+ *
+ * An outstanding enhancement for the PS3 would be to add a guard to check
+ * for incorrect access to the spu problem state when the spu context is
+ * disabled.  This check could be implemented with a flag added to the spu
+ * context that would inhibit mapping problem state pages, and a routine
+ * to unmap spu problem state pages.  When the spu is enabled with
+ * ps3_enable_spu() the flag would be set allowing pages to be mapped,
+ * and when the spu is disabled with ps3_disable_spu() the flag would be
+ * cleared and the mapped problem state pages would be unmapped.
+ */
+
+static void ps3_enable_spu(struct spu_context *ctx)
+{
+}
+
+static void ps3_disable_spu(struct spu_context *ctx)
+{
+       ctx->ops->runcntl_stop(ctx);
 }
 
 const struct spu_management_ops spu_management_ps3_ops = {
        .enumerate_spus = ps3_enumerate_spus,
        .create_spu = ps3_create_spu,
        .destroy_spu = ps3_destroy_spu,
+       .enable_spu = ps3_enable_spu,
+       .disable_spu = ps3_disable_spu,
+       .init_affinity = ps3_init_affinity,
 };
 
 /* spu_priv1_ops */