[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO0LYuzdRHsB7aPj@google.com>
Date: Mon, 13 Oct 2025 07:23:30 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Chao Gao <chao.gao@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"Kirill A. Shutemov" <kas@...nel.org>, Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
linux-coco@...ts.linux.dev, kvm@...r.kernel.org,
Dan Williams <dan.j.williams@...el.com>, Xin Li <xin@...or.com>,
Kai Huang <kai.huang@...el.com>, Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [RFC PATCH 3/4] KVM: x86/tdx: Do VMXON and TDX-Module
initialization during tdx_init()
On Mon, Oct 13, 2025, Chao Gao wrote:
> >-static int __tdx_enable(void)
> >+static __init int tdx_enable(void)
> > {
> >+ enum cpuhp_state state;
> > int ret;
> >
> >+ if (!cpu_feature_enabled(X86_FEATURE_XSAVE)) {
> >+ pr_err("XSAVE is required for TDX\n");
> >+ return -EINVAL;
> >+ }
> >+
> >+ if (!cpu_feature_enabled(X86_FEATURE_MOVDIR64B)) {
> >+ pr_err("MOVDIR64B is required for TDX\n");
> >+ return -EINVAL;
> >+ }
> >+
> >+ if (!cpu_feature_enabled(X86_FEATURE_SELFSNOOP)) {
> >+ pr_err("Self-snoop is required for TDX\n");
> >+ return -ENODEV;
> >+ }
> >+
> >+ state = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "virt/tdx:online",
> >+ tdx_online_cpu, tdx_offline_cpu);
> >+ if (state < 0)
> >+ return state;
> >+
> > ret = init_tdx_module();
>
> ...
>
> >@@ -1445,11 +1462,6 @@ void __init tdx_init(void)
> > return;
> > }
> >
> >-#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
> >- pr_info("Disable ACPI S3. Turn off TDX in the BIOS to use ACPI S3.\n");
> >- acpi_suspend_lowlevel = NULL;
> >-#endif
> >-
> > /*
> > * Just use the first TDX KeyID as the 'global KeyID' and
> > * leave the rest for TDX guests.
> >@@ -1458,22 +1470,30 @@ void __init tdx_init(void)
> > tdx_guest_keyid_start = tdx_keyid_start + 1;
> > tdx_nr_guest_keyids = nr_tdx_keyids - 1;
> >
> >+ err = tdx_enable();
> >+ if (err)
> >+ goto err_enable;
>
> IIRC, existing TDX modules require all CPUs to have completed per-CPU
> initialization before TDMR/PAMT initialization.
>
> But at this point, APs are not online, so tdx_enable() will fail here.
Ah. Maybe invoke tdx_enable() through a subsys_initcall() then?
Powered by blists - more mailing lists