Recent kernels use this to set the cpu and features (currently, only the A15 is supported). Note that this causes the registers in the CPU to be initialized, so it's important that all CPUs are created first (they are, as it turns out). This code ignores errors, for backwards compatibility with older kernels. Signed-off-by: Rusty Russell <rusty.russell at linaro.org> diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h index 38ff1d6..988890a 100644 --- a/linux-headers/asm-arm/kvm.h +++ b/linux-headers/asm-arm/kvm.h @@ -66,7 +66,13 @@ struct kvm_regs { }; +/* Supported Processor Types */ +#define KVM_ARM_TARGET_CORTEX_A15 (0xC0F) + struct kvm_sregs { + __u32 target; + __u32 num_features; + __u32 features[14]; }; struct kvm_fpu { diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 29bb51f..67d005f 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -34,7 +34,13 @@ int kvm_arch_init(KVMState *s) int kvm_arch_init_vcpu(CPUARMState *env) { - return 0; + struct kvm_sregs sregs; + + sregs.target = KVM_ARM_TARGET_CORTEX_A15; + sregs.num_features = 0; + + /* Ignore failure for compatibility with old kvm versions. */ + return kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs) ? 0 : 0; } int kvm_arch_put_registers(CPUARMState *env, int level)