lkml.org 
[lkml]   [2018]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v5 09/12] x86/kvm/nVMX: allow bare VMXON state migration
    From
    Date
    On 13/09/2018 19:05, Vitaly Kuznetsov wrote:
    > It is perfectly valid for a guest to do VMXON and not do VMPTRLD. This
    > state needs to be preserved on migration.
    >
    > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

    Please cover this in state-test.c too.

    Paolo

    > ---
    > arch/x86/kvm/vmx.c | 15 ++++++++-------
    > 1 file changed, 8 insertions(+), 7 deletions(-)
    >
    > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
    > index d3297fadf7ed..25a25fff8dd9 100644
    > --- a/arch/x86/kvm/vmx.c
    > +++ b/arch/x86/kvm/vmx.c
    > @@ -14482,13 +14482,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
    > if (!page_address_valid(vcpu, kvm_state->vmx.vmxon_pa))
    > return -EINVAL;
    >
    > - if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
    > - return -EINVAL;
    > -
    > - if (kvm_state->vmx.vmcs_pa == kvm_state->vmx.vmxon_pa ||
    > - !page_address_valid(vcpu, kvm_state->vmx.vmcs_pa))
    > - return -EINVAL;
    > -
    > if ((kvm_state->vmx.smm.flags & KVM_STATE_NESTED_SMM_GUEST_MODE) &&
    > (kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE))
    > return -EINVAL;
    > @@ -14510,6 +14503,14 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
    > if (ret)
    > return ret;
    >
    > + /* Empty 'VMXON' state is permitted */
    > + if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
    > + return 0;
    > +
    > + if (kvm_state->vmx.vmcs_pa == kvm_state->vmx.vmxon_pa ||
    > + !page_address_valid(vcpu, kvm_state->vmx.vmcs_pa))
    > + return -EINVAL;
    > +
    > set_current_vmptr(vmx, kvm_state->vmx.vmcs_pa);
    >
    > if (kvm_state->vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON) {
    >

    \
     
     \ /
      Last update: 2018-10-15 19:11    [W:3.574 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site