Re: [PATCH v10 005/108] KVM: TDX: Initialize the TDX module when loading the KVM intel kernel module

From: Erdem Aktas
Date: Wed Jan 11 2023 - 17:03:22 EST


On Sat, Oct 29, 2022 at 11:24 PM <isaku.yamahata@xxxxxxxxx> wrote:
>
> From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>

> +int __init tdx_hardware_setup(struct kvm_x86_ops *x86_ops)
> +{
> + int r;
> +
> + if (!enable_ept) {
> + pr_warn("Cannot enable TDX with EPT disabled\n");
> + return -EINVAL;
> + }
> +
> + /* MOVDIR64B instruction is needed. */
> + if (!static_cpu_has(X86_FEATURE_MOVDIR64B)) {
> + pr_warn("Cannot enable TDX with MOVDIR64B supported ");
> + return -ENODEV;
> + }
> +
> + /* TDX requires VMX. */
> + r = vmxon_all();
> + if (!r)
> + r = tdx_module_setup();
> + vmxoff_all();

if few CPUs have VMX enabled, this will disable VMX in all of them.
Depending on what enabled VMX on those CPUs, would this not cause
kernel crashes/problems?