]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxc/libxl: Allow multiple ACPI modules
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 28 Sep 2016 13:22:01 +0000 (09:22 -0400)
committerWei Liu <wei.liu2@citrix.com>
Wed, 28 Sep 2016 13:32:05 +0000 (14:32 +0100)
Provide ability to load multiple ACPI modules. Thie feature is needed
by PVHv2 guests and will be used in subsequent patches.

We assume that PVHv2 guests do not load their ACPI modules specified
in the configuration file. We can extend support for that in the future
if desired.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/include/xc_dom.h
tools/libxc/xc_dom_hvmloader.c
tools/libxl/libxl_dom.c

index de7dca92d698474a7f773552b7c1a1641af6b2c6..608cbc2ad6712e8452d77d3f3ad407aa9cb27a8c 100644 (file)
@@ -212,8 +212,9 @@ struct xc_dom_image {
     /* BIOS/Firmware passed to HVMLOADER */
     struct xc_hvm_firmware_module system_firmware_module;
 
-    /* Extra ACPI tables passed to HVMLOADER */
-    struct xc_hvm_firmware_module acpi_module;
+    /* Extra ACPI tables */
+#define MAX_ACPI_MODULES        4
+    struct xc_hvm_firmware_module acpi_modules[MAX_ACPI_MODULES];
 
     /* Extra SMBIOS structures passed to HVMLOADER */
     struct xc_hvm_firmware_module smbios_module;
index 6eb851661c0b3e05c04adbd88cb7f4192f1a8cb0..59f94e51e51a517558edd964f29c54b07895480e 100644 (file)
@@ -172,7 +172,8 @@ static int modules_init(struct xc_dom_image *dom)
     rc = module_init_one(dom, &dom->system_firmware_module,
                          "System Firmware module");
     if ( rc ) goto err;
-    rc = module_init_one(dom, &dom->acpi_module, "ACPI module");
+    /* Only one module can be added */
+    rc = module_init_one(dom, &dom->acpi_modules[0], "ACPI module");
     if ( rc ) goto err;
     rc = module_init_one(dom, &dom->smbios_module, "SMBIOS module");
     if ( rc ) goto err;
index c895649e4a2cd4d4c0e87727a1a86ff2d5cd3872..c4be916d621a8a0028d222cf3ece817baac4f7c0 100644 (file)
@@ -818,7 +818,8 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
 
 static int hvm_build_set_xs_values(libxl__gc *gc,
                                    uint32_t domid,
-                                   struct xc_dom_image *dom)
+                                   struct xc_dom_image *dom,
+                                   const libxl_domain_build_info *info)
 {
     char *path = NULL;
     int ret = 0;
@@ -839,18 +840,20 @@ static int hvm_build_set_xs_values(libxl__gc *gc,
             goto err;
     }
 
-    if (dom->acpi_module.guest_addr_out) {
+    /* Only one module can be passed. PVHv2 guests do not support this. */
+    if (dom->acpi_modules[0].guest_addr_out && 
+        info->device_model_version !=LIBXL_DEVICE_MODEL_VERSION_NONE) {
         path = GCSPRINTF("/local/domain/%d/"HVM_XS_ACPI_PT_ADDRESS, domid);
 
         ret = libxl__xs_printf(gc, XBT_NULL, path, "0x%"PRIx64,
-                               dom->acpi_module.guest_addr_out);
+                               dom->acpi_modules[0].guest_addr_out);
         if (ret)
             goto err;
 
         path = GCSPRINTF("/local/domain/%d/"HVM_XS_ACPI_PT_LENGTH, domid);
 
         ret = libxl__xs_printf(gc, XBT_NULL, path, "0x%x",
-                               dom->acpi_module.length);
+                               dom->acpi_modules[0].length);
         if (ret)
             goto err;
     }
@@ -994,6 +997,13 @@ static int libxl__domain_firmware(libxl__gc *gc,
     }
 
     if (info->u.hvm.acpi_firmware) {
+
+        if (info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_NONE) {
+            LOGE(ERROR, "PVH guests do not allow loading ACPI modules");
+            rc = ERROR_FAIL;
+            goto out;
+        }
+
         data = NULL;
         e = libxl_read_file_contents(ctx, info->u.hvm.acpi_firmware,
                                      &data, &datalen);
@@ -1005,9 +1015,9 @@ static int libxl__domain_firmware(libxl__gc *gc,
         }
         libxl__ptr_add(gc, data);
         if (datalen) {
-            /* Only accept non-empty files */
-            dom->acpi_module.data = data;
-            dom->acpi_module.length = (uint32_t)datalen;
+            /* Only accept a non-empty file */
+            dom->acpi_modules[0].data = data;
+            dom->acpi_modules[0].length = (uint32_t)datalen;
         }
     }
 
@@ -1143,7 +1153,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
         goto out;
     }
 
-    rc = hvm_build_set_xs_values(gc, domid, dom);
+    rc = hvm_build_set_xs_values(gc, domid, dom, info);
     if (rc != 0) {
         LOG(ERROR, "hvm build set xenstore values failed");
         goto out;