diff mbox

[v2,15/17] libxl/arm: Add ACPI module

Message ID 1466651824-6964-16-git-send-email-zhaoshenglong@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shannon Zhao June 23, 2016, 3:17 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 | 23 +++++++++++++++++++++++
 tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 docs/misc/arm/device-tree/acpi.txt

Comments

Julien Grall June 23, 2016, 6:35 p.m. UTC | #1
Hi Shannon,

On 23/06/2016 04:17, 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>
> ---
>  docs/misc/arm/device-tree/acpi.txt | 23 +++++++++++++++++++++++
>  tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
>  2 files changed, 47 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..c39c4d0
> --- /dev/null
> +++ b/docs/misc/arm/device-tree/acpi.txt
> @@ -0,0 +1,23 @@
> +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.

We need to clarify how the firmware can find the RSDP. I.e will it 
always be at the beginning of the region?

Also, do we really need the size of the region? Would not be simpler to 
give the base address of RSDP?

Regards,
Shannon Zhao June 25, 2016, 3:22 a.m. UTC | #2
On 2016/6/24 2:35, Julien Grall wrote:
> Hi Shannon,
> 
> On 23/06/2016 04:17, 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>
>> ---
>>  docs/misc/arm/device-tree/acpi.txt | 23 +++++++++++++++++++++++
>>  tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
>>  2 files changed, 47 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..c39c4d0
>> --- /dev/null
>> +++ b/docs/misc/arm/device-tree/acpi.txt
>> @@ -0,0 +1,23 @@
>> +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.
> 
> We need to clarify how the firmware can find the RSDP. I.e will it
> always be at the beginning of the region?
> 
> Also, do we really need the size of the region? Would not be simpler to
> give the base address of RSDP?

Maybe it needs for some other UEFI implementations which will directly
pass the ACPI tables information with a UEFI memory map to guest like
you said. So maybe it needs the size to construct the UEFI memory map.

Thanks,
Julien Grall June 27, 2016, 9:48 a.m. UTC | #3
Hi Shannon,

On 25/06/16 04:22, Shannon Zhao wrote:
>
>
> On 2016/6/24 2:35, Julien Grall wrote:
>> Hi Shannon,
>>
>> On 23/06/2016 04:17, 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>
>>> ---
>>>   docs/misc/arm/device-tree/acpi.txt | 23 +++++++++++++++++++++++
>>>   tools/libxl/libxl_arm.c            | 24 ++++++++++++++++++++++++
>>>   2 files changed, 47 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..c39c4d0
>>> --- /dev/null
>>> +++ b/docs/misc/arm/device-tree/acpi.txt
>>> @@ -0,0 +1,23 @@
>>> +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.
>>
>> We need to clarify how the firmware can find the RSDP. I.e will it
>> always be at the beginning of the region?
>>
>> Also, do we really need the size of the region? Would not be simpler to
>> give the base address of RSDP?
>
> Maybe it needs for some other UEFI implementations which will directly
> pass the ACPI tables information with a UEFI memory map to guest like
> you said. So maybe it needs the size to construct the UEFI memory map.

Good point.

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..c39c4d0
--- /dev/null
+++ b/docs/misc/arm/device-tree/acpi.txt
@@ -0,0 +1,23 @@ 
+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.
+
+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 97958ed..240a215 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -288,6 +288,25 @@  static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
         if (res) return res;
     }
 
+    if (state->config.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;
 
@@ -973,6 +992,11 @@  int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
         finalise_one_node(gc, fdt, "/memory", bankbase[i], size);
     }
 
+    if (dom->acpitable_blob) {
+        finalise_one_node(gc, fdt, "/chosen/module", GUEST_ACPI_BASE,
+                          dom->acpitable_size);
+    }
+
     debug_dump_fdt(gc, fdt);
 
     return 0;