page_free(&mem_pool, cell->cpu_set, 1);
}
-/**
- * Perform basic validation of cell memory regions.
- * @param config Cell configuration description.
- *
- * @return 0 if the regions are valid, @c -EINVAL if the validation failed.
- *
- * Checks performed on the memory regions are:
- * \li Page alignment of physical and virtual address and the size.
- * \li Use of supported flags only.
- */
-int check_mem_regions(const struct jailhouse_cell_desc *config)
-{
- const struct jailhouse_memory *mem;
- unsigned int n;
-
- for_each_mem_region(mem, config, n) {
- if (mem->phys_start & ~PAGE_MASK ||
- mem->virt_start & ~PAGE_MASK ||
- mem->size & ~PAGE_MASK ||
- mem->flags & ~JAILHOUSE_MEM_VALID_FLAGS)
- return trace_error(-EINVAL);
- }
- return 0;
-}
-
/**
* Apply system configuration changes.
* @param cell_added_removed Cell that was added or removed to/from the
goto err_resume;
}
- err = check_mem_regions(cfg);
- if (err)
- goto err_resume;
-
cell_pages = PAGES(sizeof(*cell) + cfg_total_size);
cell = page_alloc(&mem_pool, cell_pages);
if (!cell) {
#define JAILHOUSE_MEM_LOADABLE 0x0040
#define JAILHOUSE_MEM_ROOTSHARED 0x0080
-#define JAILHOUSE_MEM_VALID_FLAGS (JAILHOUSE_MEM_READ | \
- JAILHOUSE_MEM_WRITE | \
- JAILHOUSE_MEM_EXECUTE | \
- JAILHOUSE_MEM_DMA | \
- JAILHOUSE_MEM_IO | \
- JAILHOUSE_MEM_COMM_REGION | \
- JAILHOUSE_MEM_LOADABLE | \
- JAILHOUSE_MEM_ROOTSHARED)
-
struct jailhouse_memory {
__u64 phys_start;
__u64 virt_start;