Re: [PATCH v2 05/16] KVM: VMX: Drop initialization of IA32_FEATURE_CONTROL MSR

From: Borislav Petkov
Date: Fri Oct 25 2019 - 12:26:52 EST


On Mon, Oct 21, 2019 at 05:08:20PM -0700, Sean Christopherson wrote:
> + if (WARN_ON_ONCE(!(msr & FEATURE_CONTROL_LOCKED)))
> + return 1;
> +
> + /* launched w/ TXT and VMX disabled */
> + if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX) &&
> + tboot_enabled())
> + return 1;
> + /* launched w/o TXT and VMX only enabled w/ TXT */
> + if (!(msr & FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX) &&
> + (msr & FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX) &&
> + !tboot_enabled()) {
> + pr_warn("kvm: disable TXT in the BIOS or "
> + "activate TXT before enabling KVM\n");
> + return 1;

Might as well fix that with a cleanup patch ontop:

WARNING: quoted string split across lines
#69: FILE: arch/x86/kvm/vmx/vmx.c:2208:
+ pr_warn("kvm: disable TXT in the BIOS or "
+ "activate TXT before enabling KVM\n");


Also in that same cleanup patch, if the order of those tests doesn't
matter, you can simplify them a bit:

if (tboot_enabled()) {
/* msr flag test here */

/* tboot disabled */
} else {
/* other two tests here */
}

Should make it a bit easier to parse.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette