]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Factor out config_commit
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 11 Oct 2014 07:14:58 +0000 (09:14 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 7 Nov 2014 06:38:54 +0000 (07:38 +0100)
Factor out the generic part of x86's arch_config_commit into
config_commit so that we don't need to replicate it into other archs.

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

index 3e2bc9dd2ea8043964973b03751c71ce8fa2772e..7cb40ca3e2ff795bd35b779094bfee41a91f52fc 100644 (file)
@@ -114,13 +114,8 @@ void arch_cell_destroy(struct cell *cell)
        vcpu_cell_exit(cell);
 }
 
-/* all root cell CPUs (except the calling one) have to be suspended */
 void arch_config_commit(struct cell *cell_added_removed)
 {
-       arch_flush_cell_vcpu_caches(&root_cell);
-       if (cell_added_removed && cell_added_removed != &root_cell)
-               arch_flush_cell_vcpu_caches(cell_added_removed);
-
        iommu_config_commit(cell_added_removed);
        pci_config_commit(cell_added_removed);
        ioapic_config_commit(cell_added_removed);
index 4cc3c163e1bed101aa2b14dd919d8809c54e8b04..dc371145a88c87f3028037b7efdecfa1b0e016ff 100644 (file)
@@ -235,6 +235,23 @@ int check_mem_regions(const struct jailhouse_cell_desc *config)
        return 0;
 }
 
+/**
+ * Apply system configuration changes.
+ * @param cell_added_removed   Cell that was added or removed to/from the
+ *                             system or NULL.
+ *
+ * @see arch_config_commit
+ * @see pci_config_commit
+ */
+void config_commit(struct cell *cell_added_removed)
+{
+       arch_flush_cell_vcpu_caches(&root_cell);
+       if (cell_added_removed && cell_added_removed != &root_cell)
+               arch_flush_cell_vcpu_caches(cell_added_removed);
+
+       arch_config_commit(cell_added_removed);
+}
+
 static bool address_in_region(unsigned long addr,
                              const struct jailhouse_memory *region)
 {
@@ -323,7 +340,7 @@ static void cell_destroy_internal(struct per_cpu *cpu_data, struct cell *cell)
 
        arch_cell_destroy(cell);
 
-       arch_config_commit(cell);
+       config_commit(cell);
 }
 
 static int cell_create(struct per_cpu *cpu_data, unsigned long config_address)
@@ -447,7 +464,7 @@ static int cell_create(struct per_cpu *cpu_data, unsigned long config_address)
                        goto err_destroy_cell;
        }
 
-       arch_config_commit(cell);
+       config_commit(cell);
 
        cell->comm_page.comm_region.cell_state = JAILHOUSE_CELL_SHUT_DOWN;
 
@@ -543,7 +560,7 @@ static int cell_start(struct per_cpu *cpu_data, unsigned long id)
                                        goto out_resume;
                        }
 
-               arch_config_commit(NULL);
+               config_commit(NULL);
 
                cell->loadable = false;
        }
@@ -596,7 +613,7 @@ static int cell_set_loadable(struct per_cpu *cpu_data, unsigned long id)
                                goto out_resume;
                }
 
-       arch_config_commit(NULL);
+       config_commit(NULL);
 
        printk("Cell \"%s\" can be loaded\n", cell->config->name);
 
index 1fe38bf037ef31dc951433314301ceca22f48b3e..e9ba71ba406cdb7115a28fca13a9f22501c22109 100644 (file)
@@ -80,6 +80,8 @@ 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);
+
 long hypercall(unsigned long code, unsigned long arg1, unsigned long arg2);
 
 void __attribute__((noreturn)) panic_stop(void);
@@ -224,6 +226,7 @@ void arch_cell_destroy(struct cell *cell);
  * @param cell_added_removed   Cell that was added or removed to/from the
  *                             system or NULL.
  *
+ * @see config_commit
  * @see pci_config_commit
  */
 void arch_config_commit(struct cell *cell_added_removed);
index e0a6c88d4a3c5d2fbc8dc96038dbe7212f8a47af..45d59b6913f17e6cff3861585e13cee16db73133 100644 (file)
@@ -145,7 +145,7 @@ static void init_late(void)
        if (error)
                return;
 
-       arch_config_commit(&root_cell);
+       config_commit(&root_cell);
 
        paging_dump_stats("after late setup");
 }