x86/HVM: hide SVM/VMX when their enabling is prohibited by firmware

... or we fail to enable the functionality on the BSP for other reasons.
The only place where hardware announcing the feature is recorded is the
raw CPU policy/featureset.

Inspired by https://lore.kernel.org/all/20230921114940.957141-1-pbonzini@redhat.com/.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 0b5f149338
master date: 2024-01-09 14:06:34 +0100
This commit is contained in:
Jan Beulich committed 2024-03-05 11:56:31 +01:00
1 parent 6cbccc4071
commit 9c0d518eb8
2 files changed
+18

No files matched your search

+1
View File
@@ -1669,6 +1669,7 @@ const struct hvm_function_table * __init start_svm(void)
if ( _svm_cpu_up(true) )
{
setup_clear_cpu_cap(X86_FEATURE_SVM);
printk("SVM: failed to initialise.\n");
return NULL;
}
+17
View File
@@ -2163,6 +2163,23 @@ int __init vmx_vmcs_init(void)
if ( !ret )
register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1);
else
{
setup_clear_cpu_cap(X86_FEATURE_VMX);
/*
* _vmx_vcpu_up() may have made it past feature identification.
* Make sure all dependent features are off as well.
*/
vmx_basic_msr = 0;
vmx_pin_based_exec_control = 0;
vmx_cpu_based_exec_control = 0;
vmx_secondary_exec_control = 0;
vmx_vmexit_control = 0;
vmx_vmentry_control = 0;
vmx_ept_vpid_cap = 0;
vmx_vmfunc = 0;
}
return ret;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.