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

[Xen-devel] [PATCH v3 06/16] libxl: Load guest ACPI table from file



A user can provide a different ACPI tables than the default one by using
the existing "acpi_firmware" xl's config option or the field
u.hvm.acpi_firmware.

libxl will check if the provided table is a DSDT or not.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

---
Change in V3:
- use existing acpi_firmware option to provide an override for the acpi
  tables. Will check if it's a DSDT or an extra tables.
---
 tools/libxl/libxl_dom.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 50abfbc..87853fd 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -905,6 +905,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
     int datalen = 0;
     void *data;
     const char *bios_filename = NULL;
+    const char *full_acpi_tables_filename = NULL;
 
     if (info->u.hvm.firmware)
         firmware = info->u.hvm.firmware;
@@ -964,6 +965,10 @@ static int libxl__domain_firmware(libxl__gc *gc,
                 abort();
             }
         }
+
+        full_acpi_tables_filename =
+            libxl__abs_path(gc, "dsdt_anycpu_qemu_xen.aml",
+                            libxl__xenfirmwaredir_path());
     }
 
     if (bios_filename) {
@@ -1008,6 +1013,27 @@ static int libxl__domain_firmware(libxl__gc *gc,
         }
     }
 
+    /*
+     * Check if the user supplied ACPI tables are the full tables, or if
+     * there are only extra tables. The full tables start with the DSDT
+     * table, and the signature is in the first four bytes.
+     */
+    if (!dom->acpi_module.length
+          || strncmp("DSDT", (char*)dom->acpi_module.data, 4)) {
+        if (full_acpi_tables_filename) {
+            rc = libxl__load_hvm_firmware_module(gc, full_acpi_tables_filename,
+                                                 "ACPI tables",
+                                                 &dom->full_acpi_module);
+            if (rc) goto out;
+        }
+    } else {
+        /* Use user supplied DSDT tables. */
+        dom->full_acpi_module.data = dom->acpi_module.data;
+        dom->full_acpi_module.length = dom->acpi_module.length;
+        dom->acpi_module.length = 0;
+        dom->acpi_module.data = NULL;
+    }
+
     return 0;
 out:
     assert(rc != 0);
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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