On Mon, 20 Jul 2026 at 06:39, Akihiko Odaki <[email protected]> wrote: ... > A QEMU patch that demonstrates the usage of the new attribute is > available at: > https://lore.kernel.org/qemu-devel/[email protected]/ > ("[PATCH RFC v4] target/arm/kvm: Choose PMU backend") > > Signed-off-by: Akihiko Odaki <[email protected]>
I didn't test with the QEMU patch, but I tested on QEMU: booting the host and a KVM guest, plus the vpmu_counter_access and get-reg-list KVM selftests under nvhe, vhe, andvhe with kvm-arm.mode=nested. For the series: Tested-by: Fuad Tabba < [email protected]> Cheers, /fuad > --- > Changes in v9: > - Dropped patch > "KVM: arm64: Disallow vPMU when pPMUs do not cover all CPUs". > - Added patch > "KVM: arm64: PMU: Stop updating MDCR_EL2.HPMN". > - Added patch > "KVM: arm64: selftests: Cover PMU state in MDCR_EL2". > - Added patch > "arm64: errata: Require Apple IMPDEF PMUv3 traps on all CPUs". > - Added patch > "KVM: arm64: Don't clear vcpu->cpu in kvm_arch_vcpu_put()". > - Noted that fixed-counters-only mode avoids relying on the default PMU. > - Clarified why fixed-counters-only mode hides PMCEID. > - Added patch "KVM: arm64: Serialize repeated vCPU initialization". > - Added patch "KVM: arm64: PMU: Freeze counter count after first run". > - Added patch > "KVM: arm64: selftests: Test SET_NR_COUNTERS after first run". > - Added patch "KVM: arm64: PMU: Recreate events after MDCR_EL2 changes". > - Clarified why extra IMPDEF PMUv3 trap support on a late CPU is safe. > - Changed fixed-counters-only emulation to taint the kernel when it > encounters a CPU without a registered pPMU; see the commit message. > - Added patch > "KVM: arm64: PMU: Keep implemented counter mask EL-independent". > - Added a targeted bitfield helper type change to tools headers. > - Link to v8: > https://patch.msgid.link/[email protected] > > Changes in v8: > - Added patch > "KVM: arm64: Disallow vPMU when pPMUs do not cover all CPUs". > - Split patch "KVM: arm64: PMU: Introduce FIXED_COUNTERS_ONLY". > - Documented the FEAT_PMUv3_ICNTR support plan. > - Ensured KVM_ARM_VCPU_PMU_V3_FILTER and > KVM_ARM_VCPU_PMU_V3_FIXED_COUNTERS_ONLY are mutually exclusive. > - Ensured KVM_ARM_VCPU_PMU_V3_SET_PMU and > KVM_ARM_VCPU_PMU_V3_FIXED_COUNTERS_ONLY are mutually exclusive. > - Dropped the code to support KVM_ARM_VCPU_PMU_V3_SET_NR_COUNTERS for > KVM_ARM_VCPU_PMU_V3_FIXED_COUNTERS_ONLY. > - Added a function to de-duplicate > "test_bit(KVM_ARCH_FLAG_PMU_V3_FIXED_COUNTERS_ONLY, ...)". > - Link to v7: > https://lore.kernel.org/r/[email protected] > > Changes in v7: > - Fixed the vCPU run hang in test_fixed_counters_only(). > - Link to v6: > https://lore.kernel.org/r/[email protected] > > Changes in v6: > - Removed WARN_ON_ONCE() in kvm_pmu_create_perf_event(). It can be > triggered in kvm_arch_vcpu_load() before it checks supported_cpus. > - Removed an extra lockdep assertion in kvm_arm_pmu_v3_get_attr(). > - Fixed error messages in test_fixed_counters_only(). > - Fixed the vCPU run in test_fixed_counters_only(). > - Link to v5: > https://lore.kernel.org/r/[email protected] > > Changes in v5: > - Rebased. > - Fixed the order to clear KVM_ARCH_FLAG_PMU_V3_FIXED_COUNTERS_ONLY in > kvm_arm_pmu_v3_set_pmu(). > - Fixed the setting of KVM_ARM_VCPU_PMU_V3_IRQ in > test_fixed_counters_only(). > - Changed to WARN_ON_ONCE() when kvm_pmu_probe_armpmu() returns NULL in > kvm_pmu_create_perf_event(), which is no longer supposed to happen. > - Link to v4: > https://lore.kernel.org/r/[email protected] > > Changes in v4: > - Extracted kvm_pmu_enabled_counter_mask() into a separate patch. > - Added patch "KVM: arm64: PMU: Protect the list of PMUs with RCU". > - Merged KVM_REQ_CREATE_PMU into KVM_REQ_RELOAD_PMU. > - Added a check to avoid unnecessary KVM_REQ_RELOAD_PMU requests. > - Dropped the change to avoid setting kvm_arm_set_default_pmu() when > KVM_ARM_VCPU_PMU_V3_FIXED_COUNTERS_ONLY is not set. > - Link to v3: > https://lore.kernel.org/r/[email protected] > > Changes in v3: > - Renamed the attribute to KVM_ARM_VCPU_PMU_V3_FIXED_COUNTERS_ONLY. > - Changed to request the creation of perf counters when loading vCPU. > - Link to v2: > https://lore.kernel.org/r/[email protected] > > Changes in v2: > - Added the KVM_ARM_VCPU_PMU_V3_COMPOSITION attribute to opt in the > feature. > - Added code to handle overflow. > - Link to v1: > https://lore.kernel.org/r/[email protected] > > --- > Akihiko Odaki (15): > KVM: arm64: Serialize repeated vCPU initialization > KVM: arm64: PMU: Stop updating MDCR_EL2.HPMN > KVM: arm64: PMU: Freeze counter count after first run > KVM: arm64: selftests: Test SET_NR_COUNTERS after first run > KVM: arm64: PMU: Keep implemented counter mask EL-independent > KVM: arm64: PMU: Recreate events after MDCR_EL2 changes > tools headers: Use u* types for bitfield helpers > KVM: arm64: selftests: Cover PMU state in MDCR_EL2 > arm64: errata: Require Apple IMPDEF PMUv3 traps on all CPUs > KVM: arm64: PMU: Protect the list of PMUs with RCU > KVM: arm64: PMU: Pass the pPMU to kvm_map_pmu_event() > KVM: arm64: PMU: Pass the target CPU to kvm_pmu_probe_armpmu() > KVM: arm64: PMU: Implement fixed-counters-only emulation > KVM: arm64: PMU: Introduce FIXED_COUNTERS_ONLY > KVM: arm64: selftests: Test PMU_V3_FIXED_COUNTERS_ONLY > > Oliver Upton (1): > KVM: arm64: Don't clear vcpu->cpu in kvm_arch_vcpu_put() > > Documentation/virt/kvm/devices/vcpu.rst | 30 ++- > arch/arm64/include/asm/kvm_host.h | 4 + > arch/arm64/include/uapi/asm/kvm.h | 1 + > arch/arm64/kernel/cpu_errata.c | 2 +- > arch/arm64/kvm/arm.c | 18 +- > arch/arm64/kvm/pmu-emul.c | 241 +++++++++++------ > arch/arm64/kvm/reset.c | 16 +- > arch/arm64/kvm/sys_regs.c | 31 ++- > include/kvm/arm_pmu.h | 5 + > tools/arch/arm64/include/uapi/asm/kvm.h | 1 + > tools/include/linux/bitfield.h | 26 +- > .../selftests/kvm/arm64/vpmu_counter_access.c | 284 > ++++++++++++++++++--- > 12 files changed, 510 insertions(+), 149 deletions(-) > --- > base-commit: cb9360ae6549120975f20887840fb33d47c13898 > change-id: 20250224-hybrid-01d5ff47edd2 > > Best regards, > -- > Akihiko Odaki <[email protected]> > >

