@@ -939,6 +939,8 @@ struct kvm_vcpu_arch {
#define HOST_FEAT_HAS_SPE __kvm_single_flag(feats, BIT(0))
/* Save TRBE context if active */
#define HOST_FEAT_HAS_TRBE __kvm_single_flag(feats, BIT(1))
+/* CPU has Feat_TRF */
+#define HOST_FEAT_HAS_TRF __kvm_single_flag(feats, BIT(2))
/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */
#define vcpu_sve_pffr(vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \
@@ -89,10 +89,16 @@ void kvm_arm_init_debug(void)
!(read_sysreg_s(SYS_PMBIDR_EL1) & BIT(PMBIDR_EL1_P_SHIFT)))
host_data_set_flag(HOST_FEAT_HAS_SPE);
- /* Check if we have TRBE implemented and available at the host */
- if (cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_EL1_TraceBuffer_SHIFT) &&
- !(read_sysreg_s(SYS_TRBIDR_EL1) & TRBIDR_EL1_P))
- host_data_set_flag(HOST_FEAT_HAS_TRBE);
+ if (cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_EL1_TraceFilt_SHIFT)) {
+ host_data_set_flag(HOST_FEAT_HAS_TRF);
+ /*
+ * The architecture mandates FEAT_TRF with TRBE, so only need to check
+ * for TRBE if TRF exists.
+ */
+ if (cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_EL1_TraceBuffer_SHIFT) &&
+ !(read_sysreg_s(SYS_TRBIDR_EL1) & TRBIDR_EL1_P))
+ host_data_set_flag(HOST_FEAT_HAS_TRBE);
+ }
}
/**