Skip to content

Commit

Permalink
[POWERPC] spufs: Make isolated loader properly aligned
Browse files Browse the repository at this point in the history
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: Sebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Sebastian Siewior authored and Paul Mackerras committed Sep 19, 2007
1 parent 6232a74 commit 8b0d312
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

static struct kmem_cache *spufs_inode_cache;
char *isolated_loader;
static int isolated_loader_size;

static struct inode *
spufs_alloc_inode(struct super_block *sb)
Expand Down Expand Up @@ -667,7 +668,8 @@ spufs_parse_options(char *options, struct inode *root)

static void spufs_exit_isolated_loader(void)
{
kfree(isolated_loader);
free_pages((unsigned long) isolated_loader,
get_order(isolated_loader_size));
}

static void
Expand All @@ -685,11 +687,12 @@ spufs_init_isolated_loader(void)
if (!loader)
return;

/* kmalloc should align on a 16 byte boundary..* */
isolated_loader = kmalloc(size, GFP_KERNEL);
/* the loader must be align on a 16 byte boundary */
isolated_loader = (char *)__get_free_pages(GFP_KERNEL, get_order(size));
if (!isolated_loader)
return;

isolated_loader_size = size;
memcpy(isolated_loader, loader, size);
printk(KERN_INFO "spufs: SPU isolation mode enabled\n");
}
Expand Down

0 comments on commit 8b0d312

Please sign in to comment.