1. Jan 08, 2024
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-xen-6.8' of https://github.com/kvm-x86/linux into HEAD · 3115d2de
      Paolo Bonzini authored
      KVM Xen change for 6.8:
      
      To workaround Xen guests that don't expect Xen PV clocks to be marked as being
      based on a stable TSC, add a Xen config knob to allow userspace to opt out of
      KVM setting the "TSC stable" bit in Xen PV clocks.  Note, the "TSC stable" bit
      was added to the PVCLOCK ABI by KVM without an ack from Xen, i.e. KVM isn't
      entirely blameless for the buggy guest behavior.
      3115d2de
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-svm-6.8' of https://github.com/kvm-x86/linux into HEAD · 8c9244af
      Paolo Bonzini authored
      KVM SVM changes for 6.8:
      
       - Revert a bogus, made-up nested SVM consistency check for TLB_CONTROL.
      
       - Advertise flush-by-ASID support for nSVM unconditionally, as KVM always
         flushes on nested transitions, i.e. always satisfies flush requests.  This
         allows running bleeding edge versions of VMware Workstation on top of KVM.
      
       - Sanity check that the CPU supports flush-by-ASID when enabling SEV support.
      
       - Fix a benign NMI virtualization bug where KVM would unnecessarily intercept
         IRET when manually injecting an NMI, e.g. when KVM pends an NMI and injects
         a second, "simultaneous" NMI.
      8c9244af
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-lam-6.8' of https://github.com/kvm-x86/linux into HEAD · 8ecb10bc
      Paolo Bonzini authored
      KVM x86 support for virtualizing Linear Address Masking (LAM)
      
      Add KVM support for Linear Address Masking (LAM).  LAM tweaks the canonicality
      checks for most virtual address usage in 64-bit mode, such that only the most
      significant bit of the untranslated address bits must match the polarity of the
      last translated address bit.  This allows software to use ignored, untranslated
      address bits for metadata, e.g. to efficiently tag pointers for address
      sanitization.
      
      LAM can be enabled separately for user pointers and supervisor pointers, and
      for userspace LAM can be select between 48-bit and 57-bit masking
      
       - 48-bit LAM: metadata bits 62:48, i.e. LAM width of 15.
       - 57-bit LAM: metadata bits 62:57, i.e. LAM width of 6.
      
      For user pointers, LAM enabling utilizes two previously-reserved high bits from
      CR3 (similar to how PCID_NOFLUSH uses bit 63): LAM_U48 and LAM_U57, bits 62 and
      61 respectively.  Note, if LAM_57 is set, LAM_U48 is ignored, i.e.:
      
       - CR3.LAM_U48=0 && CR3.LAM_U57=0 == LAM disabled for user pointers
       - CR3.LAM_U48=1 && CR3.LAM_U57=0 == LAM-48 enabled for user pointers
       - CR3.LAM_U48=x && CR3.LAM_U57=1 == LAM-57 enabled for user pointers
      
      For supervisor pointers, LAM is controlled by a single bit, CR4.LAM_SUP, with
      the 48-bit versus 57-bit LAM behavior following the current paging mode, i.e.:
      
       - CR4.LAM_SUP=0 && CR4.LA57=x == LAM disabled for supervisor pointers
       - CR4.LAM_SUP=1 && CR4.LA57=0 == LAM-48 enabled for supervisor pointers
       - CR4.LAM_SUP=1 && CR4.LA57=1 == LAM-57 enabled for supervisor pointers
      
      The modified LAM canonicality checks:
       - LAM_S48                : [ 1 ][ metadata ][ 1 ]
                                    63               47
       - LAM_U48                : [ 0 ][ metadata ][ 0 ]
                                    63               47
       - LAM_S57                : [ 1 ][ metadata ][ 1 ]
                                    63               56
       - LAM_U57 + 5-lvl paging : [ 0 ][ metadata ][ 0 ]
                                    63               56
       - LAM_U57 + 4-lvl paging : [ 0 ][ metadata ][ 0...0 ]
                                    63               56..47
      
      The bulk of KVM support for LAM is to emulate LAM's modified canonicality
      checks.  The approach taken by KVM is to "fill" the metadata bits using the
      highest bit of the translated address, e.g. for LAM-48, bit 47 is sign-extended
      to bits 62:48.  The most significant bit, 63, is *not* modified, i.e. its value
      from the raw, untagged virtual address is kept for the canonicality check. This
      untagging allows
      
      Aside from emulating LAM's canonical checks behavior, LAM has the usual KVM
      touchpoints for selectable features: enumeration (CPUID.7.1:EAX.LAM[bit 26],
      enabling via CR3 and CR4 bits, etc.
      8ecb10bc
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-pmu-6.8' of https://github.com/kvm-x86/linux into HEAD · 01edb1cf
      Paolo Bonzini authored
      KVM x86 PMU changes for 6.8:
      
       - Fix a variety of bugs where KVM fail to stop/reset counters and other state
         prior to refreshing the vPMU model.
      
       - Fix a double-overflow PMU bug by tracking emulated counter events using a
         dedicated field instead of snapshotting the "previous" counter.  If the
         hardware PMC count triggers overflow that is recognized in the same VM-Exit
         that KVM manually bumps an event count, KVM would pend PMIs for both the
         hardware-triggered overflow and for KVM-triggered overflow.
      01edb1cf
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-misc-6.8' of https://github.com/kvm-x86/linux into HEAD · 33d0403f
      Paolo Bonzini authored
      KVM x86 misc changes for 6.8:
      
       - Turn off KVM_WERROR by default for all configs so that it's not
         inadvertantly enabled by non-KVM developers, which can be problematic for
         subsystems that require no regressions for W=1 builds.
      
       - Advertise all of the host-supported CPUID bits that enumerate IA32_SPEC_CTRL
         "features".
      
       - Don't force a masterclock update when a vCPU synchronizes to the current TSC
         generation, as updating the masterclock can cause kvmclock's time to "jump"
         unexpectedly, e.g. when userspace hotplugs a pre-created vCPU.
      
       - Use RIP-relative address to read kvm_rebooting in the VM-Enter fault paths,
         partly as a super minor optimization, but mostly to make KVM play nice with
         position independent executable builds.
      33d0403f
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-hyperv-6.8' of https://github.com/kvm-x86/linux into HEAD · 0afdfd85
      Paolo Bonzini authored
      KVM x86 Hyper-V changes for 6.8:
      
       - Guard KVM-on-HyperV's range-based TLB flush hooks with an #ifdef on
         CONFIG_HYPERV as a minor optimization, and to self-document the code.
      
       - Add CONFIG_KVM_HYPERV to allow disabling KVM support for HyperV "emulation"
         at build time.
      0afdfd85
    • Paolo Bonzini's avatar
      Merge tag 'kvm-x86-generic-6.8' of https://github.com/kvm-x86/linux into HEAD · fb872da8
      Paolo Bonzini authored
      Common KVM changes for 6.8:
      
       - Use memdup_array_user() to harden against overflow.
      
       - Unconditionally advertise KVM_CAP_DEVICE_CTRL for all architectures.
      fb872da8
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD · 5f53d88f
      Paolo Bonzini authored
      KVM/arm64 updates for Linux 6.8
      
      - LPA2 support, adding 52bit IPA/PA capability for 4kB and 16kB
        base granule sizes. Branch shared with the arm64 tree.
      
      - Large Fine-Grained Trap rework, bringing some sanity to the
        feature, although there is more to come. This comes with
        a prefix branch shared with the arm64 tree.
      
      - Some additional Nested Virtualization groundwork, mostly
        introducing the NV2 VNCR support and retargetting the NV
        support to that version of the architecture.
      
      - A small set of vgic fixes and associated cleanups.
      5f53d88f
    • Paolo Bonzini's avatar
      KVM: x86: add missing "depends on KVM" · 78328801
      Paolo Bonzini authored
      Support for KVM software-protected VMs should not be configurable,
      if KVM is not available at all.
      
      Fixes: 89ea60c2
      
       ("KVM: x86: Add support for "protected VMs" that can utilize private memory")
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      78328801
    • Paolo Bonzini's avatar
      KVM: fix direction of dependency on MMU notifiers · 3a373e02
      Paolo Bonzini authored
      
      
      KVM_GENERIC_MEMORY_ATTRIBUTES requires the generic MMU notifier code, because
      it uses kvm_mmu_invalidate_begin/end.  However, it would not work with a bespoke
      implementation of MMU notifiers that does not use KVM_GENERIC_MMU_NOTIFIER,
      because most likely it would not synchronize correctly on invalidation.  So
      the right thing to do is to note the problematic configuration if the
      architecture does not select itself KVM_GENERIC_MMU_NOTIFIER; not to
      enable it blindly.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3a373e02
    • Paolo Bonzini's avatar
      KVM: introduce CONFIG_KVM_COMMON · caadf876
      Paolo Bonzini authored
      CONFIG_HAVE_KVM is currently used by some architectures to either
      enabled the KVM config proper, or to enable host-side code that is
      not part of the KVM module.  However, CONFIG_KVM's "select" statement
      in virt/kvm/Kconfig corresponds to a third meaning, namely to
      enable common Kconfigs required by all architectures that support
      KVM.
      
      These three meanings can be replaced respectively by an
      architecture-specific Kconfig, by IS_ENABLED(CONFIG_KVM), or by
      a new Kconfig symbol that is in turn selected by the
      architecture-specific "config KVM".
      
      Start by introducing such a new Kconfig symbol, CONFIG_KVM_COMMON.
      Unlike CONFIG_HAVE_KVM, it is selected by CONFIG_KVM, not by
      architecture code, and it brings in all dependencies of common
      KVM code.  In particular, INTERVAL_TREE was missing in loongarch
      and riscv, so that is another thing that is fixed.
      
      Fixes: 8132d887
      
       ("KVM: remove CONFIG_HAVE_KVM_EVENTFD", 2023-12-08)
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Closes: https://lore.kernel.org/all/44907c6b-c5bd-4e4a-a921-e4d3825539d8@infradead.org/
      
      
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      caadf876
  2. Jan 05, 2024
  3. Jan 03, 2024
  4. Dec 30, 2023
  5. Dec 29, 2023