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

[Xen-devel] [PATCH 2/2] x86/svm: Add checks for nested HW features



Add a nestedhvm_enable() check to the existing checks for setting the
virtual GIF and virtual VMLOAD/VMSAVE features.  If it isn't a nestedhvm
guest, do not enable the features in the VMCB.

Signed-off-by: Brian Woods <brian.woods@xxxxxxx>
---
 xen/arch/x86/hvm/svm/vmcb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index 0e6cba5b7b..62f7d7f7dd 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -27,6 +27,7 @@
 #include <asm/msr-index.h>
 #include <asm/p2m.h>
 #include <asm/hvm/support.h>
+#include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/svmdebug.h>
 
@@ -202,7 +203,7 @@ static int construct_vmcb(struct vcpu *v)
         svm_disable_intercept_for_msr(v, MSR_IA32_CR_PAT);
 
         /* Use virtual VMLOAD/VMSAVE if available. */
-        if ( cpu_has_svm_vloadsave )
+        if ( cpu_has_svm_vloadsave && nestedhvm_enabled(v->domain) )
         {
             vmcb->virt_ext.fields.vloadsave_enable = 1;
             vmcb->_general2_intercepts &= ~GENERAL2_INTERCEPT_VMLOAD;
@@ -215,7 +216,7 @@ static int construct_vmcb(struct vcpu *v)
     }
 
     /* if available, enable and configure virtual gif */
-    if ( cpu_has_svm_vgif )
+    if ( cpu_has_svm_vgif && nestedhvm_enabled(v->domain) )
     {
         vmcb->_vintr.fields.vgif = 1;
         vmcb->_vintr.fields.vgif_enable = 1;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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