1. 03 3月, 2020 2 次提交
    • H
      KVM: SVM: Fix the svm vmexit code for WRMSR · aaca2100
      Haiwei Li 提交于
      In svm, exit_code for MSR writes is not EXIT_REASON_MSR_WRITE which
      belongs to vmx.
      
      According to amd manual, SVM_EXIT_MSR(7ch) is the exit_code of VMEXIT_MSR
      due to RDMSR or WRMSR access to protected MSR. Additionally, the processor
      indicates in the VMCB's EXITINFO1 whether a RDMSR(EXITINFO1=0) or
      WRMSR(EXITINFO1=1) was intercepted.
      Signed-off-by: NHaiwei Li <lihaiwei@tencent.com>
      Fixes: 1e9e2622 ("KVM: VMX: FIXED+PHYSICAL mode single target IPI fastpath", 2019-11-21)
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      aaca2100
    • W
      KVM: X86: Fix dereference null cpufreq policy · 9a11997e
      Wanpeng Li 提交于
      Naresh Kamboju reported:
      
         Linux version 5.6.0-rc4 (oe-user@oe-host) (gcc version
        (GCC)) #1 SMP Sun Mar 1 22:59:08 UTC 2020
         kvm: no hardware support
         BUG: kernel NULL pointer dereference, address: 000000000000028c
         #PF: supervisor read access in kernel mode
         #PF: error_code(0x0000) - not-present page
         PGD 0 P4D 0
         Oops: 0000 [#1] SMP NOPTI
         CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.6.0-rc4 #1
         Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
        04/01/2014
         RIP: 0010:kobject_put+0x12/0x1c0
         Call Trace:
          cpufreq_cpu_put+0x15/0x20
          kvm_arch_init+0x1f6/0x2b0
          kvm_init+0x31/0x290
          ? svm_check_processor_compat+0xd/0xd
          ? svm_check_processor_compat+0xd/0xd
          svm_init+0x21/0x23
          do_one_initcall+0x61/0x2f0
          ? rdinit_setup+0x30/0x30
          ? rcu_read_lock_sched_held+0x4f/0x80
          kernel_init_freeable+0x219/0x279
          ? rest_init+0x250/0x250
          kernel_init+0xe/0x110
          ret_from_fork+0x27/0x50
         Modules linked in:
         CR2: 000000000000028c
         ---[ end trace 239abf40c55c409b ]---
         RIP: 0010:kobject_put+0x12/0x1c0
      
      cpufreq policy which is get by cpufreq_cpu_get() can be NULL if it is failure,
      this patch takes care of it.
      
      Fixes: aaec7c03 (KVM: x86: avoid useless copy of cpufreq policy)
      Reported-by: NNaresh Kamboju <naresh.kamboju@linaro.org>
      Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
      Signed-off-by: NWanpeng Li <wanpengli@tencent.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9a11997e
  2. 02 3月, 2020 1 次提交
  3. 28 2月, 2020 7 次提交
  4. 23 2月, 2020 5 次提交
  5. 22 2月, 2020 8 次提交
  6. 21 2月, 2020 2 次提交
  7. 17 2月, 2020 1 次提交
  8. 13 2月, 2020 8 次提交
  9. 12 2月, 2020 4 次提交
    • O
      KVM: x86: Deliver exception payload on KVM_GET_VCPU_EVENTS · a06230b6
      Oliver Upton 提交于
      KVM allows the deferral of exception payloads when a vCPU is in guest
      mode to allow the L1 hypervisor to intercept certain events (#PF, #DB)
      before register state has been modified. However, this behavior is
      incompatible with the KVM_{GET,SET}_VCPU_EVENTS ABI, as userspace
      expects register state to have been immediately modified. Userspace may
      opt-in for the payload deferral behavior with the
      KVM_CAP_EXCEPTION_PAYLOAD per-VM capability. As such,
      kvm_multiple_exception() will immediately manipulate guest registers if
      the capability hasn't been requested.
      
      Since the deferral is only necessary if a userspace ioctl were to be
      serviced at the same as a payload bearing exception is recognized, this
      behavior can be relaxed. Instead, opportunistically defer the payload
      from kvm_multiple_exception() and deliver the payload before completing
      a KVM_GET_VCPU_EVENTS ioctl.
      Signed-off-by: NOliver Upton <oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a06230b6
    • O
      KVM: nVMX: Handle pending #DB when injecting INIT VM-exit · 684c0422
      Oliver Upton 提交于
      SDM 27.3.4 states that the 'pending debug exceptions' VMCS field will
      be populated if a VM-exit caused by an INIT signal takes priority over a
      debug-trap. Emulate this behavior when synthesizing an INIT signal
      VM-exit into L1.
      
      Fixes: 4b9852f4 ("KVM: x86: Fix INIT signal handling in various CPU states")
      Signed-off-by: NOliver Upton <oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      684c0422
    • O
      KVM: x86: Mask off reserved bit from #DB exception payload · 307f1cfa
      Oliver Upton 提交于
      KVM defines the #DB payload as compatible with the 'pending debug
      exceptions' field under VMX, not DR6. Mask off bit 12 when applying the
      payload to DR6, as it is reserved on DR6 but not the 'pending debug
      exceptions' field.
      
      Fixes: f10c729f ("kvm: vmx: Defer setting of DR6 until #DB delivery")
      Signed-off-by: NOliver Upton <oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      307f1cfa
    • P
      KVM: x86: do not reset microcode version on INIT or RESET · bab0c318
      Paolo Bonzini 提交于
      Do not initialize the microcode version at RESET or INIT, only on vCPU
      creation.   Microcode updates are not lost during INIT, and exact
      behavior across a warm RESET is not specified by the architecture.
      
      Since we do not support a microcode update directly from the hypervisor,
      but only as a result of userspace setting the microcode version MSR,
      it's simpler for userspace if we do nothing in KVM and let userspace
      emulate behavior for RESET as it sees fit.
      
      Userspace can tie the fix to the availability of MSR_IA32_UCODE_REV in
      the list of emulated MSRs.
      Reported-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      bab0c318
  10. 08 2月, 2020 2 次提交