1. 12 7月, 2011 11 次提交
    • N
      KVM: nVMX: Add VMCS fields to the vmcs12 · 22bd0358
      Nadav Har'El 提交于
      In this patch we add to vmcs12 (the VMCS that L1 keeps for L2) all the
      standard VMCS fields.
      
      Later patches will enable L1 to read and write these fields using VMREAD/
      VMWRITE, and they will be used during a VMLAUNCH/VMRESUME in preparing vmcs02,
      a hardware VMCS for running L2.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      22bd0358
    • N
      KVM: nVMX: Introduce vmcs02: VMCS used to run L2 · ff2f6fe9
      Nadav Har'El 提交于
      We saw in a previous patch that L1 controls its L2 guest with a vcms12.
      L0 needs to create a real VMCS for running L2. We call that "vmcs02".
      A later patch will contain the code, prepare_vmcs02(), for filling the vmcs02
      fields. This patch only contains code for allocating vmcs02.
      
      In this version, prepare_vmcs02() sets *all* of vmcs02's fields each time we
      enter from L1 to L2, so keeping just one vmcs02 for the vcpu is enough: It can
      be reused even when L1 runs multiple L2 guests. However, in future versions
      we'll probably want to add an optimization where vmcs02 fields that rarely
      change will not be set each time. For that, we may want to keep around several
      vmcs02s of L2 guests that have recently run, so that potentially we could run
      these L2s again more quickly because less vmwrites to vmcs02 will be needed.
      
      This patch adds to each vcpu a vmcs02 pool, vmx->nested.vmcs02_pool,
      which remembers the vmcs02s last used to run up to VMCS02_POOL_SIZE L2s.
      As explained above, in the current version we choose VMCS02_POOL_SIZE=1,
      I.e., one vmcs02 is allocated (and loaded onto the processor), and it is
      reused to enter any L2 guest. In the future, when prepare_vmcs02() is
      optimized not to set all fields every time, VMCS02_POOL_SIZE should be
      increased.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      ff2f6fe9
    • N
      KVM: nVMX: Decoding memory operands of VMX instructions · 064aea77
      Nadav Har'El 提交于
      This patch includes a utility function for decoding pointer operands of VMX
      instructions issued by L1 (a guest hypervisor)
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      064aea77
    • N
      KVM: nVMX: Implement reading and writing of VMX MSRs · b87a51ae
      Nadav Har'El 提交于
      When the guest can use VMX instructions (when the "nested" module option is
      on), it should also be able to read and write VMX MSRs, e.g., to query about
      VMX capabilities. This patch adds this support.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      b87a51ae
    • N
      KVM: nVMX: Introduce vmcs12: a VMCS structure for L1 · a9d30f33
      Nadav Har'El 提交于
      An implementation of VMX needs to define a VMCS structure. This structure
      is kept in guest memory, but is opaque to the guest (who can only read or
      write it with VMX instructions).
      
      This patch starts to define the VMCS structure which our nested VMX
      implementation will present to L1. We call it "vmcs12", as it is the VMCS
      that L1 keeps for its L2 guest. We will add more content to this structure
      in later patches.
      
      This patch also adds the notion (as required by the VMX spec) of L1's "current
      VMCS", and finally includes utility functions for mapping the guest-allocated
      VMCSs in host memory.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      a9d30f33
    • N
      KVM: nVMX: Allow setting the VMXE bit in CR4 · 5e1746d6
      Nadav Har'El 提交于
      This patch allows the guest to enable the VMXE bit in CR4, which is a
      prerequisite to running VMXON.
      
      Whether to allow setting the VMXE bit now depends on the architecture (svm
      or vmx), so its checking has moved to kvm_x86_ops->set_cr4(). This function
      now returns an int: If kvm_x86_ops->set_cr4() returns 1, __kvm_set_cr4()
      will also return 1, and this will cause kvm_set_cr4() will throw a #GP.
      
      Turning on the VMXE bit is allowed only when the nested VMX feature is
      enabled, and turning it off is forbidden after a vmxon.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      5e1746d6
    • N
      KVM: nVMX: Implement VMXON and VMXOFF · ec378aee
      Nadav Har'El 提交于
      This patch allows a guest to use the VMXON and VMXOFF instructions, and
      emulates them accordingly. Basically this amounts to checking some
      prerequisites, and then remembering whether the guest has enabled or disabled
      VMX operation.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      ec378aee
    • N
      KVM: nVMX: Add "nested" module option to kvm_intel · 801d3424
      Nadav Har'El 提交于
      This patch adds to kvm_intel a module option "nested". This option controls
      whether the guest can use VMX instructions, i.e., whether we allow nested
      virtualization. A similar, but separate, option already exists for the
      SVM module.
      
      This option currently defaults to 0, meaning that nested VMX must be
      explicitly enabled by giving nested=1. When nested VMX matures, the default
      should probably be changed to enable nested VMX by default - just like
      nested SVM is currently enabled by default.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      801d3424
    • N
      KVM: VMX: Keep list of loaded VMCSs, instead of vcpus · d462b819
      Nadav Har'El 提交于
      In VMX, before we bring down a CPU we must VMCLEAR all VMCSs loaded on it
      because (at least in theory) the processor might not have written all of its
      content back to memory. Since a patch from June 26, 2008, this is done using
      a per-cpu "vcpus_on_cpu" linked list of vcpus loaded on each CPU.
      
      The problem is that with nested VMX, we no longer have the concept of a
      vcpu being loaded on a cpu: A vcpu has multiple VMCSs (one for L1, a pool for
      L2s), and each of those may be have been last loaded on a different cpu.
      
      So instead of linking the vcpus, we link the VMCSs, using a new structure
      loaded_vmcs. This structure contains the VMCS, and the information pertaining
      to its loading on a specific cpu (namely, the cpu number, and whether it
      was already launched on this cpu once). In nested we will also use the same
      structure to hold L2 VMCSs, and vmx->loaded_vmcs is a pointer to the
      currently active VMCS.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Acked-by: NAcked-by: Kevin Tian <kevin.tian@intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d462b819
    • A
      KVM: VMX: always_inline VMREADs · 96304217
      Avi Kivity 提交于
      vmcs_readl() and friends are really short, but gcc thinks they are long because of
      the out-of-line exception handlers.  Mark them always_inline to clear the
      misunderstanding.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      96304217
    • A
      KVM: VMX: Move VMREAD cleanup to exception handler · 5e520e62
      Avi Kivity 提交于
      We clean up a failed VMREAD by clearing the output register.  Do
      it in the exception handler instead of unconditionally.  This is
      worthwhile since there are more than a hundred call sites.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      5e520e62
  2. 20 6月, 2011 1 次提交
  3. 22 5月, 2011 2 次提交
  4. 11 5月, 2011 15 次提交
  5. 18 3月, 2011 11 次提交