xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Maran Wilson <maran.wilson@oracle.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, boris.ostrovsky@oracle.com,
	roger.pau@citrix.com, ian.jackson@eu.citrix.com,
	maran.wilson@oracle.com
Subject: [PATCH v4 2/4] libxl/x86: Build e820 map earlier for HVM/PVH guests
Date: Tue, 20 Mar 2018 09:50:50 -0700	[thread overview]
Message-ID: <1521564652-31992-1-git-send-email-maran.wilson@oracle.com> (raw)
In-Reply-To: <1521564536-31880-1-git-send-email-maran.wilson@oracle.com>

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Since hvm_start_info has now been expanded to include memory map (i.e.
e820) we need to know size of this map by the time we create
dom->start_info_seg in alloc_magic_pages_hvm().

To do so we have to call libxl__arch_domain_construct_memmap() earlier,
before xc_dom_build_image(). And since libxl__arch_domain_construct_memmap()
is only used by for x86 we can make this call from x86's
libxl__arch_domain_finalise_hw_description(), at the same time removing
its NOP definition from ARM code and renaming and making it static in
libxl_x86.c

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 tools/libxl/libxl_arch.h     |  9 ++------
 tools/libxl/libxl_arm.c      | 10 ++-------
 tools/libxl/libxl_create.c   |  2 +-
 tools/libxl/libxl_dom.c      | 16 ++++++---------
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_x86.c      | 49 +++++++++++++++++++++++++++-----------------
 6 files changed, 42 insertions(+), 45 deletions(-)

diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h
index 784ec7f..9be06fa 100644
--- a/tools/libxl/libxl_arch.h
+++ b/tools/libxl/libxl_arch.h
@@ -41,6 +41,8 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
 /* finalize arch specific hardware description. */
 _hidden
 int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
+                                      uint32_t domid,
+                                      libxl_domain_config *d_config,
                                       libxl_domain_build_info *info,
                                       struct xc_dom_image *dom);
 
@@ -62,13 +64,6 @@ int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc,
 _hidden
 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
-/* arch specific to construct memory mapping function */
-_hidden
-int libxl__arch_domain_construct_memmap(libxl__gc *gc,
-                                        libxl_domain_config *d_config,
-                                        uint32_t domid,
-                                        struct xc_dom_image *dom);
-
 _hidden
 void libxl__arch_domain_build_info_acpi_setdefault(
                                         libxl_domain_build_info *b_info);
diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 3e46554..13a8347 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -1046,6 +1046,8 @@ static void finalise_one_node(libxl__gc *gc, void *fdt, const char *uname,
 }
 
 int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
+                                               uint32_t domid,
+                                               libxl_domain_config *d_config,
                                                libxl_domain_build_info *info,
                                                struct xc_dom_image *dom)
 {
@@ -1140,14 +1142,6 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
     return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq);
 }
 
-int libxl__arch_domain_construct_memmap(libxl__gc *gc,
-                                        libxl_domain_config *d_config,
-                                        uint32_t domid,
-                                        struct xc_dom_image *dom)
-{
-    return 0;
-}
-
 void libxl__arch_domain_build_info_acpi_setdefault(
                                         libxl_domain_build_info *b_info)
 {
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index c498135..5dce3df 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -488,7 +488,7 @@ int libxl__domain_build(libxl__gc *gc,
 
         break;
     case LIBXL_DOMAIN_TYPE_PV:
-        ret = libxl__build_pv(gc, domid, info, state);
+        ret = libxl__build_pv(gc, domid, d_config, info, state);
         if (ret)
             goto out;
 
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 2e29b52..e83aeb9 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -698,6 +698,7 @@ static int set_vnuma_info(libxl__gc *gc, uint32_t domid,
 }
 
 static int libxl__build_dom(libxl__gc *gc, uint32_t domid,
+             libxl_domain_config *d_config,
              libxl_domain_build_info *info, libxl__domain_build_state *state,
              struct xc_dom_image *dom)
 {
@@ -733,7 +734,8 @@ static int libxl__build_dom(libxl__gc *gc, uint32_t domid,
         LOGE(ERROR, "xc_dom_boot_mem_init failed");
         goto out;
     }
-    if ( (ret = libxl__arch_domain_finalise_hw_description(gc, info, dom)) != 0 ) {
+    if ( (ret = libxl__arch_domain_finalise_hw_description(gc, domid, d_config,
+                                                           info, dom)) != 0 ) {
         LOGE(ERROR, "libxl__arch_domain_finalise_hw_description failed");
         goto out;
     }
@@ -758,7 +760,7 @@ out:
     return ret != 0 ? ERROR_FAIL : 0;
 }
 
-int libxl__build_pv(libxl__gc *gc, uint32_t domid,
+int libxl__build_pv(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config,
              libxl_domain_build_info *info, libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -847,7 +849,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
             dom->vnode_to_pnode[i] = info->vnuma_nodes[i].pnode;
     }
 
-    ret = libxl__build_dom(gc, domid, info, state, dom);
+    ret = libxl__build_dom(gc, domid, d_config, info, state, dom);
     if (ret != 0)
         goto out;
 
@@ -1293,16 +1295,10 @@ 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);
+    rc = libxl__build_dom(gc, domid, d_config, 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 = 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_internal.h b/tools/libxl/libxl_internal.h
index 506687f..914df23 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1159,6 +1159,7 @@ _hidden int libxl__build_post(libxl__gc *gc, uint32_t domid,
                char **vms_ents, char **local_ents);
 
 _hidden int libxl__build_pv(libxl__gc *gc, uint32_t domid,
+                            libxl_domain_config *const d_config,
              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl_domain_config *d_config,
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index d82013f..7cbbfd0 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -377,21 +377,6 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
     return 0;
 }
 
-int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
-                                               libxl_domain_build_info *info,
-                                               struct xc_dom_image *dom)
-{
-    int rc = 0;
-
-    if (info->type == LIBXL_DOMAIN_TYPE_PVH) {
-        rc = libxl__dom_load_acpi(gc, info, dom);
-        if (rc != 0)
-            LOGE(ERROR, "libxl_dom_load_acpi failed");
-    }
-
-    return rc;
-}
-
 int libxl__arch_build_dom_finish(libxl__gc *gc,
                                  libxl_domain_build_info *info,
                                  struct xc_dom_image *dom,
@@ -510,10 +495,10 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
  * to adjust them. Please refer to libxl__domain_device_construct_rdm().
  */
 #define GUEST_LOW_MEM_START_DEFAULT 0x100000
-int libxl__arch_domain_construct_memmap(libxl__gc *gc,
-                                        libxl_domain_config *d_config,
-                                        uint32_t domid,
-                                        struct xc_dom_image *dom)
+static int domain_construct_memmap(libxl__gc *gc,
+                                   libxl_domain_config *d_config,
+                                   uint32_t domid,
+                                   struct xc_dom_image *dom)
 {
     int rc = 0;
     unsigned int nr = 0, i;
@@ -601,6 +586,32 @@ out:
     return rc;
 }
 
+int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
+                                               uint32_t domid,
+                                               libxl_domain_config *d_config,
+                                               libxl_domain_build_info *info,
+                                               struct xc_dom_image *dom)
+{
+    int rc;
+
+    if (info->type == LIBXL_DOMAIN_TYPE_PV)
+        return 0;
+
+    if (info->type == LIBXL_DOMAIN_TYPE_PVH) {
+        rc = libxl__dom_load_acpi(gc, info, dom);
+        if (rc != 0) {
+            LOGE(ERROR, "libxl_dom_load_acpi failed");
+            return rc;
+        }
+    }
+
+    rc = domain_construct_memmap(gc, d_config, domid, dom);
+    if (rc != 0)
+        LOGE(ERROR, "setting domain memory map failed");
+
+    return rc;
+}
+
 void libxl__arch_domain_build_info_acpi_setdefault(
                                         libxl_domain_build_info *b_info)
 {
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-03-20 16:50 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 21:33 [PATCH v3 0/4] x86/PVHv2: Add memory map pointer to hvm_start_info struct Maran Wilson
2018-03-15 21:33 ` [PATCH v3 1/4] " Maran Wilson
2018-03-16 11:02   ` Jan Beulich
2018-03-16 11:11   ` Roger Pau Monné
2018-03-16 11:29     ` Jan Beulich
2018-03-16 11:37       ` Roger Pau Monné
2018-03-16 11:48         ` Jan Beulich
2018-03-16 11:58           ` Roger Pau Monné
2018-03-16 12:05           ` Juergen Gross
2018-03-16 12:25             ` Jan Beulich
2018-03-16 17:00     ` Maran Wilson
2018-03-16 17:59       ` Roger Pau Monné
2018-03-20 16:05       ` Konrad Rzeszutek Wilk
2018-03-15 21:35 ` [PATCH v3 2/4] libxl: Move libxl__arch_domain_construct_memmap() earlier Maran Wilson
2018-03-16 18:12   ` Roger Pau Monné
2018-03-16 18:34     ` Boris Ostrovsky
2018-03-15 21:35 ` [PATCH v3 3/4] libxl: Store PVH guest's e820 map in xc_dom_image Maran Wilson
2018-03-16 18:20   ` Roger Pau Monné
2018-03-16 18:44     ` Boris Ostrovsky
2018-03-15 21:35 ` [PATCH v3 4/4] libxc: Pass e820 map to PVH guest via hvm_start_info Maran Wilson
2018-03-16 18:29   ` Roger Pau Monné
2018-03-21 16:00     ` Wei Liu
2018-03-20 16:48 ` [PATCH v4 0/4] x86/PVHv2: Add memory map pointer to hvm_start_info struct Maran Wilson
2018-03-20 16:48   ` [PATCH v4 1/4] " Maran Wilson
2018-03-20 17:03     ` Jan Beulich
2018-03-21  9:28     ` Roger Pau Monné
2018-03-21  9:40       ` Juergen Gross
2018-03-21 16:46         ` Maran Wilson
2018-03-21 16:48           ` Juergen Gross
2018-03-21 16:58           ` Roger Pau Monné
2018-03-20 16:50   ` Maran Wilson [this message]
2018-03-21  9:37     ` [PATCH v4 2/4] libxl/x86: Build e820 map earlier for HVM/PVH guests Roger Pau Monné
2018-03-21 17:49     ` Wei Liu
2018-03-21 17:56       ` Boris Ostrovsky
2018-03-20 16:50   ` [PATCH v4 3/4] libxl: Store e820 map in xc_dom_image Maran Wilson
2018-03-21  9:42     ` Roger Pau Monné
2018-03-21 13:26       ` Boris Ostrovsky
2018-03-20 16:50   ` [PATCH v4 4/4] libxc: Pass e820 map to HVM/PVH guests via hvm_start_info Maran Wilson
2018-03-21 10:07     ` Roger Pau Monné
2018-03-21 13:37       ` Boris Ostrovsky
2018-03-21 14:18         ` Roger Pau Monné
2018-03-21 17:53           ` Boris Ostrovsky
2018-03-22  9:15             ` Roger Pau Monné
2018-03-28 11:05             ` Wei Liu

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=1521564652-31992-1-git-send-email-maran.wilson@oracle.com \
    --to=maran.wilson@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).