xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH v4 3/6] libxc: allow HVM guest to have modules
Date: Mon, 16 Jul 2018 15:02:52 +0100	[thread overview]
Message-ID: <20180716140255.13648-4-wei.liu2@citrix.com> (raw)
In-Reply-To: <20180716140255.13648-1-wei.liu2@citrix.com>

Lift the loading code out of PVH specific branch. Take the chance to
make the debug message more useful.

Now the code needs to handle virt_base being UNSET_ADDR, which it is
for HVM guest.  In case virt_base is not set, it should be treated as
zero.  In case PVH and PV, virt_base is set by the respective loader
by parsing the binary.

IPXE will be loaded as a module of Rombios.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxc/xc_dom_x86.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index d28ff4d7e9..d77f2d6f62 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -1742,20 +1742,6 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                                 ((uintptr_t)cmdline - (uintptr_t)start_info);
         }
 
-        for ( i = 0; i < dom->num_modules; i++ )
-        {
-            struct xc_hvm_firmware_module mod;
-
-            DOMPRINTF("Adding module %u", i);
-            mod.guest_addr_out =
-                dom->modules[i].seg.vstart - dom->parms.virt_base;
-            mod.length =
-                dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
-
-            add_module_to_list(dom, &mod, dom->modules[i].cmdline,
-                               modlist, start_info);
-        }
-
         /* ACPI module 0 is the RSDP */
         start_info->rsdp_paddr = dom->acpi_modules[0].guest_addr_out ? : 0;
     }
@@ -1765,6 +1751,24 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                            modlist, start_info);
     }
 
+    for ( i = 0; i < dom->num_modules; i++ )
+    {
+        struct xc_hvm_firmware_module mod;
+        uint64_t base = dom->parms.virt_base != UNSET_ADDR ?
+            dom->parms.virt_base : 0;
+
+        mod.guest_addr_out =
+            dom->modules[i].seg.vstart - base;
+        mod.length =
+            dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
+
+        DOMPRINTF("Adding module %u guest_addr %"PRIx64" len %u",
+                  i, mod.guest_addr_out, mod.length);
+
+        add_module_to_list(dom, &mod, dom->modules[i].cmdline,
+                           modlist, start_info);
+    }
+
     if ( start_info->nr_modules )
     {
         start_info->modlist_paddr = (dom->start_info_seg.pfn << PAGE_SHIFT) +
-- 
2.11.0


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

  parent reply	other threads:[~2018-07-16 14:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 14:02 [PATCH v4 0/6] Load ipxe from a standalone file Wei Liu
2018-07-16 14:02 ` [PATCH v4 1/6] Tools.mk.in: drop unused variables Wei Liu
2018-07-16 14:58   ` Ian Jackson
2018-07-16 14:02 ` [PATCH v4 2/6] ipxe: produce a single binary from its build Wei Liu
2018-07-16 14:02 ` Wei Liu [this message]
2018-07-16 14:58   ` [PATCH v4 3/6] libxc: allow HVM guest to have modules Ian Jackson
2018-07-16 14:02 ` [PATCH v4 4/6] tools: load IPXE from standalone file Wei Liu
2018-07-16 14:02 ` [PATCH v4 5/6] tools: provide --with-system-ipxe Wei Liu
2018-07-16 14:59   ` Ian Jackson
2018-07-16 14:02 ` [PATCH v4 6/6] tools: --with-system-{ovmf, seabios, ipxe} should provide absolute paths Wei Liu
2018-07-16 14:58   ` Ian Jackson

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=20180716140255.13648-4-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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).