On 13.02.2023 15:57, Xenia Ragiadakou wrote:
> --- a/xen/arch/x86/include/asm/hvm/hvm.h
> +++ b/xen/arch/x86/include/asm/hvm/hvm.h
> @@ -261,8 +261,16 @@ extern struct hvm_function_table hvm_funcs;
> extern bool_t hvm_enabled;
> extern s8 hvm_port80_allowed;
>
> +#ifdef CONFIG_AMD_SVM
> extern const struct hvm_function_table *start_svm(void);
> +#else
> +static inline const struct hvm_function_table *start_svm(void) { return
> NULL; }
> +#endif
> +#ifdef CONFIG_INTEL_VMX
> extern const struct hvm_function_table *start_vmx(void);
> +#else
> +static inline const struct hvm_function_table *start_vmx(void) { return
> NULL; }
> +#endif
>
> int hvm_domain_initialise(struct domain *d,
> const struct xen_domctl_createdomain *config);
Instead of this (which I consider harder to read), may I suggest
if ( IS_ENABLED(CONFIG_VMX) && cpu_has_vmx )
fns = start_vmx();
else if ( IS_ENABLED(CONFIG_SVM) && cpu_has_svm )
fns = start_svm();
in hvm_enable() instead (with DCE taking care of removing the dead
calls)?
Jan