1. 25 May, 2022 4 commits
    • Paolo Bonzini's avatar
      Merge tag 'kvm-riscv-5.19-1' of https://github.com/kvm-riscv/linux into HEAD · b699da3d
      Paolo Bonzini authored
      KVM/riscv changes for 5.19
      
      - Added Sv57x4 support for G-stage page table
      - Added range based local HFENCE functions
      - Added remote HFENCE functions based on VCPU requests
      - Added ISA extension registers in ONE_REG interface
      - Updated KVM RISC-V maintainers entry to cover selftests support
      b699da3d
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD · 47e8eec8
      Paolo Bonzini authored
      KVM/arm64 updates for 5.19
      
      - Add support for the ARMv8.6 WFxT extension
      
      - Guard pages for the EL2 stacks
      
      - Trap and emulate AArch32 ID registers to hide unsupported features
      
      - Ability to select and save/restore the set of hypercalls exposed
        to the guest
      
      - Support for PSCI-initiated suspend in collaboration with userspace
      
      - GICv3 register-based LPI invalidation support
      
      - Move host PMU event merging into the vcpu data structure
      
      - GICv3 ITS save/restore fixes
      
      - The usual set of small-scale cleanups and fixes
      
      [Due to the conflict, KVM_SYSTEM_EVENT_SEV_TERM is relocated
       from 4 to 6. - Paolo]
      47e8eec8
    • Yang Weijiang's avatar
      KVM: selftests: x86: Fix test failure on arch lbr capable platforms · 825be3b5
      Yang Weijiang authored
      On Arch LBR capable platforms, LBR_FMT in perf capability msr is 0x3f,
      so the last format test will fail. Use a true invalid format(0x30) for
      the test if it's running on these platforms. Opportunistically change
      the file name to reflect the tests actually carried out.
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarYang Weijiang <weijiang.yang@intel.com>
      Message-Id: <20220512084046.105479-1-weijiang.yang@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      825be3b5
    • Wanpeng Li's avatar
      KVM: LAPIC: Trace LAPIC timer expiration on every vmentry · e0ac5351
      Wanpeng Li authored
      In commit ec0671d5 ("KVM: LAPIC: Delay trace_kvm_wait_lapic_expire
      tracepoint to after vmexit", 2019-06-04), trace_kvm_wait_lapic_expire
      was moved after guest_exit_irqoff() because invoking tracepoints within
      kvm_guest_enter/kvm_guest_exit caused a lockdep splat.
      
      These days this is not necessary, because commit 87fa7f3e ("x86/kvm:
      Move context tracking where it belongs", 2020-07-09) restricted
      the RCU extended quiescent state to be closer to vmentry/vmexit.
      Moving the tracepoint back to __kvm_wait_lapic_expire is more accurate,
      because it will be reported even if vcpu_enter_guest causes multiple
      vmentries via the IPI/Timer fast paths, and it allows the removal of
      advance_expire_delta.
      Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
      Message-Id: <1650961551-38390-1-git-send-email-wanpengli@tencent.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e0ac5351
  2. 20 May, 2022 11 commits
  3. 16 May, 2022 13 commits
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/its-save-restore-fixes-5.19 into kvmarm-master/next · 5c0ad551
      Marc Zyngier authored
      * kvm-arm64/its-save-restore-fixes-5.19:
        : .
        : Tighten the ITS save/restore infrastructure to fail early rather
        : than late. Patches courtesy of Rocardo Koller.
        : .
        KVM: arm64: vgic: Undo work in failed ITS restores
        KVM: arm64: vgic: Do not ignore vgic_its_restore_cte failures
        KVM: arm64: vgic: Add more checks when restoring ITS tables
        KVM: arm64: vgic: Check that new ITEs could be saved in guest memory
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      5c0ad551
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/misc-5.19 into kvmarm-master/next · 822ca7f8
      Marc Zyngier authored
      * kvm-arm64/misc-5.19:
        : .
        : Misc fixes and general improvements for KVMM/arm64:
        :
        : - Better handle out of sequence sysregs in the global tables
        :
        : - Remove a couple of unnecessary loads from constant pool
        :
        : - Drop unnecessary pKVM checks
        :
        : - Add all known M1 implementations to the SEIS workaround
        :
        : - Cleanup kerneldoc warnings
        : .
        KVM: arm64: vgic-v3: List M1 Pro/Max as requiring the SEIS workaround
        KVM: arm64: pkvm: Don't mask already zeroed FEAT_SVE
        KVM: arm64: pkvm: Drop unnecessary FP/SIMD trap handler
        KVM: arm64: nvhe: Eliminate kernel-doc warnings
        KVM: arm64: Avoid unnecessary absolute addressing via literals
        KVM: arm64: Print emulated register table name when it is unsorted
        KVM: arm64: Don't BUG_ON() if emulated register table is unsorted
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      822ca7f8
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/per-vcpu-host-pmu-data into kvmarm-master/next · 8794b4f5
      Marc Zyngier authored
      * kvm-arm64/per-vcpu-host-pmu-data:
        : .
        : Pass the host PMU state in the vcpu to avoid the use of additional
        : shared memory between EL1 and EL2 (this obviously only applies
        : to nVHE and Protected setups).
        :
        : Patches courtesy of Fuad Tabba.
        : .
        KVM: arm64: pmu: Restore compilation when HW_PERF_EVENTS isn't selected
        KVM: arm64: Reenable pmu in Protected Mode
        KVM: arm64: Pass pmu events to hyp via vcpu
        KVM: arm64: Repack struct kvm_pmu to reduce size
        KVM: arm64: Wrapper for getting pmu_events
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      8794b4f5
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/vgic-invlpir into kvmarm-master/next · ec2cff6c
      Marc Zyngier authored
      * kvm-arm64/vgic-invlpir:
        : .
        : Implement MMIO-based LPI invalidation for vGICv3.
        : .
        KVM: arm64: vgic-v3: Advertise GICR_CTLR.{IR, CES} as a new GICD_IIDR revision
        KVM: arm64: vgic-v3: Implement MMIO-based LPI invalidation
        KVM: arm64: vgic-v3: Expose GICR_CTLR.RWP when disabling LPIs
        irqchip/gic-v3: Exposes bit values for GICR_CTLR.{IR, CES}
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      ec2cff6c
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/psci-suspend into kvmarm-master/next · 3b8e21e3
      Marc Zyngier authored
      * kvm-arm64/psci-suspend:
        : .
        : Add support for PSCI SYSTEM_SUSPEND and allow userspace to
        : filter the wake-up events.
        :
        : Patches courtesy of Oliver.
        : .
        Documentation: KVM: Fix title level for PSCI_SUSPEND
        selftests: KVM: Test SYSTEM_SUSPEND PSCI call
        selftests: KVM: Refactor psci_test to make it amenable to new tests
        selftests: KVM: Use KVM_SET_MP_STATE to power off vCPU in psci_test
        selftests: KVM: Create helper for making SMCCC calls
        selftests: KVM: Rename psci_cpu_on_test to psci_test
        KVM: arm64: Implement PSCI SYSTEM_SUSPEND
        KVM: arm64: Add support for userspace to suspend a vCPU
        KVM: arm64: Return a value from check_vcpu_requests()
        KVM: arm64: Rename the KVM_REQ_SLEEP handler
        KVM: arm64: Track vCPU power state using MP state values
        KVM: arm64: Dedupe vCPU power off helpers
        KVM: arm64: Don't depend on fallthrough to hide SYSTEM_RESET2
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      3b8e21e3
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/hcall-selection into kvmarm-master/next · 0586e28a
      Marc Zyngier authored
      * kvm-arm64/hcall-selection:
        : .
        : Introduce a new set of virtual sysregs for userspace to
        : select the hypercalls it wants to see exposed to the guest.
        :
        : Patches courtesy of Raghavendra and Oliver.
        : .
        KVM: arm64: Fix hypercall bitmap writeback when vcpus have already run
        KVM: arm64: Hide KVM_REG_ARM_*_BMAP_BIT_COUNT from userspace
        Documentation: Fix index.rst after psci.rst renaming
        selftests: KVM: aarch64: Add the bitmap firmware registers to get-reg-list
        selftests: KVM: aarch64: Introduce hypercall ABI test
        selftests: KVM: Create helper for making SMCCC calls
        selftests: KVM: Rename psci_cpu_on_test to psci_test
        tools: Import ARM SMCCC definitions
        Docs: KVM: Add doc for the bitmap firmware registers
        Docs: KVM: Rename psci.rst to hypercalls.rst
        KVM: arm64: Add vendor hypervisor firmware register
        KVM: arm64: Add standard hypervisor firmware register
        KVM: arm64: Setup a framework for hypercall bitmap firmware registers
        KVM: arm64: Factor out firmware register handling from psci.c
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      0586e28a
    • Marc Zyngier's avatar
      KVM: arm64: Fix hypercall bitmap writeback when vcpus have already run · 528ada28
      Marc Zyngier authored
      We generally want to disallow hypercall bitmaps being changed
      once vcpus have already run. But we must allow the write if
      the written value is unchanged so that userspace can rewrite
      the register file on reboot, for example.
      
      Without this, a QEMU-based VM will fail to reboot correctly.
      
      The original code was correct, and it is me that introduced
      the regression.
      
      Fixes: 05714cab ("KVM: arm64: Setup a framework for hypercall bitmap firmware registers")
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      528ada28
    • Ricardo Koller's avatar
      KVM: arm64: vgic: Undo work in failed ITS restores · 8c5e74c9
      Ricardo Koller authored
      Failed ITS restores should clean up all state restored until the
      failure. There is some cleanup already present when failing to restore
      some tables, but it's not complete. Add the missing cleanup.
      
      Note that this changes the behavior in case of a failed restore of the
      device tables.
      
      	restore ioctl:
      	1. restore collection tables
      	2. restore device tables
      
      With this commit, failures in 2. clean up everything created so far,
      including state created by 1.
      Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
      Signed-off-by: default avatarRicardo Koller <ricarkol@google.com>
      Reviewed-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220510001633.552496-5-ricarkol@google.com
      8c5e74c9
    • Ricardo Koller's avatar
      KVM: arm64: vgic: Do not ignore vgic_its_restore_cte failures · a1ccfd6f
      Ricardo Koller authored
      Restoring a corrupted collection entry (like an out of range ID) is
      being ignored and treated as success. More specifically, a
      vgic_its_restore_cte failure is treated as success by
      vgic_its_restore_collection_table.  vgic_its_restore_cte uses positive
      and negative numbers to return error, and +1 to return success.  The
      caller then uses "ret > 0" to check for success.
      
      Fix this by having vgic_its_restore_cte only return negative numbers on
      error.  Do this by changing alloc_collection return codes to only return
      negative numbers on error.
      Signed-off-by: default avatarRicardo Koller <ricarkol@google.com>
      Reviewed-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220510001633.552496-4-ricarkol@google.com
      a1ccfd6f
    • Ricardo Koller's avatar
      KVM: arm64: vgic: Add more checks when restoring ITS tables · 243b1f6c
      Ricardo Koller authored
      Try to improve the predictability of ITS save/restores (and debuggability
      of failed ITS saves) by failing early on restore when trying to read
      corrupted tables.
      
      Restoring the ITS tables does some checks for corrupted tables, but not as
      many as in a save: an overflowing device ID will be detected on save but
      not on restore.  The consequence is that restoring a corrupted table won't
      be detected until the next save; including the ITS not working as expected
      after the restore.  As an example, if the guest sets tables overlapping
      each other, which would most likely result in some corrupted table, this is
      what we would see from the host point of view:
      
      	guest sets base addresses that overlap each other
      	save ioctl
      	restore ioctl
      	save ioctl (fails)
      
      Ideally, we would like the first save to fail, but overlapping tables could
      actually be intended by the guest. So, let's at least fail on the restore
      with some checks: like checking that device and event IDs don't overflow
      their tables.
      Signed-off-by: default avatarRicardo Koller <ricarkol@google.com>
      Reviewed-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220510001633.552496-3-ricarkol@google.com
      243b1f6c
    • Ricardo Koller's avatar
      KVM: arm64: vgic: Check that new ITEs could be saved in guest memory · cafe7e54
      Ricardo Koller authored
      Try to improve the predictability of ITS save/restores by failing
      commands that would lead to failed saves. More specifically, fail any
      command that adds an entry into an ITS table that is not in guest
      memory, which would otherwise lead to a failed ITS save ioctl. There
      are already checks for collection and device entries, but not for
      ITEs.  Add the corresponding check for the ITT when adding ITEs.
      Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
      Signed-off-by: default avatarRicardo Koller <ricarkol@google.com>
      Reviewed-by: default avatarOliver Upton <oupton@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220510001633.552496-2-ricarkol@google.com
      cafe7e54
    • Marc Zyngier's avatar
      KVM: arm64: pmu: Restore compilation when HW_PERF_EVENTS isn't selected · 20492a62
      Marc Zyngier authored
      Moving kvm_pmu_events into the vcpu (and refering to it) broke the
      somewhat unusual case where the kernel has no support for a PMU
      at all.
      
      In order to solve this, move things around a bit so that we can
      easily avoid refering to the pmu structure outside of PMU-aware
      code. As a bonus, pmu.c isn't compiled in when HW_PERF_EVENTS
      isn't selected.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reviewed-by: default avatarFuad Tabba <tabba@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/202205161814.KQHpOzsJ-lkp@intel.com
      20492a62
    • Linus Torvalds's avatar
      Linux 5.18-rc7 · 42226c98
      Linus Torvalds authored
      42226c98
  4. 15 May, 2022 12 commits