[libvirt] [PATCH v1 1/3] libxl: set nestedhvm when vmx|svm is required

Wim Ten Have wim.ten.have at oracle.com
Wed Mar 8 14:07:13 UTC 2017


From: Joao Martins <joao.m.martins at oracle.com>

nestedhvm is the option on Xen 4.4+ which enables nested
virtualization on Xen. We set this field when one of the
following features is included in a host-passthrough CPU
element:

<feature policy='require' name='vmx'/>

or:

<feature policy='require' name='svm'/>

Signed-off-by: Joao Martins <joao.m.martins at oracle.com>
Signed-off-by: Wim ten Have <wim.ten.have at oracle.com>
---
 src/libxl/libxl_conf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f5b788b..8c4c511 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -374,6 +374,15 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
                           def->features[VIR_DOMAIN_FEATURE_ACPI] ==
                           VIR_TRISTATE_SWITCH_ON);
 
+        if (def->cpu && def->cpu->nfeatures) {
+            for (i = 0; i < def->cpu->nfeatures; i++) {
+                if (def->cpu->features[i].policy == VIR_CPU_FEATURE_REQUIRE &&
+                    (STREQ(def->cpu->features[i].name, "vmx") ||
+                     STREQ(def->cpu->features[i].name, "svm")))
+                    libxl_defbool_set(&b_info->u.hvm.nested_hvm, true);
+            }
+        }
+
         if (def->nsounds > 0) {
             /*
              * Use first sound device.  man xl.cfg(5) describes soundhw as
-- 
2.9.3




More information about the libvir-list mailing list