[PATCH] add nested HVM to libxl

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

 



---
 docs/schemas/domaincommon.rng | 10 ++++++++++
 src/conf/domain_conf.c        |  6 ++++++
 src/conf/domain_conf.h        |  2 ++
 src/libxl/libxl_conf.c        | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 53 insertions(+)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f196177..402ff16 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4083,6 +4083,16 @@
             </element>
           </optional>
           <optional>
+            <element name="nestedhvm">
+              <empty/>
+            </element>
+          </optional>
+          <optional>
+            <element name="mask_svm_npt">
+              <empty/>
+            </element>
+          </optional>
+          <optional>
             <ref name="hyperv"/>
           </optional>
           <optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6df1618..350729e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -140,6 +140,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
               "apic",
               "pae",
               "hap",
+              "nestedhvm",
+              "mask_svm_npt",
               "viridian",
               "privnet",
               "hyperv",
@@ -15400,6 +15402,8 @@ virDomainDefParseXML(xmlDocPtr xml,
         case VIR_DOMAIN_FEATURE_ACPI:
         case VIR_DOMAIN_FEATURE_PAE:
         case VIR_DOMAIN_FEATURE_HAP:
+        case VIR_DOMAIN_FEATURE_NESTEDHVM:
+        case VIR_DOMAIN_FEATURE_MASK_SVM_NPT:
         case VIR_DOMAIN_FEATURE_VIRIDIAN:
         case VIR_DOMAIN_FEATURE_PRIVNET:
         case VIR_DOMAIN_FEATURE_HYPERV:
@@ -22054,6 +22058,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             case VIR_DOMAIN_FEATURE_ACPI:
             case VIR_DOMAIN_FEATURE_PAE:
             case VIR_DOMAIN_FEATURE_HAP:
+            case VIR_DOMAIN_FEATURE_NESTEDHVM:
+            case VIR_DOMAIN_FEATURE_MASK_SVM_NPT:
             case VIR_DOMAIN_FEATURE_VIRIDIAN:
             case VIR_DOMAIN_FEATURE_PRIVNET:
                 switch ((virTristateSwitch) def->features[i]) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f043554..a71b081 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1674,6 +1674,8 @@ typedef enum {
     VIR_DOMAIN_FEATURE_APIC,
     VIR_DOMAIN_FEATURE_PAE,
     VIR_DOMAIN_FEATURE_HAP,
+    VIR_DOMAIN_FEATURE_NESTEDHVM,
+    VIR_DOMAIN_FEATURE_MASK_SVM_NPT,
     VIR_DOMAIN_FEATURE_VIRIDIAN,
     VIR_DOMAIN_FEATURE_PRIVNET,
     VIR_DOMAIN_FEATURE_HYPERV,
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 35fd495..008f339 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -486,6 +486,21 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
                                                0,
                                                1) == NULL)
                 return -1;
+            if (virCapabilitiesAddGuestFeature(guest,
+                                               "mask_svm_npt",
+                                               0,
+                                               1) == NULL)
+                return -1;
+            if (virCapabilitiesAddGuestFeature(guest,
+                                               "nestedhvm",
+                                               0,
+                                               1) == NULL)
+                return -1;
+            if (virCapabilitiesAddGuestFeature(guest,
+                                               "viridian",
+                                               0,
+                                               1) == NULL)
+                return -1;
         }
     }
 
@@ -660,6 +675,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
     b_info->sched_params.weight = 1000;
     b_info->max_memkb = virDomainDefGetMemoryInitial(def);
     b_info->target_memkb = def->mem.cur_balloon;
+
     if (hvm) {
         char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
 
@@ -672,6 +688,24 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
         libxl_defbool_set(&b_info->u.hvm.acpi,
                           def->features[VIR_DOMAIN_FEATURE_ACPI] ==
                           VIR_TRISTATE_SWITCH_ON);
+        libxl_defbool_set(&b_info->u.hvm.viridian,
+                          def->features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
+                          VIR_TRISTATE_SWITCH_ON);
+        libxl_defbool_set(&b_info->u.hvm.nested_hvm,
+                          def->features[VIR_DOMAIN_FEATURE_NESTEDHVM] ==
+                          VIR_TRISTATE_SWITCH_ON);
+        if (def->features[VIR_DOMAIN_FEATURE_MASK_SVM_NPT] ==
+                          VIR_TRISTATE_SWITCH_ON)
+            libxl_cpuid_parse_config(&b_info->cpuid, "svm_npt=0");
+
+        if ((b_info->max_memkb != b_info->target_memkb) &&
+            (def->features[VIR_DOMAIN_FEATURE_NESTEDHVM] ==
+                VIR_TRISTATE_SWITCH_ON)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                _("mem and mexmem must be the same if nestedhvm is enabled"));
+            return -1;
+        }
+
         for (i = 0; i < def->clock.ntimers; i++) {
             if (def->clock.timers[i]->name == VIR_DOMAIN_TIMER_NAME_HPET &&
                 def->clock.timers[i]->present == 1) {
@@ -1854,6 +1888,7 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
                        libxl_ctx *ctx,
                        libxl_domain_config *d_config)
 {
+
     libxl_domain_config_init(d_config);
 
     if (libxlMakeDomCreateInfo(ctx, def, &d_config->c_info) < 0)
-- 
2.4.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]