From ad743fd6be5ae6bc8dcd16067a40d17ce3ed2842 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 7 Jan 2016 18:21:55 +0100 Subject: [PATCH] core: Remove memory regions check Most of the checks will be removed when adding sub-page memory region support. We rather need some offline validation outside the hypervisor eventually. Signed-off-by: Jan Kiszka --- hypervisor/control.c | 29 ---------------------- hypervisor/include/jailhouse/cell-config.h | 9 ------- hypervisor/include/jailhouse/control.h | 1 - hypervisor/setup.c | 4 --- 4 files changed, 43 deletions(-) diff --git a/hypervisor/control.c b/hypervisor/control.c index 3c7f91f..3353db6 100644 --- a/hypervisor/control.c +++ b/hypervisor/control.c @@ -209,31 +209,6 @@ static void cell_exit(struct cell *cell) 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 @@ -398,10 +373,6 @@ static int cell_create(struct per_cpu *cpu_data, unsigned long config_address) 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) { diff --git a/hypervisor/include/jailhouse/cell-config.h b/hypervisor/include/jailhouse/cell-config.h index a522b8d..a6e896b 100644 --- a/hypervisor/include/jailhouse/cell-config.h +++ b/hypervisor/include/jailhouse/cell-config.h @@ -68,15 +68,6 @@ struct jailhouse_cell_desc { #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; diff --git a/hypervisor/include/jailhouse/control.h b/hypervisor/include/jailhouse/control.h index 0986d77..b83553f 100644 --- a/hypervisor/include/jailhouse/control.h +++ b/hypervisor/include/jailhouse/control.h @@ -112,7 +112,6 @@ static inline bool cell_owns_cpu(struct cell *cell, unsigned int cpu_id) bool cpu_id_valid(unsigned long cpu_id); -int check_mem_regions(const struct jailhouse_cell_desc *config); int cell_init(struct cell *cell); void config_commit(struct cell *cell_added_removed); diff --git a/hypervisor/setup.c b/hypervisor/setup.c index cb0131c..671369d 100644 --- a/hypervisor/setup.c +++ b/hypervisor/setup.c @@ -47,10 +47,6 @@ static void init_early(unsigned int cpu_id) root_cell.config = &system_config->root_cell; - error = check_mem_regions(&system_config->root_cell); - if (error) - return; - root_cell.id = -1; error = cell_init(&root_cell); if (error) -- 2.39.2