273
return vls[0] & MAKE_64BIT_MASK(0, ARM_MAX_VQ);
274
}
275
276
-static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
276
+static void kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
277
{
278
/* Identify the feature bits corresponding to the host CPU, and
279
* fill out the ARMHostCPUClass fields accordingly. To do this
287
uint64_t features = 0;
288
int err;
289
290
+ ahcf->target = QEMU_KVM_ARM_TARGET_NONE;
291
+ ahcf->dtb_compatible = "arm,armv8";
292
+
293
+ if (!kvm_enabled()) {
294
+ return;
295
+ }
296
+
297
/*
298
* target = -1 informs kvm_arm_create_scratch_host_vcpu()
299
* to use the preferred target
333
}
334
335
if (!kvm_arm_create_scratch_host_vcpu(fdarray, &init)) {
329
- return false;
336
+ return;
337
}
338
332
- ahcf->target = init.target;
333
- ahcf->dtb_compatible = "arm,armv8";
339
int fd = fdarray[2];
340
341
err = get_host_cpu_reg(fd, ahcf, ID_AA64PFR0_EL1_IDX);
459
kvm_arm_destroy_scratch_host_vcpu(fdarray);
460
461
if (err < 0) {
457
- return false;
462
+ return;
463
}
464
465
/*
476
features |= 1ULL << ARM_FEATURE_EL2;
477
}
478
479
+ ahcf->target = init.target;
480
ahcf->features = features;
475
-
476
- return true;
481
}
482
483
void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
485
CPUARMState *env = &cpu->env;
486
487
if (!arm_host_cpu_features.dtb_compatible) {
484
- if (!kvm_enabled() ||
485
- !kvm_arm_get_host_cpu_features(&arm_host_cpu_features)) {
486
- /* We can't report this error yet, so flag that we need to
487
- * in arm_cpu_realizefn().
488
- */
489
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_NONE;
490
- cpu->host_cpu_probe_failed = true;
491
- return;
492
- }
488
+ kvm_arm_get_host_cpu_features(&arm_host_cpu_features);
489
}
490
491
cpu->kvm_target = arm_host_cpu_features.target;
492
+
493
+ if (cpu->kvm_target == QEMU_KVM_ARM_TARGET_NONE) {
494
+ /*
495
+ * We can't report this error yet, so flag that we need to
496
+ * in arm_cpu_realizefn().
497
+ */
498
+ cpu->host_cpu_probe_failed = true;
499
+ return;
500
+ }
501
+
502
cpu->dtb_compatible = arm_host_cpu_features.dtb_compatible;
503
cpu->isar = arm_host_cpu_features.isar;
504
cpu->sve_vq.supported = arm_host_cpu_features.sve_vq_supported;