diff options
author | Max Bruning <max@joyent.com> | 2011-04-28 07:03:32 -0700 |
---|---|---|
committer | Max Bruning <max@joyent.com> | 2011-04-28 07:03:32 -0700 |
commit | 958088a38ac700e4a81c3af61afaadea61f1470f (patch) | |
tree | 2cda8691144adbe28197964bc4f03e265c6920e5 /kvm_x86.c | |
parent | bd8ed88dffdc6e30a0594ae64a949cb48853ce41 (diff) | |
download | illumos-kvm-958088a38ac700e4a81c3af61afaadea61f1470f.tar.gz |
HVM-141 On subsequent attach after detach, vm initialization fails.
Diffstat (limited to 'kvm_x86.c')
-rw-r--r-- | kvm_x86.c | 38 |
1 files changed, 34 insertions, 4 deletions
@@ -398,14 +398,44 @@ kvm_arch_hardware_enable(void *garbage) return (vmx_hardware_enable(garbage)); } -void -kvm_arch_hardware_disable(void *garbage) +static void vmclear_local_vcpus(void) { #ifdef XXX - hardware_disable(garbage); + int cpu = raw_smp_processor_id(); + struct vcpu_vmx *vmx, *n; + + list_for_each_entry_safe(vmx, n, &per_cpu(vcpus_on_cpu, cpu), + local_vcpus_link) + __vcpu_clear(vmx); #else XXX_KVM_PROBE; -#endif +#endif /* XXX */ +} + + +/* + * Just like cpu_vmxoff(), but with the __kvm_handle_fault_on_reboot() + * tricks. + */ +static void kvm_cpu_vmxoff(void) +{ + /* BEGIN CSTYLED */ + __asm__ volatile ((ASM_VMX_VMXOFF) : : : "cc"); + /* END CSTYLED */ + setcr4(getcr4() & ~X86_CR4_VMXE); +} + +static void vmx_hardware_disable(void *garbage) +{ + vmclear_local_vcpus(); + kvm_cpu_vmxoff(); +} + + +void +kvm_arch_hardware_disable(void *garbage) +{ + vmx_hardware_disable(garbage); #if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER) drop_user_return_notifiers(garbage); #endif |