Skip to content

Commit 118bc84

Browse files
author
Marc Zyngier
committed
Merge branch kvm-arm64/pmu-unchained into kvmarm-master/next
* kvm-arm64/pmu-unchained: : . : PMUv3 fixes and improvements: : : - Make the CHAIN event handling strictly follow the architecture : : - Add support for PMUv3p5 (64bit counters all the way) : : - Various fixes and cleanups : . KVM: arm64: PMU: Fix period computation for 64bit counters with 32bit overflow KVM: arm64: PMU: Sanitise PMCR_EL0.LP on first vcpu run KVM: arm64: PMU: Simplify PMCR_EL0 reset handling KVM: arm64: PMU: Replace version number '0' with ID_AA64DFR0_EL1_PMUVer_NI KVM: arm64: PMU: Make kvm_pmc the main data structure KVM: arm64: PMU: Simplify vcpu computation on perf overflow notification KVM: arm64: PMU: Allow PMUv3p5 to be exposed to the guest KVM: arm64: PMU: Implement PMUv3p5 long counter support KVM: arm64: PMU: Allow ID_DFR0_EL1.PerfMon to be set from userspace KVM: arm64: PMU: Allow ID_AA64DFR0_EL1.PMUver to be set from userspace KVM: arm64: PMU: Move the ID_AA64DFR0_EL1.PMUver limit to VM creation KVM: arm64: PMU: Do not let AArch32 change the counters' top 32 bits KVM: arm64: PMU: Simplify setting a counter to a specific value KVM: arm64: PMU: Add counter_index_to_*reg() helpers KVM: arm64: PMU: Only narrow counters that are not 64bit wide KVM: arm64: PMU: Narrow the overflow checking when required KVM: arm64: PMU: Distinguish between 64bit counter and 64bit overflow KVM: arm64: PMU: Always advertise the CHAIN event KVM: arm64: PMU: Align chained counter implementation with architecture pseudocode arm64: Add ID_DFR0_EL1.PerfMon values for PMUv3p7 and IMP_DEF Signed-off-by: Marc Zyngier <[email protected]>
2 parents 382b5b8 + 58ff656 commit 118bc84

File tree

6 files changed

+356
-310
lines changed

6 files changed

+356
-310
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ struct kvm_arch {
227227

228228
u8 pfr0_csv2;
229229
u8 pfr0_csv3;
230+
struct {
231+
u8 imp:4;
232+
u8 unimp:4;
233+
} dfr0_pmuver;
230234

231235
/* Hypercall features firmware registers' descriptor */
232236
struct kvm_smccc_features smccc_feat;

arch/arm64/include/asm/sysreg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@
698698
#define ID_DFR0_PERFMON_8_1 0x4
699699
#define ID_DFR0_PERFMON_8_4 0x5
700700
#define ID_DFR0_PERFMON_8_5 0x6
701+
#define ID_DFR0_PERFMON_8_7 0x7
702+
#define ID_DFR0_PERFMON_IMP_DEF 0xf
701703

702704
#define ID_ISAR4_SWP_FRAC_SHIFT 28
703705
#define ID_ISAR4_PSR_M_SHIFT 24

arch/arm64/kvm/arm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
164164
set_default_spectre(kvm);
165165
kvm_arm_init_hypercalls(kvm);
166166

167+
/*
168+
* Initialise the default PMUver before there is a chance to
169+
* create an actual PMU.
170+
*/
171+
kvm->arch.dfr0_pmuver.imp = kvm_arm_pmu_get_pmuver_limit();
172+
167173
return 0;
168174

169175
err_free_cpumask:

0 commit comments

Comments
 (0)