1. 21 Apr, 2020 23 commits
  2. 20 Apr, 2020 3 commits
  3. 15 Apr, 2020 5 commits
  4. 07 Apr, 2020 1 commit
  5. 31 Mar, 2020 2 commits
  6. 18 Mar, 2020 1 commit
  7. 16 Mar, 2020 5 commits
    • Vitaly Kuznetsov's avatar
      KVM: nVMX: properly handle errors in nested_vmx_handle_enlightened_vmptrld() · b6a0653a
      Vitaly Kuznetsov authored
      nested_vmx_handle_enlightened_vmptrld() fails in two cases:
      - when we fail to kvm_vcpu_map() the supplied GPA
      - when revision_id is incorrect.
      Genuine Hyper-V raises #UD in the former case (at least with *some*
      incorrect GPAs) and does VMfailInvalid() in the later. KVM doesn't do
      anything so L1 just gets stuck retrying the same faulty VMLAUNCH.
      nested_vmx_handle_enlightened_vmptrld() has two call sites:
      nested_vmx_run() and nested_get_vmcs12_pages(). The former needs to queue
      do much: the failure there happens after migration when L2 was running (and
      L1 did something weird like wrote to VP assist page from a different vCPU),
      just kill L1 with KVM_EXIT_INTERNAL_ERROR.
      Reported-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      [Squash kbuild autopatch. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    • Vitaly Kuznetsov's avatar
      KVM: nVMX: stop abusing need_vmcs12_to_shadow_sync for eVMCS mapping · e942dbf8
      Vitaly Kuznetsov authored
      When vmx_set_nested_state() happens, we may not have all the required
      data to map enlightened VMCS: e.g. HV_X64_MSR_VP_ASSIST_PAGE MSR may not
      yet be restored so we need a postponed action. Currently, we (ab)use
      need_vmcs12_to_shadow_sync/nested_sync_vmcs12_to_shadow() for that but
      this is not ideal:
      - We may not need to sync anything if L2 is running
      - It is hard to propagate errors from nested_sync_vmcs12_to_shadow()
       as we call it from vmx_prepare_switch_to_guest() which happens just
       before we do VMLAUNCH, the code is not ready to handle errors there.
      Move eVMCS mapping to nested_get_vmcs12_pages() and request
      KVM_REQ_GET_VMCS12_PAGES, it seems to be is less abusive in nature.
      It would probably be possible to introduce a specialized KVM_REQ_EVMCS_MAP
      but it is undesirable to propagate eVMCS specifics all the way up to x86.c
      Note, we don't need to request KVM_REQ_GET_VMCS12_PAGES from
      vmx_set_nested_state() directly as nested_vmx_enter_non_root_mode() already
      does that. Requesting KVM_REQ_GET_VMCS12_PAGES is done to document the
      (non-obvious) side-effect and to be future proof.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    • Oliver Upton's avatar
      KVM: nVMX: Consolidate nested MTF checks to helper function · 212617db
      Oliver Upton authored
      commit 5ef8acbd
       ("KVM: nVMX: Emulate MTF when performing
      instruction emulation") introduced a helper to check the MTF
      VM-execution control in vmcs12. Change pre-existing check in
      nested_vmx_exit_reflected() to instead use the helper.
      Signed-off-by: default avatarOliver Upton <oupton@google.com>
      Reviewed-by: default avatarKrish Sadhukhan <krish.sadhukhan@oracle.com>
      Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    • Paolo Bonzini's avatar
      KVM: x86: rename set_cr3 callback and related flags to load_mmu_pgd · 727a7e27
      Paolo Bonzini authored
      The set_cr3 callback is not setting the guest CR3, it is setting the
      root of the guest page tables, either shadow or two-dimensional.
      To make this clearer as well as to indicate that the MMU calls it
      via kvm_mmu_load_cr3, rename it to load_mmu_pgd.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    • Paolo Bonzini's avatar
      KVM: x86: unify callbacks to load paging root · 689f3bf2
      Paolo Bonzini authored
      Similar to what kvm-intel.ko is doing, provide a single callback that
      merges svm_set_cr3, set_tdp_cr3 and nested_svm_set_tdp_cr3.
      This lets us unify the set_cr3 and set_tdp_cr3 entries in kvm_x86_ops.
      I'm doing that in this same patch because splitting it adds quite a bit
      of churn due to the need for forward declarations.  For the same reason
      the assignment to vcpu->arch.mmu->set_cr3 is moved to kvm_init_shadow_mmu
      from init_kvm_softmmu and nested_svm_init_mmu_context.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>