Commit 8b0d3121 authored by Sebastian Siewior's avatar Sebastian Siewior Committed by Paul Mackerras

[POWERPC] spufs: Make isolated loader properly aligned

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 only 8 byte alignment is
guaranteed.

This enforces alignment via __get_free_pages.
Signed-off-by: default avatarSebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 6232a74f
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
static struct kmem_cache *spufs_inode_cache; static struct kmem_cache *spufs_inode_cache;
char *isolated_loader; char *isolated_loader;
static int isolated_loader_size;
static struct inode * static struct inode *
spufs_alloc_inode(struct super_block *sb) spufs_alloc_inode(struct super_block *sb)
...@@ -667,7 +668,8 @@ spufs_parse_options(char *options, struct inode *root) ...@@ -667,7 +668,8 @@ spufs_parse_options(char *options, struct inode *root)
static void spufs_exit_isolated_loader(void) static void spufs_exit_isolated_loader(void)
{ {
kfree(isolated_loader); free_pages((unsigned long) isolated_loader,
get_order(isolated_loader_size));
} }
static void static void
...@@ -685,11 +687,12 @@ spufs_init_isolated_loader(void) ...@@ -685,11 +687,12 @@ spufs_init_isolated_loader(void)
if (!loader) if (!loader)
return; return;
/* kmalloc should align on a 16 byte boundary..* */ /* the loader must be align on a 16 byte boundary */
isolated_loader = kmalloc(size, GFP_KERNEL); isolated_loader = (char *)__get_free_pages(GFP_KERNEL, get_order(size));
if (!isolated_loader) if (!isolated_loader)
return; return;
isolated_loader_size = size;
memcpy(isolated_loader, loader, size); memcpy(isolated_loader, loader, size);
printk(KERN_INFO "spufs: SPU isolation mode enabled\n"); printk(KERN_INFO "spufs: SPU isolation mode enabled\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment