• Eduardo Habkost's avatar
    KVM: SVM: Reset cr0 properly on vcpu reset · 18fa000a
    Eduardo Habkost authored
    svm_vcpu_reset() was not properly resetting the contents of the guest-visible
    cr0 register, causing the following issue:
    https://bugzilla.redhat.com/show_bug.cgi?id=525699
    
    Without resetting cr0 properly, the vcpu was running the SIPI bootstrap routine
    with paging enabled, making the vcpu get a pagefault exception while trying to
    run it.
    
    Instead of setting vmcb->save.cr0 directly, the new code just resets
    kvm->arch.cr0 and calls kvm_set_cr0(). The bits that were set/cleared on
    vmcb->save.cr0 (PG, WP, !CD, !NW) will be set properly by svm_set_cr0().
    
    kvm_set_cr0() is used instead of calling svm_set_cr0() directly to make sure
    kvm_mmu_reset_context() is called to reset the mmu to nonpaging mode.
    Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    18fa000a
svm.c 75.3 KB