1. 24 3月, 2009 14 次提交
    • A
      KVM: SVM: Add microcode patch level dummy · c8a73f18
      Alexander Graf 提交于
      VMware ESX checks if the microcode level is correct when using a barcelona
      CPU, in order to see if it actually can use SVM. Let's tell it we're on the
      safe side...
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      c8a73f18
    • J
      KVM: x86: Wire-up hardware breakpoints for guest debugging · ae675ef0
      Jan Kiszka 提交于
      Add the remaining bits to make use of debug registers also for guest
      debugging, thus enabling the use of hardware breakpoints and
      watchpoints.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      ae675ef0
    • J
      KVM: x86: Virtualize debug registers · 42dbaa5a
      Jan Kiszka 提交于
      So far KVM only had basic x86 debug register support, once introduced to
      realize guest debugging that way. The guest itself was not able to use
      those registers.
      
      This patch now adds (almost) full support for guest self-debugging via
      hardware registers. It refactors the code, moving generic parts out of
      SVM (VMX was already cleaned up by the KVM_SET_GUEST_DEBUG patches), and
      it ensures that the registers are properly switched between host and
      guest.
      
      This patch also prepares debug register usage by the host. The latter
      will (once wired-up by the following patch) allow for hardware
      breakpoints/watchpoints in guest code. If this is enabled, the guest
      will only see faked debug registers without functionality, but with
      content reflecting the guest's modifications.
      
      Tested on Intel only, but SVM /should/ work as well, but who knows...
      
      Known limitations: Trapping on tss switch won't work - most probably on
      Intel.
      
      Credits also go to Joerg Roedel - I used his once posted debugging
      series as platform for this patch.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      42dbaa5a
    • J
      KVM: New guest debug interface · d0bfb940
      Jan Kiszka 提交于
      This rips out the support for KVM_DEBUG_GUEST and introduces a new IOCTL
      instead: KVM_SET_GUEST_DEBUG. The IOCTL payload consists of a generic
      part, controlling the "main switch" and the single-step feature. The
      arch specific part adds an x86 interface for intercepting both types of
      debug exceptions separately and re-injecting them when the host was not
      interested. Moveover, the foundation for guest debugging via debug
      registers is layed.
      
      To signal breakpoint events properly back to userland, an arch-specific
      data block is now returned along KVM_EXIT_DEBUG. For x86, the arch block
      contains the PC, the debug exception, and relevant debug registers to
      tell debug events properly apart.
      
      The availability of this new interface is signaled by
      KVM_CAP_SET_GUEST_DEBUG. Empty stubs for not yet supported archs are
      provided.
      
      Note that both SVM and VTX are supported, but only the latter was tested
      yet. Based on the experience with all those VTX corner case, I would be
      fairly surprised if SVM will work out of the box.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d0bfb940
    • A
      KVM: SVM: Allow setting the SVME bit · 236de055
      Alexander Graf 提交于
      Normally setting the SVME bit in EFER is not allowed, as we did
      not support SVM. Not since we do, we should also allow enabling
      SVM mode.
      
      v2 comes as last patch, so we don't enable half-ready code
      v4 introduces a module option to enable SVM
      v6 warns that nesting is enabled
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      236de055
    • J
      KVM: SVM: Allow read access to MSR_VM_VR · eb6f302e
      Joerg Roedel 提交于
      KVM tries to read the VM_CR MSR to find out if SVM was disabled by
      the BIOS. So implement read support for this MSR to make nested
      SVM running.
      Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      eb6f302e
    • A
      KVM: SVM: Add VMEXIT handler and intercepts · cf74a78b
      Alexander Graf 提交于
      This adds the #VMEXIT intercept, so we return to the level 1 guest
      when something happens in the level 2 guest that should return to
      the level 1 guest.
      
      v2 implements HIF handling and cleans up exception interception
      v3 adds support for V_INTR_MASKING_MASK
      v4 uses the host page hsave
      v5 removes IOPM merging code
      v6 moves mmu code out of the atomic section
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      cf74a78b
    • A
      KVM: SVM: Add VMRUN handler · 3d6368ef
      Alexander Graf 提交于
      This patch implements VMRUN. VMRUN enters a virtual CPU and runs that
      in the same context as the normal guest CPU would run.
      So basically it is implemented the same way, a normal CPU would do it.
      
      We also prepare all intercepts that get OR'ed with the original
      intercepts, as we do not allow a level 2 guest to be intercepted less
      than the first level guest.
      
      v2 implements the following improvements:
      
      - fixes the CPL check
      - does not allocate iopm when not used
      - remembers the host's IF in the HIF bit in the hflags
      
      v3:
      
      - make use of the new permission checking
      - add support for V_INTR_MASKING_MASK
      
      v4:
      
      - use host page backed hsave
      
      v5:
      
      - remove IOPM merging code
      
      v6:
      
      - save cr4 so PAE l1 guests work
      
      v7:
      
      - return 0 on vmrun so we check the MSRs too
      - fix MSR check to use the correct variable
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      3d6368ef
    • A
      KVM: SVM: Add VMLOAD and VMSAVE handlers · 5542675b
      Alexander Graf 提交于
      This implements the VMLOAD and VMSAVE instructions, that usually surround
      the VMRUN instructions. Both instructions load / restore the same elements,
      so we only need to implement them once.
      
      v2 fixes CPL checking and replaces memcpy by assignments
      v3 makes use of the new permission checking
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      5542675b
    • A
      KVM: SVM: Implement hsave · b286d5d8
      Alexander Graf 提交于
      Implement the hsave MSR, that gives the VCPU a GPA to save the
      old guest state in.
      
      v2 allows userspace to save/restore hsave
      v4 dummys out the hsave MSR, so we use a host page
      v6 remembers the guest's hsave and exports the MSR
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      b286d5d8
    • A
      KVM: SVM: Implement GIF, clgi and stgi · 1371d904
      Alexander Graf 提交于
      This patch implements the GIF flag and the clgi and stgi instructions that
      set this flag. Only if the flag is set (default), interrupts can be received by
      the CPU.
      
      To keep the information about that somewhere, this patch adds a new hidden
      flags vector. that is used to store information that does not go into the
      vmcb, but is SVM specific.
      
      I tried to write some code to make -no-kvm-irqchip work too, but the first
      level guest won't even boot with that atm, so I ditched it.
      
      v2 moves the hflags to x86 generic code
      v3 makes use of the new permission helper
      v6 only enables interrupt_window if GIF=1
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      1371d904
    • A
      KVM: SVM: Add helper functions for nested SVM · c0725420
      Alexander Graf 提交于
      These are helpers for the nested SVM implementation.
      
      - nsvm_printk implements a debug printk variant
      - nested_svm_do calls a handler that can accesses gpa-based memory
      
      v3 makes use of the new permission checker
      v6 changes:
      - streamline nsvm_debug()
      - remove printk(KERN_ERR)
      - SVME check before CPL check
      - give GP error code
      - use new EFER constant
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      c0725420
    • A
      KVM: SVM: Move EFER and MSR constants to generic x86 code · 9962d032
      Alexander Graf 提交于
      MSR_EFER_SVME_MASK, MSR_VM_CR and MSR_VM_HSAVE_PA are set in KVM
      specific headers. Linux does have nice header files to collect
      EFER bits and MSR IDs, so IMHO we should put them there.
      
      While at it, I also changed the naming scheme to match that
      of the other defines.
      
      (introduced in v6)
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      9962d032
    • A
      KVM: SVM: Clean up VINTR setting · f0b85051
      Alexander Graf 提交于
      The current VINTR intercept setters don't look clean to me. To make
      the code easier to read and enable the possibilty to trap on a VINTR
      set, this uses a helper function to set the VINTR intercept.
      
      v2 uses two distinct functions for setting and clearing the bit
      Acked-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      f0b85051
  2. 15 2月, 2009 1 次提交
  3. 31 12月, 2008 6 次提交
  4. 15 10月, 2008 7 次提交
  5. 11 9月, 2008 2 次提交
  6. 27 7月, 2008 2 次提交
  7. 20 7月, 2008 8 次提交