On 8/7/20 1:10 AM, Haibo Xu wrote: > +static void arm_set_spe(Object *obj, bool value, Error **errp) > +{ > + ARMCPU *cpu = ARM_CPU(obj); > + > + if (value) { > + if (kvm_enabled() && !kvm_arm_spe_supported()) { > + error_setg(errp, "'spe' feature not supported by KVM on this > host"); > + return; > + } > + set_feature(&cpu->env, ARM_FEATURE_SPE); > + } else { > + unset_feature(&cpu->env, ARM_FEATURE_SPE); > + } > + cpu->has_spe = value; > +}
I think you want to simply set cpu->has_spe here, and leave the adjustment of ID_AA64DFR0 to a finalize routine. Because there are multiple values that PMSVer can take. Once the get/set routines are only setting a flag on ARMCPU, you can use a simpler property interface: static Property arm_cpu_spe_property = DEFINE_PROP_BOOL("spe", ARMCPU, has_spe, true); qdev_property_add_static(DEVICE(obj), &arm_cpu_spe_property); The finalize routine would be called from arm_cpu_finalize_features(), much like the existing arm_cpu_sve_finalize(). Since you're only registering the spe property when the selected cpu supports spe, the finalize routine only needs to set PMSVer to 0 to turn it off, preserving the initial enabled value of 1 or 2. r~