diff mbox

[v1,18/20] libxl/acpi: Add ACPI e820 entry

Message ID 1467745519-9868-19-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Ostrovsky July 5, 2016, 7:05 p.m. UTC
Add entry for ACPI tables created for PVHv2 guests to e820 map.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---

New patch

 tools/libxc/include/xc_dom.h |    4 ++++
 tools/libxl/libxl_dom.c      |    8 ++++----
 tools/libxl/libxl_x86.c      |   11 +++++++++++
 3 files changed, 19 insertions(+), 4 deletions(-)

Comments

Julien Grall July 6, 2016, 10 a.m. UTC | #1
(CC Stefano)

Hi Boris,

On 05/07/16 20:05, Boris Ostrovsky wrote:
> Add entry for ACPI tables created for PVHv2 guests to e820 map.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>
> New patch
>
>   tools/libxc/include/xc_dom.h |    4 ++++
>   tools/libxl/libxl_dom.c      |    8 ++++----
>   tools/libxl/libxl_x86.c      |   11 +++++++++++
>   3 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
> index 6cb10c4..ec2da14 100644
> --- a/tools/libxc/include/xc_dom.h
> +++ b/tools/libxc/include/xc_dom.h
> @@ -102,6 +102,10 @@ struct xc_dom_image {
>       xen_vaddr_t virt_alloc_end;
>       xen_vaddr_t bsd_symtab_start;
>
> +    /* ACPI tables (PVHv2 only) */
> +    xen_pfn_t acpi_pfn;
> +    xen_pfn_t acpi_pages;
> +

It would be good if we can share the fields with ARM (see [1]).

Regards,

[1] 
https://lists.xenproject.org/archives/html/xen-devel/2016-07/msg00301.html
Boris Ostrovsky July 6, 2016, 3:43 p.m. UTC | #2
On 07/06/2016 06:00 AM, Julien Grall wrote:
> (CC Stefano)
>
> Hi Boris,
>
> On 05/07/16 20:05, Boris Ostrovsky wrote:
>> Add entry for ACPI tables created for PVHv2 guests to e820 map.
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> ---
>>
>> New patch
>>
>>   tools/libxc/include/xc_dom.h |    4 ++++
>>   tools/libxl/libxl_dom.c      |    8 ++++----
>>   tools/libxl/libxl_x86.c      |   11 +++++++++++
>>   3 files changed, 19 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
>> index 6cb10c4..ec2da14 100644
>> --- a/tools/libxc/include/xc_dom.h
>> +++ b/tools/libxc/include/xc_dom.h
>> @@ -102,6 +102,10 @@ struct xc_dom_image {
>>       xen_vaddr_t virt_alloc_end;
>>       xen_vaddr_t bsd_symtab_start;
>>
>> +    /* ACPI tables (PVHv2 only) */
>> +    xen_pfn_t acpi_pfn;
>> +    xen_pfn_t acpi_pages;
>> +
>
> It would be good if we can share the fields with ARM (see [1]).


This is slightly different: acpi_pfn is address in guest physical space
(and is used for building guest's e820 map) and acpitable_blob is a
pointer to virtual address in the toolstack (or is it not?).

acpi_pages and acpitable_size could be used interchangeably though so
that could be shared.

-boris

>
> Regards,
>
> [1]
> https://lists.xenproject.org/archives/html/xen-devel/2016-07/msg00301.html
>
diff mbox

Patch

diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index 6cb10c4..ec2da14 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -102,6 +102,10 @@  struct xc_dom_image {
     xen_vaddr_t virt_alloc_end;
     xen_vaddr_t bsd_symtab_start;
 
+    /* ACPI tables (PVHv2 only) */
+    xen_pfn_t acpi_pfn;
+    xen_pfn_t acpi_pages;
+
     /*
      * initrd parameters as specified in start_info page
      * Depending on capabilities of the booted kernel this may be a virtual
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index ec29060..ccc41b4 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -1063,16 +1063,16 @@  int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
             dom->vnode_to_pnode[i] = info->vnuma_nodes[i].pnode;
     }
 
+    rc = libxl__build_dom(gc, domid, info, state, dom);
+    if (rc != 0)
+        goto out;
+
     rc = libxl__arch_domain_construct_memmap(gc, d_config, domid, dom);
     if (rc != 0) {
         LOG(ERROR, "setting domain memory map failed");
         goto out;
     }
 
-    rc = libxl__build_dom(gc, domid, info, state, dom);
-    if (rc != 0)
-        goto out;
-
     rc = hvm_build_set_params(ctx->xch, domid, info, state->store_port,
                                &state->store_mfn, state->console_port,
                                &state->console_mfn, state->store_domid,
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index 46cfafb..32ce1d2 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -503,6 +503,10 @@  int libxl__arch_domain_construct_memmap(libxl__gc *gc,
     if (highmem_size)
         e820_entries++;
 
+    /* PVHv2's ACPI tables */
+    if (dom->acpi_pages)
+        e820_entries++;
+
     if (e820_entries >= E820MAX) {
         LOG(ERROR, "Ooops! Too many entries in the memory map!");
         rc = ERROR_INVAL;
@@ -528,6 +532,13 @@  int libxl__arch_domain_construct_memmap(libxl__gc *gc,
         nr++;
     }
 
+    if (dom->acpi_pages) {
+        e820[nr].addr = dom->acpi_pfn << XC_DOM_PAGE_SHIFT(dom);
+        e820[nr].size = dom->acpi_pages << XC_DOM_PAGE_SHIFT(dom);
+        e820[nr].type = E820_ACPI;
+        nr++;
+    }
+
     /* High memory */
     if (highmem_size) {
         e820[nr].addr = ((uint64_t)1 << 32);