libxl/arm: Add ACPI module
authorShannon Zhao <shannon.zhao@linaro.org>
Thu, 29 Sep 2016 01:18:59 +0000 (18:18 -0700)
committerWei Liu <wei.liu2@citrix.com>
Fri, 30 Sep 2016 10:47:26 +0000 (11:47 +0100)
Add the ARM Multiboot module for ACPI, so UEFI or DomU can get the base
address of ACPI tables from it.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
docs/misc/arm/device-tree/acpi.txt [new file with mode: 0644]
tools/libxl/libxl_arm.c

diff --git a/docs/misc/arm/device-tree/acpi.txt b/docs/misc/arm/device-tree/acpi.txt
new file mode 100644 (file)
index 0000000..3e70157
--- /dev/null
@@ -0,0 +1,24 @@
+DomU ACPI module
+================================
+
+Xen toolstack passes the domU ACPI tables via a reference in the /chosen node of
+the device tree.
+
+Each node contains the following properties:
+
+- compatible
+
+       "xen,guest-acpi", "multiboot,module"
+
+- reg
+
+       Specifies the physical address and the length of the module.
+       RSDP table is always located at the beginning of this region.
+
+Examples
+========
+
+       module@0x20000000 {
+               compatible = "xen,guest-acpi", "multiboot,module";
+               reg = <0x20000000 0x1234>;
+       };
index 19d3067b42da6f4616995e7f2672fe5c3297e7b9..376307e6f94c878fc96e8d6f56c4c6e25325804b 100644 (file)
@@ -285,6 +285,25 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
         if (res) return res;
     }
 
+    if (libxl_defbool_val(info->acpi)) {
+        const uint64_t acpi_base = GUEST_ACPI_BASE;
+        const char *name = GCSPRINTF("module@%"PRIx64, acpi_base);
+
+        res = fdt_begin_node(fdt, name);
+        if (res) return res;
+
+        res = fdt_property_compat(gc, fdt, 2, "xen,guest-acpi",
+                                  "multiboot,module");
+        if (res) return res;
+
+        res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS,
+                                1, 0, 0);
+        if (res) return res;
+
+        res = fdt_end_node(fdt);
+        if (res) return res;
+    }
+
     res = fdt_end_node(fdt);
     if (res) return res;
 
@@ -975,6 +994,11 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
         finalise_one_node(gc, fdt, "/memory", bankbase[i], size);
     }
 
+    if (dom->acpi_modules[0].data) {
+        finalise_one_node(gc, fdt, "/chosen/module", GUEST_ACPI_BASE,
+                          dom->acpi_modules[0].length);
+    }
+
     debug_dump_fdt(gc, fdt);
 
     return 0;