All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, ian.jackson@eu.citrix.com,
	peter.huangpeng@huawei.com, julien.grall@arm.com,
	shannon.zhao@linaro.org, wei.liu2@citrix.comg
Subject: [PATCH 14/14] libxc/xc_dom_core: Copy ACPI tables to guest memory space
Date: Tue, 31 May 2016 12:43:36 +0800	[thread overview]
Message-ID: <1464669816-11476-15-git-send-email-zhaoshenglong@huawei.com> (raw)
In-Reply-To: <1464669816-11476-1-git-send-email-zhaoshenglong@huawei.com>

From: Shannon Zhao <shannon.zhao@linaro.org>

Copy all the ACPI tables to guest memory space and also initialize the
address of the tables.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxc/xc_dom_core.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 55c779d..6d91a46 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -33,6 +33,7 @@
 
 #include "xg_private.h"
 #include "xc_dom.h"
+#include "acpi_defs.h"
 
 /* ------------------------------------------------------------------------ */
 /* debugging                                                                */
@@ -1096,6 +1097,64 @@ int xc_dom_build_image(struct xc_dom_image *dom)
         memcpy(devicetreemap, dom->devicetree_blob, dom->devicetree_size);
     }
 
+    /* load ACPI tables */
+    if ( dom->acpitable_blob )
+    {
+        void *acpitablemap;
+        uint64_t start = dom->acpi_seg.vstart;
+        struct acpi_xsdt_descriptor *xsdt;
+        struct acpi_rsdp_descriptor *rsdp;
+        struct acpi_fadt_descriptor *fadt;
+
+        if ( xc_dom_alloc_segment(dom, &dom->acpi_seg, "acpitable",
+                                  start, dom->acpitable_size) != 0 )
+            goto err;
+
+        acpitablemap = xc_dom_seg_to_ptr(dom, &dom->acpi_seg);
+        if ( acpitablemap == NULL )
+        {
+            DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &dom->acpi_seg) => NULL",
+                      __FUNCTION__);
+            goto err;
+        }
+
+        rsdp = (struct acpi_rsdp_descriptor *)acpitablemap;
+        memcpy(acpitablemap, dom->acpitable_blob->rsdp.table,
+               dom->acpitable_blob->rsdp.size);
+        start += dom->acpitable_blob->rsdp.size;
+        acpitablemap += dom->acpitable_blob->rsdp.size;
+
+        xsdt = (struct acpi_xsdt_descriptor *)acpitablemap;
+        memcpy(acpitablemap, dom->acpitable_blob->xsdt.table,
+               dom->acpitable_blob->xsdt.size);
+        rsdp->xsdt_physical_address = start;
+        start += dom->acpitable_blob->xsdt.size;
+        acpitablemap += dom->acpitable_blob->xsdt.size;
+
+        memcpy(acpitablemap, dom->acpitable_blob->madt.table,
+               dom->acpitable_blob->madt.size);
+        xsdt->entry[0] = start;
+        start += dom->acpitable_blob->madt.size;
+        acpitablemap += dom->acpitable_blob->madt.size;
+
+        memcpy(acpitablemap, dom->acpitable_blob->gtdt.table,
+               dom->acpitable_blob->gtdt.size);
+        xsdt->entry[1] = start;
+        start += dom->acpitable_blob->gtdt.size;
+        acpitablemap += dom->acpitable_blob->gtdt.size;
+
+        fadt = (struct acpi_fadt_descriptor *)acpitablemap;
+        memcpy(acpitablemap, dom->acpitable_blob->fadt.table,
+               dom->acpitable_blob->fadt.size);
+        xsdt->entry[2] = start;
+        start += dom->acpitable_blob->fadt.size;
+        acpitablemap += dom->acpitable_blob->fadt.size;
+
+        memcpy(acpitablemap, dom->acpitable_blob->dsdt.table,
+               dom->acpitable_blob->dsdt.size);
+        fadt->dsdt = start;
+    }
+
     /* allocate other pages */
     if ( !dom->arch_hooks->p2m_base_supported ||
          dom->parms.p2m_base >= dom->parms.virt_base ||
-- 
2.0.4



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

  parent reply	other threads:[~2016-05-31  4:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  4:43 [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
2016-05-31  4:43 ` [PATCH 01/14] libxl/arm: Fix the function name in error log Shannon Zhao
2016-05-31  4:43 ` [PATCH 02/14] libxl/arm: Factor out codes for generating DTB Shannon Zhao
2016-05-31  4:43 ` [PATCH 03/14] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
2016-05-31  4:43 ` [PATCH 04/14] tools: add ACPI tables relevant definitions Shannon Zhao
2016-05-31  4:43 ` [PATCH 05/14] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 06/14] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 07/14] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 08/14] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 09/14] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-05-31  4:43 ` [PATCH 10/14] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-05-31  4:43 ` [PATCH 11/14] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-05-31  4:43 ` [PATCH 12/14] libxl/arm: Add ACPI module Shannon Zhao
2016-05-31  4:43 ` [PATCH 13/14] libxl/arm: initialize memory information of ACPI blob Shannon Zhao
2016-05-31  4:43 ` Shannon Zhao [this message]
2016-05-31  4:56 ` [PATCH 00/14] Xen ARM DomU ACPI support Shannon Zhao
2016-05-31 19:42 ` Konrad Rzeszutek Wilk
2016-05-31 20:51   ` Boris Ostrovsky
2016-06-01 12:42     ` Julien Grall
2016-06-01 12:59       ` Boris Ostrovsky
2016-06-01 13:21         ` Julien Grall
2016-06-01 13:39           ` Boris Ostrovsky
2016-06-01 13:53           ` Shannon Zhao
2016-06-01 14:36             ` Boris Ostrovsky
2016-06-01 14:56               ` Shannon Zhao
2016-06-01 15:05                 ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464669816-11476-15-git-send-email-zhaoshenglong@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.comg \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.