@@ -97,6 +97,7 @@ struct kvm_regs {
#define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */
#define KVM_ARM_VCPU_PSCI_0_2 2 /* CPU uses PSCI v0.2 */
#define KVM_ARM_VCPU_PMU_V3 3 /* Support guest PMUv3 */
+#define KVM_ARM_VCPU_RAS_EXTENSION 4
struct kvm_vcpu_init {
__u32 target;
@@ -883,6 +883,7 @@ struct kvm_ppc_resize_hpt {
#define KVM_CAP_PPC_MMU_RADIX 134
#define KVM_CAP_PPC_MMU_HASH_V3 135
#define KVM_CAP_IMMEDIATE_EXIT 136
+#define KVM_CAP_ARM_RAS_EXTENSION 137
#ifdef KVM_CAP_IRQ_ROUTING
@@ -610,6 +610,8 @@ struct ARMCPU {
/* CPU has memory protection unit */
bool has_mpu;
+ /* CPU has ras extension unit */
+ bool has_ras_extension;
/* PMSAv7 MPU number of supported regions */
uint32_t pmsav7_dregion;
@@ -1216,6 +1218,7 @@ enum arm_features {
ARM_FEATURE_THUMB_DSP, /* DSP insns supported in the Thumb encodings */
ARM_FEATURE_PMU, /* has PMU support */
ARM_FEATURE_VBAR, /* has cp15 VBAR */
+ ARM_FEATURE_RAS_EXTENSION, /*has RAS extension support */
};
static inline int arm_feature(CPUARMState *env, int feature)
@@ -518,6 +518,14 @@ int kvm_arch_init_vcpu(CPUState *cs)
unset_feature(&env->features, ARM_FEATURE_PMU);
}
+ if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_RAS_EXTENSION)) {
+ cpu->has_ras_extension = true;
+ cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_RAS_EXTENSION;
+ } else {
+ cpu->has_ras_extension = false;
+ unset_feature(&env->features, ARM_FEATURE_RAS_EXTENSION);
+ }
+
/* Do KVM_ARM_VCPU_INIT ioctl */
ret = kvm_arm_vcpu_init(cs);
if (ret) {
check if kvm supports guest RAS EXTENSION. if so, set corresponding feature bit for vcpu. Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com> --- linux-headers/asm-arm64/kvm.h | 1 + linux-headers/linux/kvm.h | 1 + target/arm/cpu.h | 3 +++ target/arm/kvm64.c | 8 ++++++++ 4 files changed, 13 insertions(+)