diff mbox

[Xen-devel,v4,13/16] libxl/arm: Add ACPI module

Message ID 1471343113-10652-14-git-send-email-zhaoshenglong@huawei.com
State Superseded
Headers show

Commit Message

Shannon Zhao Aug. 16, 2016, 10:25 a.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

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>
---
 docs/misc/arm/device-tree/acpi.txt | 24 ++++++++++++++++++++++++
 tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 docs/misc/arm/device-tree/acpi.txt

Comments

Julien Grall Aug. 29, 2016, 6:41 p.m. UTC | #1
Hi Shannon,

On 16/08/2016 06:25, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> 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>

> ---
>  docs/misc/arm/device-tree/acpi.txt | 24 ++++++++++++++++++++++++
>  tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
>  2 files changed, 48 insertions(+)
>  create mode 100644 docs/misc/arm/device-tree/acpi.txt
>
> diff --git a/docs/misc/arm/device-tree/acpi.txt b/docs/misc/arm/device-tree/acpi.txt
> new file mode 100644
> index 0000000..3e70157
> --- /dev/null
> +++ b/docs/misc/arm/device-tree/acpi.txt
> @@ -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>;
> +	};
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index b95fdf5..11a6f6e 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -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;
>
> @@ -974,6 +993,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;
>

Regards,
diff mbox

Patch

diff --git a/docs/misc/arm/device-tree/acpi.txt b/docs/misc/arm/device-tree/acpi.txt
new file mode 100644
index 0000000..3e70157
--- /dev/null
+++ b/docs/misc/arm/device-tree/acpi.txt
@@ -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>;
+	};
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index b95fdf5..11a6f6e 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -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;
 
@@ -974,6 +993,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;