[Cbe-oss-dev] spufs: make isolated loader properly aligned
Sebastian Siewior
cbe-oss-dev at ml.breakpoint.cc
Sat Aug 11 04:27:57 EST 2007
According to the comment in spufs_init_isolated_loader(), the isolated loader
should be aligned on a 16 byte boundary. ARCH_{KMALLOC|SLAB}_MINALIGN is not
defined so 8 byte alignment is guaranteed.
This patch enforces 16 byte alignment (compile time tested).
Signed-off-by: Sebastian Siewior <sebastian at breakpoint.cc>
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -43,6 +43,7 @@
static struct kmem_cache *spufs_inode_cache;
char *isolated_loader;
+static char *isolated_loader_mem;
static struct inode *
spufs_alloc_inode(struct super_block *sb)
@@ -667,7 +668,7 @@ spufs_parse_options(char *options, struc
static void spufs_exit_isolated_loader(void)
{
- kfree(isolated_loader);
+ kfree(isolated_loader_mem);
}
static void
@@ -685,11 +686,12 @@ spufs_init_isolated_loader(void)
if (!loader)
return;
- /* kmalloc should align on a 16 byte boundary..* */
- isolated_loader = kmalloc(size, GFP_KERNEL);
- if (!isolated_loader)
+ /* loader requires mem that is align on a 16 byte boundary */
+ isolated_loader_mem = kmalloc(size + 15, GFP_KERNEL);
+ if (!isolated_loader_mem)
return;
+ isolated_loader = (char *)ALIGN((unsigned long)isolated_loader_mem, 16);
memcpy(isolated_loader, loader, size);
printk(KERN_INFO "spufs: SPU isolation mode enabled\n");
}
More information about the cbe-oss-dev
mailing list