[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 02/10] x86/hvm: separate AMD-V and Intel VT-x hvm_function_table initializers




On 2/13/23 18:47, Jan Beulich wrote:
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)?

Sure, it looks much better this way.


Jan

--
Xenia



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.