[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO07n_1LYtY8Oio6@google.com>
Date: Mon, 13 Oct 2025 10:49:19 -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 2/4] KVM: x86: Extract VMXON and EFER.SVME enablement
to kernel
On Mon, Oct 13, 2025, Chao Gao wrote:
> >+void __init x86_virt_init(void)
> >+{
> >+ cpu_emergency_virt_cb *vmx_cb = NULL, *svm_cb = NULL;
> >+
> >+ if (x86_virt_is_vmx())
> >+ vmx_cb = x86_vmx_init();
> >+
> >+ if (x86_virt_is_svm())
> >+ svm_cb = x86_svm_init();
> >+
> >+ if (!vmx_cb && !svm_cb)
> >+ return;
> >+
> >+ if (WARN_ON_ONCE(vmx_cb && svm_cb))
> >+ return;
> >+
> >+ cpu_emergency_register_virt_callback(vmx_cb ? : svm_cb);
>
> To be consistent with x86_virt_{get,put}_cpu(), perhaps we can have a common
> emergency callback and let reboot.c call it directly, with the common callback
> routing to svm/vmx code according to the hardware type.
Oh, yeah, that's a much better idea, especially if x86_virt_init() runs
unconditionally during boot (as proposed). cpu_emergency_disable_virtualization()
can be dropped entirely (it'd just be a one-line wrapper).
Powered by blists - more mailing lists