]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Remove cpu_data from arch_config_commit
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 24 Sep 2014 15:40:39 +0000 (17:40 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 25 Sep 2014 13:49:30 +0000 (15:49 +0200)
We can obtain a reference inside arch_config_commit. This also allows to
drop cpu_data from late_init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/arm/setup.c
hypervisor/arch/x86/control.c
hypervisor/control.c
hypervisor/include/jailhouse/control.h
hypervisor/setup.c

index 9993f1189a909e3a93762afeecc7e29eccb278bf..8eafc5059bd41c30b1e204f2bc82cef24d7e6e76 100644 (file)
@@ -58,8 +58,7 @@ int arch_unmap_memory_region(struct cell *cell,
                             const struct jailhouse_memory *mem)
 { return -ENOSYS; }
 void arch_cell_destroy(struct cell *new_cell) {}
-void arch_config_commit(struct per_cpu *cpu_data,
-                       struct cell *cell_added_removed) {}
+void arch_config_commit(struct cell *cell_added_removed) {}
 void *memcpy(void *dest, const void *src, unsigned long n) { return NULL; }
 void arch_dbg_write(const char *msg) {}
 void arch_shutdown(void) {}
index a6ede50a42e9a9ecd9e2c220bc156eb6d92363ca..74b48a0136a28472e3d16a9a72d7db95d22a8fb7 100644 (file)
@@ -95,18 +95,17 @@ void arch_cell_destroy(struct cell *cell)
        vmx_cell_exit(cell);
 }
 
-/* all root cell CPUs (except cpu_data) have to be stopped */
-void arch_config_commit(struct per_cpu *cpu_data,
-                       struct cell *cell_added_removed)
+/* all root cell CPUs (except the calling one) have to be suspended */
+void arch_config_commit(struct cell *cell_added_removed)
 {
-       unsigned int cpu;
+       unsigned int cpu, current_cpu = this_cpu_id();
 
-       for_each_cpu_except(cpu, root_cell.cpu_set, cpu_data->cpu_id)
+       for_each_cpu_except(cpu, root_cell.cpu_set, current_cpu)
                per_cpu(cpu)->flush_virt_caches = true;
 
        if (cell_added_removed && cell_added_removed != &root_cell)
                for_each_cpu_except(cpu, cell_added_removed->cpu_set,
-                                   cpu_data->cpu_id)
+                                   current_cpu)
                        per_cpu(cpu)->flush_virt_caches = true;
 
        vmx_invept();
index a73048a98d32da61283f371c81cc6cbe16ee617d..ce046ba6178ef6d73591c181b56f979c91b1357b 100644 (file)
@@ -284,7 +284,7 @@ static void cell_destroy_internal(struct per_cpu *cpu_data, struct cell *cell)
 
        arch_cell_destroy(cell);
 
-       arch_config_commit(cpu_data, cell);
+       arch_config_commit(cell);
 }
 
 static int cell_create(struct per_cpu *cpu_data, unsigned long config_address)
@@ -403,7 +403,7 @@ static int cell_create(struct per_cpu *cpu_data, unsigned long config_address)
                        goto err_destroy_cell;
        }
 
-       arch_config_commit(cpu_data, cell);
+       arch_config_commit(cell);
 
        cell->comm_page.comm_region.cell_state = JAILHOUSE_CELL_SHUT_DOWN;
 
@@ -499,7 +499,7 @@ static int cell_start(struct per_cpu *cpu_data, unsigned long id)
                                        goto out_resume;
                        }
 
-               arch_config_commit(cpu_data, NULL);
+               arch_config_commit(NULL);
 
                cell->loadable = false;
        }
@@ -552,7 +552,7 @@ static int cell_set_loadable(struct per_cpu *cpu_data, unsigned long id)
                                goto out_resume;
                }
 
-       arch_config_commit(cpu_data, NULL);
+       arch_config_commit(NULL);
 
        printk("Cell \"%s\" can be loaded\n", cell->config->name);
 
index de02683b60439c12115ea35328072c0659cc597e..4301351a05582a824b33da5906140a470b5323bc 100644 (file)
@@ -64,8 +64,7 @@ int arch_unmap_memory_region(struct cell *cell,
 int arch_cell_create(struct cell *cell);
 void arch_cell_destroy(struct cell *cell);
 
-void arch_config_commit(struct per_cpu *cpu_data,
-                       struct cell *cell_added_removed);
+void arch_config_commit(struct cell *cell_added_removed);
 
 void arch_shutdown(void);
 
index f4389cf9a1c69a673077163eb3a6d51c9694cc24..54afa972c1c8a46ca03b5a8526b3623c40d11958 100644 (file)
@@ -132,7 +132,7 @@ int map_root_memory_regions(void)
        return 0;
 }
 
-static void init_late(struct per_cpu *cpu_data)
+static void init_late(void)
 {
        unsigned int cpu, expected_cpus = 0;
 
@@ -147,7 +147,7 @@ static void init_late(struct per_cpu *cpu_data)
        if (error)
                return;
 
-       arch_config_commit(cpu_data, &root_cell);
+       arch_config_commit(&root_cell);
 
        paging_dump_stats("after late setup");
 }
@@ -173,7 +173,7 @@ int entry(unsigned int cpu_id, struct per_cpu *cpu_data)
                cpu_relax();
 
        if (!error && master) {
-               init_late(cpu_data);
+               init_late();
                if (!error) {
                        /*
                         * Make sure everything was committed before we signal