]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Introduce arch_shutdown
authorJan Kiszka <jan.kiszka@siemens.com>
Fri, 10 Jan 2014 16:27:46 +0000 (17:27 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 10 Jan 2014 16:32:25 +0000 (17:32 +0100)
Introduce an arch-specific shutdown function to be called once when the
hypervisor is disabled. Use it on x86 for invoking vtd_shutdown. This
avoids that vtd_shutdown is called multiple times, which was harmless
but conceptually incorrect.

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

index 984a61bc84cb8b1d817551e6c574d830cb0c3182..5189f81e739d2379cb38a28cdc0f3505681f46f3 100644 (file)
@@ -58,3 +58,4 @@ void arch_unmap_memory_region(struct cell *cell,
 void arch_cell_destroy(struct per_cpu *cpu_data, struct cell *new_cell) {}
 void *memcpy(void *dest, const void *src, unsigned long n) { return NULL; }
 void arch_dbg_write(const char *msg) {}
+void arch_shutdown(void) {}
index 6fe133079613fa6f5b713d364f8be271c3ef1b89..8c87c29d5ea87647113c1ac9f75d0b19f6fa6a2b 100644 (file)
@@ -69,3 +69,8 @@ void arch_cell_destroy(struct per_cpu *cpu_data, struct cell *cell)
        vmx_cell_exit(cell);
        flush_linux_cpu_caches(cpu_data);
 }
+
+void arch_shutdown(void)
+{
+       vtd_shutdown();
+}
index 9a4e8504c9ed3e128c4a3dddd0f2085b3807af36..2deba84c748e485a8dd8b03df400152581921fa6 100644 (file)
@@ -20,7 +20,6 @@
 #include <asm/apic.h>
 #include <asm/fault.h>
 #include <asm/vmx.h>
-#include <asm/vtd.h>
 
 static const struct segment invalid_seg = {
        .access_rights = 0x10000
@@ -830,10 +829,8 @@ static void vmx_handle_hypercall(struct registers *guest_regs,
        switch (guest_regs->rax) {
        case JAILHOUSE_HC_DISABLE:
                guest_regs->rax = shutdown(cpu_data);
-               if (guest_regs->rax == 0) {
-                       vtd_shutdown();
+               if (guest_regs->rax == 0)
                        vmx_cpu_deactivate_vmm(guest_regs, cpu_data);
-               }
                break;
        case JAILHOUSE_HC_CELL_CREATE:
                guest_regs->rax = cell_create(cpu_data, guest_regs->rdi);
index 80fa0ec0e081fdae989bab9a100e637ab9b054a3..5ece60d51a6e379b37119fef6f80753a040a538c 100644 (file)
@@ -406,6 +406,7 @@ int shutdown(struct per_cpu *cpu_data)
 
                printk(" Closing Linux cell \"%s\"\n",
                       linux_cell.config->name);
+               arch_shutdown();
        }
        printk("  Releasing CPU %d\n", this_cpu);
 
index ba937491f3e9a209b314047df7f06b7c4af87905..71057bb66e28562411db2091a7d8a40b9d508fd2 100644 (file)
@@ -52,3 +52,5 @@ void arch_unmap_memory_region(struct cell *cell,
 
 int arch_cell_create(struct per_cpu *cpu_data, struct cell *cell);
 void arch_cell_destroy(struct per_cpu *cpu_data, struct cell *cell);
+
+void arch_shutdown(void);