On 5/5/2025 11:29 PM, Zhao Liu wrote:
@e -875,6 +876,13 @@ static int tdx_check_features(X86ConfidentialGuest *cg,
CPUState *cs)
return -1;
Here you has already used "return -1", so...
}
+ if (cpu->phys_bits != host_cpu_phys_bits()) {
+ error_report("TDX requires guest CPU physical bits (%u) "
+ "to match host CPU physical bits (%u)",
+ cpu->phys_bits, host_cpu_phys_bits());
+ exit(1);
...what about "return -1"?
I will change it to return -EINVAL and as well for the above. Since ...
kvm_init_vcpu() missed a "goto err", but it is not a big deal:
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 9862d8ff1d38..05034f622f20 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -595,6 +595,7 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp)
error_setg_errno(errp, -ret,
"kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)",
kvm_arch_vcpu_id(cpu));
... the handling here expects the @ret is a errno.
+ goto err;
}
cpu->kvm_vcpu_stats_fd = kvm_vcpu_ioctl(cpu, KVM_GET_STATS_FD, NULL);
---
Overall, LGTM,
Reviewed-by: Zhao Liu <zhao1....@intel.com>
+ }
+
return 0;
}
--
2.34.1