@@ -155,9 +155,9 @@ static int __init cf_check hvm_enable(void)
{
const struct hvm_function_table *fns = NULL;
- if ( cpu_has_vmx )
+ if ( using_vmx() )
fns = start_vmx();
- else if ( cpu_has_svm )
+ else if ( using_svm() )
fns = start_svm();
if ( fns == NULL )
@@ -155,9 +155,9 @@ static int __init cf_check nestedhvm_setup(void)
* done, so that if (for example) HAP is disabled, nested virt is
* disabled as well.
*/
- if ( cpu_has_vmx )
+ if ( using_vmx() )
start_nested_vmx(&hvm_funcs);
- else if ( cpu_has_svm )
+ else if ( using_svm() )
start_nested_svm(&hvm_funcs);
return 0;
@@ -363,6 +363,16 @@ int hvm_copy_context_and_params(struct domain *dst, struct domain *src);
int hvm_get_param(struct domain *d, uint32_t index, uint64_t *value);
+static inline bool using_vmx(void)
+{
+ return IS_ENABLED(CONFIG_INTEL_VMX) && cpu_has_vmx;
+}
+
+static inline bool using_svm(void)
+{
+ return IS_ENABLED(CONFIG_AMD_SVM) && cpu_has_svm;
+}
+
#ifdef CONFIG_HVM
#define hvm_get_guest_tsc(v) hvm_get_guest_tsc_fixed(v, 0)