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

[XEN PATCH v3 05/16] x86: introduce using_{svm,vmx} macros



As we now have SVM/VMX config options for enabling/disabling these features
completely in the build, we need some build-time checks to ensure that vmx/svm
code can be used and things compile. Macros cpu_has_{svm,vmx} used to be doing
such checks at runtime, however they do not check if SVM/VMX support is
enabled in the build.

Also cpu_has_{svm,vmx} can potentially be called from non-{VMX,SVM} build
yet running on {VMX,SVM}-enabled CPU, so would correctly indicate that VMX/SVM
is indeed supported by CPU, but code to drive it can't be used.

New macros using_{vmx,svm} indicates that both CPU _and_ build provide
corresponding technology support, while cpu_has_{vmx,svm} still remains for
informational runtime purpose, just as their naming suggests.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
---
Here I've followed Jan's suggestion on not touching cpu_has_{vmx,svm} but
adding separate macros for solving build problems, and then using these
where required.
---
changes in v3:
 - introduce separate macros instead of modifying behaviour of cpu_has_{vmx,svm}
---
 xen/arch/x86/include/asm/hvm/hvm.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h 
b/xen/arch/x86/include/asm/hvm/hvm.h
index 2ebea1a92c..778b93df5c 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -26,6 +26,9 @@ extern bool opt_hvm_fep;
 #define opt_hvm_fep 0
 #endif
 
+#define using_vmx ( IS_ENABLED(CONFIG_VMX) && cpu_has_vmx )
+#define using_svm ( IS_ENABLED(CONFIG_SVM) && cpu_has_svm )
+
 /* Interrupt acknowledgement sources. */
 enum hvm_intsrc {
     hvm_intsrc_none,
-- 
2.25.1




 


Rackspace

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