@@ -150,7 +150,7 @@ struct kvm_vcpu_stat {
struct kvm_vcpu_init;
int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
- const struct kvm_vcpu_init *init);
+ struct kvm_vcpu_init *init);
unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
struct kvm_one_reg;
@@ -56,7 +56,7 @@ struct kvm_regs {
#define KVM_ARM_TARGET_FOUNDATION_V8 1
#define KVM_ARM_TARGET_CORTEX_A57 2
#define KVM_ARM_TARGET_XGENE_POTENZA 3
-
+#define KVM_ARM_TARGET_HOST 0x0FFFFFFF
#define KVM_ARM_NUM_TARGETS 4
/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
@@ -230,12 +230,18 @@ int __attribute_const__ kvm_target_cpu(void)
}
int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
- const struct kvm_vcpu_init *init)
+ struct kvm_vcpu_init *init)
{
unsigned int i;
int phys_target = kvm_target_cpu();
- if (init->target != phys_target)
+ if (phys_target < 0) {
+ return phys_target;
+ }
+
+ if (init->target == KVM_ARM_TARGET_HOST)
+ init->target = phys_target;
+ else if (init->target != phys_target)
return -EINVAL;
vcpu->arch.target = phys_target;