• Sean Christopherson's avatar
    KVM: vmx: move struct host_state usage to struct loaded_vmcs · d7ee039e
    Sean Christopherson authored
    Make host_state a property of a loaded_vmcs so that it can be
    used as a cache of the VMCS fields, e.g. to lazily VMWRITE the
    corresponding VMCS field.  Treating host_state as a cache does
    not work if it's not VMCS specific as the cache would become
    incoherent when switching between vmcs01 and vmcs02.
    
    Move vmcs_host_cr3 and vmcs_host_cr4 into host_state.
    
    Explicitly zero out host_state when allocating a new VMCS for a
    loaded_vmcs.  Unlike the pre-existing vmcs_host_cr{3,4} usage,
    the segment information is not guaranteed to be (re)initialized
    when running a new nested VMCS, e.g. HOST_FS_BASE is not written
    in vmx_set_constant_host_state().
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    d7ee039e
vmx.c 392 KB