1. 18 6月, 2021 7 次提交
  2. 27 5月, 2021 1 次提交
  3. 07 5月, 2021 9 次提交
  4. 06 5月, 2021 3 次提交
  5. 05 5月, 2021 1 次提交
  6. 03 5月, 2021 1 次提交
    • M
      KVM: nSVM: fix few bugs in the vmcb02 caching logic · c74ad08f
      Maxim Levitsky 提交于
      * Define and use an invalid GPA (all ones) for init value of last
        and current nested vmcb physical addresses.
      
      * Reset the current vmcb12 gpa to the invalid value when leaving
        the nested mode, similar to what is done on nested vmexit.
      
      * Reset	the last seen vmcb12 address when disabling the nested SVM,
        as it relies on vmcb02 fields which are freed at that point.
      
      Fixes: 4995a368 ("KVM: SVM: Use a separate vmcb for the nested L2 guest")
      Signed-off-by: NMaxim Levitsky <mlevitsk@redhat.com>
      Message-Id: <20210503125446.1353307-3-mlevitsk@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c74ad08f
  7. 01 5月, 2021 3 次提交
  8. 26 4月, 2021 1 次提交
  9. 22 4月, 2021 1 次提交
    • N
      KVM: x86: Support KVM VMs sharing SEV context · 54526d1f
      Nathan Tempelman 提交于
      Add a capability for userspace to mirror SEV encryption context from
      one vm to another. On our side, this is intended to support a
      Migration Helper vCPU, but it can also be used generically to support
      other in-guest workloads scheduled by the host. The intention is for
      the primary guest and the mirror to have nearly identical memslots.
      
      The primary benefits of this are that:
      1) The VMs do not share KVM contexts (think APIC/MSRs/etc), so they
      can't accidentally clobber each other.
      2) The VMs can have different memory-views, which is necessary for post-copy
      migration (the migration vCPUs on the target need to read and write to
      pages, when the primary guest would VMEXIT).
      
      This does not change the threat model for AMD SEV. Any memory involved
      is still owned by the primary guest and its initial state is still
      attested to through the normal SEV_LAUNCH_* flows. If userspace wanted
      to circumvent SEV, they could achieve the same effect by simply attaching
      a vCPU to the primary VM.
      This patch deliberately leaves userspace in charge of the memslots for the
      mirror, as it already has the power to mess with them in the primary guest.
      
      This patch does not support SEV-ES (much less SNP), as it does not
      handle handing off attested VMSAs to the mirror.
      
      For additional context, we need a Migration Helper because SEV PSP
      migration is far too slow for our live migration on its own. Using
      an in-guest migrator lets us speed this up significantly.
      Signed-off-by: NNathan Tempelman <natet@google.com>
      Message-Id: <20210408223214.2582277-1-natet@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      54526d1f
  10. 21 4月, 2021 2 次提交
  11. 20 4月, 2021 9 次提交
    • C
      floppy: remove redundant assignment to variable st · b53002e0
      Colin Ian King 提交于
      The variable st is being assigned a value that is never read and
      it is being updated later with a new value. The initialization is
      redundant and can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Reviewed-by: NDenis Efremov <efremov@linux.com>
      Acked-by: NWilly Tarreau <w@1wt.eu>
      Link: https://lore.kernel.org/r/20210415130020.1959951-1-colin.king@canonical.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
      b53002e0
    • S
      KVM: VMX: Add SGX ENCLS[ECREATE] handler to enforce CPUID restrictions · 70210c04
      Sean Christopherson 提交于
      Add an ECREATE handler that will be used to intercept ECREATE for the
      purpose of enforcing and enclave's MISCSELECT, ATTRIBUTES and XFRM, i.e.
      to allow userspace to restrict SGX features via CPUID.  ECREATE will be
      intercepted when any of the aforementioned masks diverges from hardware
      in order to enforce the desired CPUID model, i.e. inject #GP if the
      guest attempts to set a bit that hasn't been enumerated as allowed-1 in
      CPUID.
      
      Note, access to the PROVISIONKEY is not yet supported.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Co-developed-by: NKai Huang <kai.huang@intel.com>
      Signed-off-by: NKai Huang <kai.huang@intel.com>
      Message-Id: <c3a97684f1b71b4f4626a1fc3879472a95651725.1618196135.git.kai.huang@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      70210c04
    • S
      KVM: VMX: Add basic handling of VM-Exit from SGX enclave · 3c0c2ad1
      Sean Christopherson 提交于
      Add support for handling VM-Exits that originate from a guest SGX
      enclave.  In SGX, an "enclave" is a new CPL3-only execution environment,
      wherein the CPU and memory state is protected by hardware to make the
      state inaccesible to code running outside of the enclave.  When exiting
      an enclave due to an asynchronous event (from the perspective of the
      enclave), e.g. exceptions, interrupts, and VM-Exits, the enclave's state
      is automatically saved and scrubbed (the CPU loads synthetic state), and
      then reloaded when re-entering the enclave.  E.g. after an instruction
      based VM-Exit from an enclave, vmcs.GUEST_RIP will not contain the RIP
      of the enclave instruction that trigered VM-Exit, but will instead point
      to a RIP in the enclave's untrusted runtime (the guest userspace code
      that coordinates entry/exit to/from the enclave).
      
      To help a VMM recognize and handle exits from enclaves, SGX adds bits to
      existing VMCS fields, VM_EXIT_REASON.VMX_EXIT_REASON_FROM_ENCLAVE and
      GUEST_INTERRUPTIBILITY_INFO.GUEST_INTR_STATE_ENCLAVE_INTR.  Define the
      new architectural bits, and add a boolean to struct vcpu_vmx to cache
      VMX_EXIT_REASON_FROM_ENCLAVE.  Clear the bit in exit_reason so that
      checks against exit_reason do not need to account for SGX, e.g.
      "if (exit_reason == EXIT_REASON_EXCEPTION_NMI)" continues to work.
      
      KVM is a largely a passive observer of the new bits, e.g. KVM needs to
      account for the bits when propagating information to a nested VMM, but
      otherwise doesn't need to act differently for the majority of VM-Exits
      from enclaves.
      
      The one scenario that is directly impacted is emulation, which is for
      all intents and purposes impossible[1] since KVM does not have access to
      the RIP or instruction stream that triggered the VM-Exit.  The inability
      to emulate is a non-issue for KVM, as most instructions that might
      trigger VM-Exit unconditionally #UD in an enclave (before the VM-Exit
      check.  For the few instruction that conditionally #UD, KVM either never
      sets the exiting control, e.g. PAUSE_EXITING[2], or sets it if and only
      if the feature is not exposed to the guest in order to inject a #UD,
      e.g. RDRAND_EXITING.
      
      But, because it is still possible for a guest to trigger emulation,
      e.g. MMIO, inject a #UD if KVM ever attempts emulation after a VM-Exit
      from an enclave.  This is architecturally accurate for instruction
      VM-Exits, and for MMIO it's the least bad choice, e.g. it's preferable
      to killing the VM.  In practice, only broken or particularly stupid
      guests should ever encounter this behavior.
      
      Add a WARN in skip_emulated_instruction to detect any attempt to
      modify the guest's RIP during an SGX enclave VM-Exit as all such flows
      should either be unreachable or must handle exits from enclaves before
      getting to skip_emulated_instruction.
      
      [1] Impossible for all practical purposes.  Not truly impossible
          since KVM could implement some form of para-virtualization scheme.
      
      [2] PAUSE_LOOP_EXITING only affects CPL0 and enclaves exist only at
          CPL3, so we also don't need to worry about that interaction.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NKai Huang <kai.huang@intel.com>
      Message-Id: <315f54a8507d09c292463ef29104e1d4c62e9090.1618196135.git.kai.huang@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3c0c2ad1
    • S
      KVM: x86: Define new #PF SGX error code bit · 00e7646c
      Sean Christopherson 提交于
      Page faults that are signaled by the SGX Enclave Page Cache Map (EPCM),
      as opposed to the traditional IA32/EPT page tables, set an SGX bit in
      the error code to indicate that the #PF was induced by SGX.  KVM will
      need to emulate this behavior as part of its trap-and-execute scheme for
      virtualizing SGX Launch Control, e.g. to inject SGX-induced #PFs if
      EINIT faults in the host, and to support live migration.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NKai Huang <kai.huang@intel.com>
      Message-Id: <e170c5175cb9f35f53218a7512c9e3db972b97a2.1618196135.git.kai.huang@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      00e7646c
    • K
      KVM: x86: Remove unused function declaration · d90b15ed
      Keqian Zhu 提交于
      kvm_mmu_slot_largepage_remove_write_access() is decared but not used,
      just remove it.
      Signed-off-by: NKeqian Zhu <zhukeqian1@huawei.com>
      Message-Id: <20210406063504.17552-1-zhukeqian1@huawei.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d90b15ed
    • W
      KVM: X86: Count attempted/successful directed yield · 4a7132ef
      Wanpeng Li 提交于
      To analyze some performance issues with lock contention and scheduling,
      it is nice to know when directed yield are successful or failing.
      Signed-off-by: NWanpeng Li <wanpengli@tencent.com>
      Message-Id: <1617941911-5338-2-git-send-email-wanpengli@tencent.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4a7132ef
    • K
      perf/x86/intel: Hybrid PMU support for perf capabilities · d0946a88
      Kan Liang 提交于
      Some platforms, e.g. Alder Lake, have hybrid architecture. Although most
      PMU capabilities are the same, there are still some unique PMU
      capabilities for different hybrid PMUs. Perf should register a dedicated
      pmu for each hybrid PMU.
      
      Add a new struct x86_hybrid_pmu, which saves the dedicated pmu and
      capabilities for each hybrid PMU.
      
      The architecture MSR, MSR_IA32_PERF_CAPABILITIES, only indicates the
      architecture features which are available on all hybrid PMUs. The
      architecture features are stored in the global x86_pmu.intel_cap.
      
      For Alder Lake, the model-specific features are perf metrics and
      PEBS-via-PT. The corresponding bits of the global x86_pmu.intel_cap
      should be 0 for these two features. Perf should not use the global
      intel_cap to check the features on a hybrid system.
      Add a dedicated intel_cap in the x86_hybrid_pmu to store the
      model-specific capabilities. Use the dedicated intel_cap to replace
      the global intel_cap for thse two features. The dedicated intel_cap
      will be set in the following "Add Alder Lake Hybrid support" patch.
      
      Add is_hybrid() to distinguish a hybrid system. ADL may have an
      alternative configuration. With that configuration, the
      X86_FEATURE_HYBRID_CPU is not set. Perf cannot rely on the feature bit.
      Add a new static_key_false, perf_is_hybrid, to indicate a hybrid system.
      It will be assigned in the following "Add Alder Lake Hybrid support"
      patch as well.
      Suggested-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/1618237865-33448-5-git-send-email-kan.liang@linux.intel.com
      d0946a88
    • R
      x86/cpu: Add helper function to get the type of the current hybrid CPU · 250b3c0d
      Ricardo Neri 提交于
      On processors with Intel Hybrid Technology (i.e., one having more than
      one type of CPU in the same package), all CPUs support the same
      instruction set and enumerate the same features on CPUID. Thus, all
      software can run on any CPU without restrictions. However, there may be
      model-specific differences among types of CPUs. For instance, each type
      of CPU may support a different number of performance counters. Also,
      machine check error banks may be wired differently. Even though most
      software will not care about these differences, kernel subsystems
      dealing with these differences must know.
      
      Add and expose a new helper function get_this_hybrid_cpu_type() to query
      the type of the current hybrid CPU. The function will be used later in
      the perf subsystem.
      
      The Intel Software Developer's Manual defines the CPU type as 8-bit
      identifier.
      Signed-off-by: NRicardo Neri <ricardo.neri-calderon@linux.intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Reviewed-by: NLen Brown <len.brown@intel.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/1618237865-33448-3-git-send-email-kan.liang@linux.intel.com
      250b3c0d
    • R
      x86/cpufeatures: Enumerate Intel Hybrid Technology feature bit · a161545a
      Ricardo Neri 提交于
      Add feature enumeration to identify a processor with Intel Hybrid
      Technology: one in which CPUs of more than one type are the same package.
      On a hybrid processor, all CPUs support the same homogeneous (i.e.,
      symmetric) instruction set. All CPUs enumerate the same features in CPUID.
      Thus, software (user space and kernel) can run and migrate to any CPU in
      the system as well as utilize any of the enumerated features without any
      change or special provisions. The main difference among CPUs in a hybrid
      processor are power and performance properties.
      Signed-off-by: NRicardo Neri <ricardo.neri-calderon@linux.intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NTony Luck <tony.luck@intel.com>
      Reviewed-by: NLen Brown <len.brown@intel.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/1618237865-33448-2-git-send-email-kan.liang@linux.intel.com
      a161545a
  12. 19 4月, 2021 1 次提交
  13. 17 4月, 2021 1 次提交