Permalink
Browse files

driver: Add support for processing multiple images

The kernel/userspace interface is already prepared for this, we just
need to loop over all provided images, loading each if them into the
cell memory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information...
1 parent 73b23e4 commit d85b3c56d1eeaa510c3994c5cca0fc206e96e4ed @jan-kiszka jan-kiszka committed Feb 17, 2014
Showing with 6 additions and 7 deletions.
  1. +6 −7 driver.c
View
@@ -322,15 +322,12 @@ static int jailhouse_cell_create(struct jailhouse_new_cell __user *arg)
struct jailhouse_preload_image __user *image = arg->image;
struct jailhouse_cell_desc *config;
struct jailhouse_new_cell cell;
- unsigned int cpu;
+ unsigned int cpu, n;
int err;
if (copy_from_user(&cell, arg, sizeof(cell)))
return -EFAULT;
- if (cell.num_preload_images != 1)
- return -EINVAL;
-
config = kmalloc(cell.config_size, GFP_KERNEL | GFP_DMA);
if (!config)
return -ENOMEM;
@@ -342,9 +339,11 @@ static int jailhouse_cell_create(struct jailhouse_new_cell __user *arg)
}
config->name[JAILHOUSE_CELL_NAME_MAXLEN] = 0;
- err = load_image(config, image);
- if (err)
- goto kfree_config_out;
+ for (n = cell.num_preload_images; n > 0; n--, image++) {
+ err = load_image(config, image);
+ if (err)
+ goto kfree_config_out;
+ }
if (mutex_lock_interruptible(&lock) != 0) {
err = -EINTR;

0 comments on commit d85b3c5

Please sign in to comment.