1. 05 2月, 2015 2 次提交
    • T
      kvm: remove KVM_MMIO_SIZE · 1c2b364b
      Tiejun Chen 提交于
      After f78146b0, "KVM: Fix page-crossing MMIO", and
      87da7e66, "KVM: x86: fix vcpu->mmio_fragments overflow",
      actually KVM_MMIO_SIZE is gone.
      Signed-off-by: NTiejun Chen <tiejun.chen@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1c2b364b
    • J
      KVM: MIPS: Don't leak FPU/DSP to guest · f798217d
      James Hogan 提交于
      The FPU and DSP are enabled via the CP0 Status CU1 and MX bits by
      kvm_mips_set_c0_status() on a guest exit, presumably in case there is
      active state that needs saving if pre-emption occurs. However neither of
      these bits are cleared again when returning to the guest.
      
      This effectively gives the guest access to the FPU/DSP hardware after
      the first guest exit even though it is not aware of its presence,
      allowing FP instructions in guest user code to intermittently actually
      execute instead of trapping into the guest OS for emulation. It will
      then read & manipulate the hardware FP registers which technically
      belong to the user process (e.g. QEMU), or are stale from another user
      process. It can also crash the guest OS by causing an FP exception, for
      which a guest exception handler won't have been registered.
      
      First lets save and disable the FPU (and MSA) state with lose_fpu(1)
      before entering the guest. This simplifies the problem, especially for
      when guest FPU/MSA support is added in the future, and prevents FR=1 FPU
      state being live when the FR bit gets cleared for the guest, which
      according to the architecture causes the contents of the FPU and vector
      registers to become UNPREDICTABLE.
      
      We can then safely remove the enabling of the FPU in
      kvm_mips_set_c0_status(), since there should never be any active FPU or
      MSA state to save at pre-emption, which should plug the FPU leak.
      
      DSP state is always live rather than being lazily restored, so for that
      it is simpler to just clear the MX bit again when re-entering the guest.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Sanjay Lal <sanjayl@kymasys.com>
      Cc: Gleb Natapov <gleb@kernel.org>
      Cc: kvm@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # v3.10+: 044f0f03: MIPS: KVM: Deliver guest interrupts
      Cc: <stable@vger.kernel.org> # v3.10+
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f798217d
  2. 04 2月, 2015 7 次提交
    • J
      KVM: MIPS: Disable HTW while in guest · c4c6f2ca
      James Hogan 提交于
      Ensure any hardware page table walker (HTW) is disabled while in KVM
      guest mode, as KVM doesn't yet set up hardware page table walking for
      guest mappings so the wrong mappings would get loaded, resulting in the
      guest hanging or crashing once it reaches userland.
      
      The HTW is disabled and re-enabled around the call to
      __kvm_mips_vcpu_run() which does the initial switch into guest mode and
      the final switch out of guest context. Additionally it is enabled for
      the duration of guest exits (i.e. kvm_mips_handle_exit()), getting
      disabled again before returning back to guest or host.
      
      In all cases the HTW is only disabled in normal kernel mode while
      interrupts are disabled, so that the HTW doesn't get left disabled if
      the process is preempted.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Gleb Natapov <gleb@kernel.org>
      Cc: kvm@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # v3.17+
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c4c6f2ca
    • W
      KVM: nVMX: Enable nested posted interrupt processing · 705699a1
      Wincy Van 提交于
      If vcpu has a interrupt in vmx non-root mode, injecting that interrupt
      requires a vmexit.  With posted interrupt processing, the vmexit
      is not needed, and interrupts are fully taken care of by hardware.
      In nested vmx, this feature avoids much more vmexits than non-nested vmx.
      
      When L1 asks L0 to deliver L1's posted interrupt vector, and the target
      VCPU is in non-root mode, we use a physical ipi to deliver POSTED_INTR_NV
      to the target vCPU.  Using POSTED_INTR_NV avoids unexpected interrupts
      if a concurrent vmexit happens and L1's vector is different with L0's.
      The IPI triggers posted interrupt processing in the target physical CPU.
      
      In case the target vCPU was not in guest mode, complete the posted
      interrupt delivery on the next entry to L2.
      Signed-off-by: NWincy Van <fanwenyi0529@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      705699a1
    • W
      KVM: nVMX: Enable nested virtual interrupt delivery · 608406e2
      Wincy Van 提交于
      With virtual interrupt delivery, the hardware lets KVM use a more
      efficient mechanism for interrupt injection. This is an important feature
      for nested VMX, because it reduces vmexits substantially and they are
      much more expensive with nested virtualization.  This is especially
      important for throughput-bound scenarios.
      Signed-off-by: NWincy Van <fanwenyi0529@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      608406e2
    • W
      KVM: nVMX: Enable nested apic register virtualization · 82f0dd4b
      Wincy Van 提交于
      We can reduce apic register virtualization cost with this feature,
      it is also a requirement for virtual interrupt delivery and posted
      interrupt processing.
      Signed-off-by: NWincy Van <fanwenyi0529@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      82f0dd4b
    • W
      KVM: nVMX: Make nested control MSRs per-cpu · b9c237bb
      Wincy Van 提交于
      To enable nested apicv support, we need per-cpu vmx
      control MSRs:
        1. If in-kernel irqchip is enabled, we can enable nested
           posted interrupt, we should set posted intr bit in
           the nested_vmx_pinbased_ctls_high.
        2. If in-kernel irqchip is disabled, we can not enable
           nested posted interrupt, the posted intr bit
           in the nested_vmx_pinbased_ctls_high will be cleared.
      
      Since there would be different settings about in-kernel
      irqchip between VMs, different nested control MSRs
      are needed.
      Signed-off-by: NWincy Van <fanwenyi0529@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b9c237bb
    • W
      KVM: nVMX: Enable nested virtualize x2apic mode · f2b93280
      Wincy Van 提交于
      When L2 is using x2apic, we can use virtualize x2apic mode to
      gain higher performance, especially in apicv case.
      
      This patch also introduces nested_vmx_check_apicv_controls
      for the nested apicv patches.
      Signed-off-by: NWincy Van <fanwenyi0529@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f2b93280
    • W
      KVM: nVMX: Prepare for using hardware MSR bitmap · 3af18d9c
      Wincy Van 提交于
      Currently, if L1 enables MSR_BITMAP, we will emulate this feature, all
      of L2's msr access is intercepted by L0.  Features like "virtualize
      x2apic mode" require that the MSR bitmap is enabled, or the hardware
      will exit and for example not virtualize the x2apic MSRs.  In order to
      let L1 use these features, we need to build a merged bitmap that only
      not cause a VMEXIT if 1) L1 requires that 2) the bit is not required by
      the processor for APIC virtualization.
      
      For now the guests are still run with MSR bitmap disabled, but this
      patch already introduces nested_vmx_merge_msr_bitmap for future use.
      Signed-off-by: NWincy Van <fanwenyi0529@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3af18d9c
  3. 03 2月, 2015 2 次提交
  4. 30 1月, 2015 6 次提交
  5. 29 1月, 2015 5 次提交
  6. 28 1月, 2015 2 次提交
  7. 26 1月, 2015 7 次提交
  8. 23 1月, 2015 9 次提交