mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxl/x86: Build e820 map earlier for HVM/PVH guests
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> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
7e4eaf428b
commit
f76d81d6e8
6 files changed
+43
-49
No files matched your search
@@ -41,7 +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,
|
||||
libxl_domain_build_info *info,
|
||||
uint32_t domid,
|
||||
libxl_domain_config *d_config,
|
||||
struct xc_dom_image *dom);
|
||||
|
||||
/* perform any pending hardware initialization */
|
||||
@@ -62,13 +63,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);
|
||||
|
||||
@@ -1039,7 +1039,8 @@ static void finalise_one_node(libxl__gc *gc, void *fdt, const char *uname,
|
||||
}
|
||||
|
||||
int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
|
||||
libxl_domain_build_info *info,
|
||||
uint32_t domid,
|
||||
libxl_domain_config *d_config,
|
||||
struct xc_dom_image *dom)
|
||||
{
|
||||
void *fdt = dom->devicetree_blob;
|
||||
@@ -1133,14 +1134,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)
|
||||
{
|
||||
|
||||
@@ -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, state);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
||||
+7
-11
@@ -698,9 +698,10 @@ static int set_vnuma_info(libxl__gc *gc, uint32_t domid,
|
||||
}
|
||||
|
||||
static int libxl__build_dom(libxl__gc *gc, uint32_t domid,
|
||||
libxl_domain_build_info *info, libxl__domain_build_state *state,
|
||||
libxl_domain_config *d_config, libxl__domain_build_state *state,
|
||||
struct xc_dom_image *dom)
|
||||
{
|
||||
libxl_domain_build_info *const info = &d_config->b_info;
|
||||
uint64_t mem_kb;
|
||||
int ret;
|
||||
|
||||
@@ -733,7 +734,7 @@ 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, dom)) != 0 ) {
|
||||
LOGE(ERROR, "libxl__arch_domain_finalise_hw_description failed");
|
||||
goto out;
|
||||
}
|
||||
@@ -759,9 +760,10 @@ out:
|
||||
}
|
||||
|
||||
int libxl__build_pv(libxl__gc *gc, uint32_t domid,
|
||||
libxl_domain_build_info *info, libxl__domain_build_state *state)
|
||||
libxl_domain_config *d_config, libxl__domain_build_state *state)
|
||||
{
|
||||
libxl_ctx *ctx = libxl__gc_owner(gc);
|
||||
libxl_domain_build_info *const info = &d_config->b_info;
|
||||
struct xc_dom_image *dom;
|
||||
int ret;
|
||||
int flags = 0;
|
||||
@@ -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, 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, 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,
|
||||
|
||||
@@ -1159,7 +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_build_info *info, libxl__domain_build_state *state);
|
||||
libxl_domain_config *const d_config, libxl__domain_build_state *state);
|
||||
_hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
|
||||
libxl_domain_config *d_config,
|
||||
libxl__domain_build_state *state);
|
||||
|
||||
+30
-19
@@ -373,21 +373,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,
|
||||
@@ -506,10 +491,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;
|
||||
@@ -597,6 +582,32 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
|
||||
uint32_t domid,
|
||||
libxl_domain_config *d_config,
|
||||
struct xc_dom_image *dom)
|
||||
{
|
||||
libxl_domain_build_info *const info = &d_config->b_info;
|
||||
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)
|
||||
{
|
||||
|
||||