Skip to content

Commit 166b77a

Browse files
committed
KVM: arm64: nv: Advertise support for FEAT_HPMN0
Everything is in place now for KVM to actually handle MDCR_EL2.HPMN. Not only that, the emulation is capable of doing FEAT_HPMN0. Advertise support for the feature in the VM's ID registers. It is possible to emulate FEAT_HPMN0 on hardware that doesn't support it since KVM currently traps all PMU registers. Having said that, let's only advertise the feature on supporting hardware in case KVM ever provides 'direct' PMU support to VMs w/o involving host perf. Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20241025182354.3364124-12-oliver.upton@linux.dev Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 336afe0 commit 166b77a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/arm64/kvm/nested.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,12 +917,13 @@ static void limit_nv_id_regs(struct kvm *kvm)
917917
ID_AA64MMFR4_EL1_E2H0_NI_NV1);
918918
kvm_set_vm_id_reg(kvm, SYS_ID_AA64MMFR4_EL1, val);
919919

920-
/* Only limited support for PMU, Debug, BPs and WPs */
920+
/* Only limited support for PMU, Debug, BPs, WPs, and HPMN0 */
921921
val = kvm_read_vm_id_reg(kvm, SYS_ID_AA64DFR0_EL1);
922922
val &= (NV_FTR(DFR0, PMUVer) |
923923
NV_FTR(DFR0, WRPs) |
924924
NV_FTR(DFR0, BRPs) |
925-
NV_FTR(DFR0, DebugVer));
925+
NV_FTR(DFR0, DebugVer) |
926+
NV_FTR(DFR0, HPMN0));
926927

927928
/* Cap Debug to ARMv8.1 */
928929
tmp = FIELD_GET(NV_FTR(DFR0, DebugVer), val);

0 commit comments

Comments
 (0)