]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop queue-5.5/kvm-nvmx-emulate-mtf-when-performing-instruction-emulation.patch
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Mar 2020 08:53:08 +0000 (09:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Mar 2020 08:53:08 +0000 (09:53 +0100)
queue-5.5/kvm-nvmx-emulate-mtf-when-performing-instruction-emulation.patch [deleted file]
queue-5.5/kvm-nvmx-vmwrite-checks-unsupported-field-before-read-only-field.patch
queue-5.5/kvm-nvmx-vmwrite-checks-vmcs-link-pointer-before-vmcs-field.patch
queue-5.5/kvm-x86-remove-spurious-clearing-of-async-pf-msr.patch
queue-5.5/kvm-x86-remove-spurious-kvm_mmu_unload-from-vcpu-destruction-path.patch
queue-5.5/series

diff --git a/queue-5.5/kvm-nvmx-emulate-mtf-when-performing-instruction-emulation.patch b/queue-5.5/kvm-nvmx-emulate-mtf-when-performing-instruction-emulation.patch
deleted file mode 100644 (file)
index 7d6f0a9..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-From 5ef8acbdd687c9d72582e2c05c0b9756efb37863 Mon Sep 17 00:00:00 2001
-From: Oliver Upton <oupton@google.com>
-Date: Fri, 7 Feb 2020 02:36:07 -0800
-Subject: KVM: nVMX: Emulate MTF when performing instruction emulation
-
-From: Oliver Upton <oupton@google.com>
-
-commit 5ef8acbdd687c9d72582e2c05c0b9756efb37863 upstream.
-
-Since commit 5f3d45e7f282 ("kvm/x86: add support for
-MONITOR_TRAP_FLAG"), KVM has allowed an L1 guest to use the monitor trap
-flag processor-based execution control for its L2 guest. KVM simply
-forwards any MTF VM-exits to the L1 guest, which works for normal
-instruction execution.
-
-However, when KVM needs to emulate an instruction on the behalf of an L2
-guest, the monitor trap flag is not emulated. Add the necessary logic to
-kvm_skip_emulated_instruction() to synthesize an MTF VM-exit to L1 upon
-instruction emulation for L2.
-
-Fixes: 5f3d45e7f282 ("kvm/x86: add support for MONITOR_TRAP_FLAG")
-Signed-off-by: Oliver Upton <oupton@google.com>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/kvm_host.h |    1 +
- arch/x86/include/uapi/asm/kvm.h |    1 +
- arch/x86/kvm/svm.c              |    1 +
- arch/x86/kvm/vmx/nested.c       |   35 ++++++++++++++++++++++++++++++++++-
- arch/x86/kvm/vmx/nested.h       |    5 +++++
- arch/x86/kvm/vmx/vmx.c          |   37 ++++++++++++++++++++++++++++++++++++-
- arch/x86/kvm/vmx/vmx.h          |    3 +++
- arch/x86/kvm/x86.c              |    2 ++
- 8 files changed, 83 insertions(+), 2 deletions(-)
-
---- a/arch/x86/include/asm/kvm_host.h
-+++ b/arch/x86/include/asm/kvm_host.h
-@@ -1092,6 +1092,7 @@ struct kvm_x86_ops {
-       void (*run)(struct kvm_vcpu *vcpu);
-       int (*handle_exit)(struct kvm_vcpu *vcpu);
-       int (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
-+      void (*update_emulated_instruction)(struct kvm_vcpu *vcpu);
-       void (*set_interrupt_shadow)(struct kvm_vcpu *vcpu, int mask);
-       u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu);
-       void (*patch_hypercall)(struct kvm_vcpu *vcpu,
---- a/arch/x86/include/uapi/asm/kvm.h
-+++ b/arch/x86/include/uapi/asm/kvm.h
-@@ -390,6 +390,7 @@ struct kvm_sync_regs {
- #define KVM_STATE_NESTED_GUEST_MODE   0x00000001
- #define KVM_STATE_NESTED_RUN_PENDING  0x00000002
- #define KVM_STATE_NESTED_EVMCS                0x00000004
-+#define KVM_STATE_NESTED_MTF_PENDING  0x00000008
- #define KVM_STATE_NESTED_SMM_GUEST_MODE       0x00000001
- #define KVM_STATE_NESTED_SMM_VMXON    0x00000002
---- a/arch/x86/kvm/svm.c
-+++ b/arch/x86/kvm/svm.c
-@@ -7311,6 +7311,7 @@ static struct kvm_x86_ops svm_x86_ops __
-       .run = svm_vcpu_run,
-       .handle_exit = handle_exit,
-       .skip_emulated_instruction = skip_emulated_instruction,
-+      .update_emulated_instruction = NULL,
-       .set_interrupt_shadow = svm_set_interrupt_shadow,
-       .get_interrupt_shadow = svm_get_interrupt_shadow,
-       .patch_hypercall = svm_patch_hypercall,
---- a/arch/x86/kvm/vmx/nested.c
-+++ b/arch/x86/kvm/vmx/nested.c
-@@ -3616,8 +3616,15 @@ static int vmx_check_nested_events(struc
-       unsigned long exit_qual;
-       bool block_nested_events =
-           vmx->nested.nested_run_pending || kvm_event_needs_reinjection(vcpu);
-+      bool mtf_pending = vmx->nested.mtf_pending;
-       struct kvm_lapic *apic = vcpu->arch.apic;
-+      /*
-+       * Clear the MTF state. If a higher priority VM-exit is delivered first,
-+       * this state is discarded.
-+       */
-+      vmx->nested.mtf_pending = false;
-+
-       if (lapic_in_kernel(vcpu) &&
-               test_bit(KVM_APIC_INIT, &apic->pending_events)) {
-               if (block_nested_events)
-@@ -3628,8 +3635,28 @@ static int vmx_check_nested_events(struc
-               return 0;
-       }
-+      /*
-+       * Process any exceptions that are not debug traps before MTF.
-+       */
-+      if (vcpu->arch.exception.pending &&
-+          !vmx_pending_dbg_trap(vcpu) &&
-+          nested_vmx_check_exception(vcpu, &exit_qual)) {
-+              if (block_nested_events)
-+                      return -EBUSY;
-+              nested_vmx_inject_exception_vmexit(vcpu, exit_qual);
-+              return 0;
-+      }
-+
-+      if (mtf_pending) {
-+              if (block_nested_events)
-+                      return -EBUSY;
-+              nested_vmx_update_pending_dbg(vcpu);
-+              nested_vmx_vmexit(vcpu, EXIT_REASON_MONITOR_TRAP_FLAG, 0, 0);
-+              return 0;
-+      }
-+
-       if (vcpu->arch.exception.pending &&
--              nested_vmx_check_exception(vcpu, &exit_qual)) {
-+          nested_vmx_check_exception(vcpu, &exit_qual)) {
-               if (block_nested_events)
-                       return -EBUSY;
-               nested_vmx_inject_exception_vmexit(vcpu, exit_qual);
-@@ -5742,6 +5769,9 @@ static int vmx_get_nested_state(struct k
-                       if (vmx->nested.nested_run_pending)
-                               kvm_state.flags |= KVM_STATE_NESTED_RUN_PENDING;
-+
-+                      if (vmx->nested.mtf_pending)
-+                              kvm_state.flags |= KVM_STATE_NESTED_MTF_PENDING;
-               }
-       }
-@@ -5922,6 +5952,9 @@ static int vmx_set_nested_state(struct k
-       vmx->nested.nested_run_pending =
-               !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING);
-+      vmx->nested.mtf_pending =
-+              !!(kvm_state->flags & KVM_STATE_NESTED_MTF_PENDING);
-+
-       ret = -EINVAL;
-       if (nested_cpu_has_shadow_vmcs(vmcs12) &&
-           vmcs12->vmcs_link_pointer != -1ull) {
---- a/arch/x86/kvm/vmx/nested.h
-+++ b/arch/x86/kvm/vmx/nested.h
-@@ -176,6 +176,11 @@ static inline bool nested_cpu_has_virtua
-       return vmcs12->pin_based_vm_exec_control & PIN_BASED_VIRTUAL_NMIS;
- }
-+static inline int nested_cpu_has_mtf(struct vmcs12 *vmcs12)
-+{
-+      return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_TRAP_FLAG);
-+}
-+
- static inline int nested_cpu_has_ept(struct vmcs12 *vmcs12)
- {
-       return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_EPT);
---- a/arch/x86/kvm/vmx/vmx.c
-+++ b/arch/x86/kvm/vmx/vmx.c
-@@ -1595,6 +1595,40 @@ static int skip_emulated_instruction(str
-       return 1;
- }
-+
-+/*
-+ * Recognizes a pending MTF VM-exit and records the nested state for later
-+ * delivery.
-+ */
-+static void vmx_update_emulated_instruction(struct kvm_vcpu *vcpu)
-+{
-+      struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
-+      struct vcpu_vmx *vmx = to_vmx(vcpu);
-+
-+      if (!is_guest_mode(vcpu))
-+              return;
-+
-+      /*
-+       * Per the SDM, MTF takes priority over debug-trap exceptions besides
-+       * T-bit traps. As instruction emulation is completed (i.e. at the
-+       * instruction boundary), any #DB exception pending delivery must be a
-+       * debug-trap. Record the pending MTF state to be delivered in
-+       * vmx_check_nested_events().
-+       */
-+      if (nested_cpu_has_mtf(vmcs12) &&
-+          (!vcpu->arch.exception.pending ||
-+           vcpu->arch.exception.nr == DB_VECTOR))
-+              vmx->nested.mtf_pending = true;
-+      else
-+              vmx->nested.mtf_pending = false;
-+}
-+
-+static int vmx_skip_emulated_instruction(struct kvm_vcpu *vcpu)
-+{
-+      vmx_update_emulated_instruction(vcpu);
-+      return skip_emulated_instruction(vcpu);
-+}
-+
- static void vmx_clear_hlt(struct kvm_vcpu *vcpu)
- {
-       /*
-@@ -7886,7 +7920,8 @@ static struct kvm_x86_ops vmx_x86_ops __
-       .run = vmx_vcpu_run,
-       .handle_exit = vmx_handle_exit,
--      .skip_emulated_instruction = skip_emulated_instruction,
-+      .skip_emulated_instruction = vmx_skip_emulated_instruction,
-+      .update_emulated_instruction = vmx_update_emulated_instruction,
-       .set_interrupt_shadow = vmx_set_interrupt_shadow,
-       .get_interrupt_shadow = vmx_get_interrupt_shadow,
-       .patch_hypercall = vmx_patch_hypercall,
---- a/arch/x86/kvm/vmx/vmx.h
-+++ b/arch/x86/kvm/vmx/vmx.h
-@@ -150,6 +150,9 @@ struct nested_vmx {
-       /* L2 must run next, and mustn't decide to exit to L1. */
-       bool nested_run_pending;
-+      /* Pending MTF VM-exit into L1.  */
-+      bool mtf_pending;
-+
-       struct loaded_vmcs vmcs02;
-       /*
---- a/arch/x86/kvm/x86.c
-+++ b/arch/x86/kvm/x86.c
-@@ -6838,6 +6838,8 @@ restart:
-                       kvm_rip_write(vcpu, ctxt->eip);
-                       if (r && ctxt->tf)
-                               r = kvm_vcpu_do_singlestep(vcpu);
-+                      if (kvm_x86_ops->update_emulated_instruction)
-+                              kvm_x86_ops->update_emulated_instruction(vcpu);
-                       __kvm_set_rflags(vcpu, ctxt->eflags);
-               }
index 3081720ac59298be46be6b0d6aa7681d220d47fd..f2706ac38bab4104c5ac359901fc90a81236bc47 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/arch/x86/kvm/vmx/nested.c
 +++ b/arch/x86/kvm/vmx/nested.c
-@@ -4940,6 +4940,12 @@ static int handle_vmwrite(struct kvm_vcp
+@@ -4913,6 +4913,12 @@ static int handle_vmwrite(struct kvm_vcp
  
  
        field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
@@ -41,7 +41,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        /*
         * If the vCPU supports "VMWRITE to any supported field in the
         * VMCS," then the "read-only" fields are actually read/write.
-@@ -4956,11 +4962,6 @@ static int handle_vmwrite(struct kvm_vcp
+@@ -4929,11 +4935,6 @@ static int handle_vmwrite(struct kvm_vcp
        if (!is_guest_mode(vcpu) && !is_shadow_field_rw(field))
                copy_vmcs02_to_vmcs12_rare(vcpu, vmcs12);
  
index 074cfac1cb375ca87f8f8b22f246b5b106adc654..35c1c936460f6552b453e6b7a6eaa7e286fedcb5 100644 (file)
@@ -31,7 +31,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/arch/x86/kvm/vmx/nested.c
 +++ b/arch/x86/kvm/vmx/nested.c
-@@ -4808,32 +4808,28 @@ static int handle_vmread(struct kvm_vcpu
+@@ -4781,32 +4781,28 @@ static int handle_vmread(struct kvm_vcpu
  {
        unsigned long field;
        u64 field_value;
@@ -74,7 +74,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        /* Decode instruction info and find the field to read */
        field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
  
-@@ -4912,13 +4908,20 @@ static int handle_vmwrite(struct kvm_vcp
+@@ -4885,13 +4881,20 @@ static int handle_vmwrite(struct kvm_vcp
         */
        u64 field_value = 0;
        struct x86_exception e;
@@ -97,7 +97,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
                return nested_vmx_failInvalid(vcpu);
  
        if (vmx_instruction_info & (1u << 10))
-@@ -4946,24 +4949,12 @@ static int handle_vmwrite(struct kvm_vcp
+@@ -4919,24 +4922,12 @@ static int handle_vmwrite(struct kvm_vcp
                return nested_vmx_failValid(vcpu,
                        VMXERR_VMWRITE_READ_ONLY_VMCS_COMPONENT);
  
index 881bce705ec85b1e3774794e85f391eed301cbce..7fd9ef8eed24e73a55bbf4054d9986e140830d00 100644 (file)
@@ -30,7 +30,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
-@@ -9227,8 +9227,6 @@ void kvm_arch_vcpu_postcreate(struct kvm
+@@ -9225,8 +9225,6 @@ void kvm_arch_vcpu_postcreate(struct kvm
  
  void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
  {
index 07eee63bb8adeed1178e548546cd6111ed39b4ff..84ec1d159ee44f1a503c3b3851d2a8545bcd5f7c 100644 (file)
@@ -27,7 +27,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/arch/x86/kvm/x86.c
 +++ b/arch/x86/kvm/x86.c
-@@ -9229,10 +9229,6 @@ void kvm_arch_vcpu_destroy(struct kvm_vc
+@@ -9227,10 +9227,6 @@ void kvm_arch_vcpu_destroy(struct kvm_vc
  {
        vcpu->arch.apf.msr_val = 0;
  
index f4afc3e0e6143e52b7867976a55be053e59148c9..a2db600fc9b5afb43b0d0ae3cb3c49072cfecf09 100644 (file)
@@ -107,7 +107,6 @@ hid-alps-fix-an-error-handling-path-in-alps_input_configured.patch
 hid-hiddev-fix-race-in-in-hiddev_disconnect.patch
 risc-v-don-t-enable-all-interrupts-in-trap_init.patch
 mips-vpe-fix-a-double-free-and-a-memory-leak-in-release_vpe.patch
-kvm-nvmx-emulate-mtf-when-performing-instruction-emulation.patch
 i2c-altera-fix-potential-integer-overflow.patch
 i2c-jz4780-silence-log-flood-on-txabrt.patch
 mips-cavium_octeon-fix-syncw-generation.patch