Skip to content

Commit 6d4b81e

Browse files
committed
Merge branch kvm-arm64/nv-pmu into kvmarm/next
* kvm-arm64/nv-pmu: : Support for vEL2 PMU controls : : Align the vEL2 PMU support with the current state of non-nested KVM, : including: : : - Trap routing, with the annoying complication of EL2 traps that apply : in Host EL0 : : - PMU emulation, using the correct configuration bits depending on : whether a counter falls in the hypervisor or guest range of PMCs : : - Perf event swizzling across nested boundaries, as the event filtering : needs to be remapped to cope with vEL2 KVM: arm64: nv: Reprogram PMU events affected by nested transition KVM: arm64: nv: Apply EL2 event filtering when in hyp context KVM: arm64: nv: Honor MDCR_EL2.HLP KVM: arm64: nv: Honor MDCR_EL2.HPME KVM: arm64: Add helpers to determine if PMC counts at a given EL KVM: arm64: nv: Adjust range of accessible PMCs according to HPMN KVM: arm64: Rename kvm_pmu_valid_counter_mask() KVM: arm64: nv: Advertise support for FEAT_HPMN0 KVM: arm64: nv: Describe trap behaviour of MDCR_EL2.HPMN KVM: arm64: nv: Honor MDCR_EL2.{TPM, TPMCR} in Host EL0 KVM: arm64: nv: Reinject traps that take effect in Host EL0 KVM: arm64: nv: Rename BEHAVE_FORWARD_ANY KVM: arm64: nv: Allow coarse-grained trap combos to use complex traps KVM: arm64: Describe RES0/RES1 bits of MDCR_EL2 arm64: sysreg: Add new definitions for ID_AA64DFR0_EL1 arm64: sysreg: Migrate MDCR_EL2 definition to table arm64: sysreg: Describe ID_AA64DFR2_EL1 fields Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
2 parents 4bc1a88 + ae323e0 commit 6d4b81e

File tree

9 files changed

+440
-176
lines changed

9 files changed

+440
-176
lines changed

arch/arm64/include/asm/kvm_arm.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -312,35 +312,6 @@
312312
GENMASK(19, 18) | \
313313
GENMASK(15, 0))
314314

315-
/* Hyp Debug Configuration Register bits */
316-
#define MDCR_EL2_E2TB_MASK (UL(0x3))
317-
#define MDCR_EL2_E2TB_SHIFT (UL(24))
318-
#define MDCR_EL2_HPMFZS (UL(1) << 36)
319-
#define MDCR_EL2_HPMFZO (UL(1) << 29)
320-
#define MDCR_EL2_MTPME (UL(1) << 28)
321-
#define MDCR_EL2_TDCC (UL(1) << 27)
322-
#define MDCR_EL2_HLP (UL(1) << 26)
323-
#define MDCR_EL2_HCCD (UL(1) << 23)
324-
#define MDCR_EL2_TTRF (UL(1) << 19)
325-
#define MDCR_EL2_HPMD (UL(1) << 17)
326-
#define MDCR_EL2_TPMS (UL(1) << 14)
327-
#define MDCR_EL2_E2PB_MASK (UL(0x3))
328-
#define MDCR_EL2_E2PB_SHIFT (UL(12))
329-
#define MDCR_EL2_TDRA (UL(1) << 11)
330-
#define MDCR_EL2_TDOSA (UL(1) << 10)
331-
#define MDCR_EL2_TDA (UL(1) << 9)
332-
#define MDCR_EL2_TDE (UL(1) << 8)
333-
#define MDCR_EL2_HPME (UL(1) << 7)
334-
#define MDCR_EL2_TPM (UL(1) << 6)
335-
#define MDCR_EL2_TPMCR (UL(1) << 5)
336-
#define MDCR_EL2_HPMN_MASK (UL(0x1F))
337-
#define MDCR_EL2_RES0 (GENMASK(63, 37) | \
338-
GENMASK(35, 30) | \
339-
GENMASK(25, 24) | \
340-
GENMASK(22, 20) | \
341-
BIT(18) | \
342-
GENMASK(16, 15))
343-
344315
/*
345316
* FGT register definitions
346317
*

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ static inline bool is_hyp_ctxt(const struct kvm_vcpu *vcpu)
225225
return vcpu_has_nv(vcpu) && __is_hyp_ctxt(&vcpu->arch.ctxt);
226226
}
227227

228+
static inline bool vcpu_is_host_el0(const struct kvm_vcpu *vcpu)
229+
{
230+
return is_hyp_ctxt(vcpu) && !vcpu_is_el2(vcpu);
231+
}
232+
228233
/*
229234
* The layout of SPSR for an AArch32 state is different when observed from an
230235
* AArch64 SPSR_ELx or an AArch32 SPSR_*. This function generates the AArch32

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ enum vcpu_sysreg {
469469
/* EL2 registers */
470470
SCTLR_EL2, /* System Control Register (EL2) */
471471
ACTLR_EL2, /* Auxiliary Control Register (EL2) */
472-
MDCR_EL2, /* Monitor Debug Configuration Register (EL2) */
473472
CPTR_EL2, /* Architectural Feature Trap Register (EL2) */
474473
HACR_EL2, /* Hypervisor Auxiliary Control Register */
475474
ZCR_EL2, /* SVE Control Register (EL2) */
@@ -501,6 +500,7 @@ enum vcpu_sysreg {
501500
/* Anything from this can be RES0/RES1 sanitised */
502501
MARKER(__SANITISED_REG_START__),
503502
TCR2_EL2, /* Extended Translation Control Register (EL2) */
503+
MDCR_EL2, /* Monitor Debug Configuration Register (EL2) */
504504

505505
/* Any VNCR-capable reg goes after this point */
506506
MARKER(__VNCR_START__),

0 commit comments

Comments
 (0)