mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Revert "tools/dombuilder: Fix asymmetry when setting up console and xenstore rings"
This reverts commit 87b0ae7e82.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
e07ebab865
commit
cc2dc90434
8 files changed
+24
-69
No files matched your search
@@ -20,8 +20,6 @@
|
||||
#include <xenguest.h>
|
||||
|
||||
#define INVALID_PFN ((xen_pfn_t)-1)
|
||||
#define INVALID_EVTCHN (~0u)
|
||||
#define INVALID_DOMID (~0)
|
||||
#define X86_HVM_NR_SPECIAL_PAGES 8
|
||||
#define X86_HVM_END_SPECIAL_REGION 0xff000u
|
||||
|
||||
@@ -106,16 +104,10 @@ struct xc_dom_image {
|
||||
* Details for the toolstack-prepared rings.
|
||||
*
|
||||
* *_gfn fields are allocated by the domain builder.
|
||||
* *_{evtchn,domid} fields must be provided by the caller.
|
||||
*/
|
||||
xen_pfn_t console_gfn;
|
||||
xen_pfn_t xenstore_gfn;
|
||||
|
||||
unsigned int console_evtchn;
|
||||
unsigned int xenstore_evtchn;
|
||||
uint32_t console_domid;
|
||||
uint32_t xenstore_domid;
|
||||
|
||||
/*
|
||||
* initrd parameters as specified in start_info page
|
||||
* Depending on capabilities of the booted kernel this may be a virtual
|
||||
@@ -173,6 +165,10 @@ struct xc_dom_image {
|
||||
|
||||
/* misc xen domain config stuff */
|
||||
unsigned long flags;
|
||||
unsigned int console_evtchn;
|
||||
unsigned int xenstore_evtchn;
|
||||
uint32_t console_domid;
|
||||
uint32_t xenstore_domid;
|
||||
xen_pfn_t shared_info_mfn;
|
||||
|
||||
xc_interface *xch;
|
||||
|
||||
@@ -99,7 +99,7 @@ static int alloc_magic_pages(struct xc_dom_image *dom)
|
||||
dom->xenstore_gfn);
|
||||
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_MONITOR_RING_PFN,
|
||||
base + MEMACCESS_PFN_OFFSET);
|
||||
|
||||
/* allocated by toolstack */
|
||||
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN,
|
||||
dom->console_evtchn);
|
||||
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_EVTCHN,
|
||||
|
||||
@@ -163,42 +163,6 @@ void *xc_dom_boot_domU_map(struct xc_dom_image *dom, xen_pfn_t pfn,
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static int xc_dom_check_required_fields(struct xc_dom_image *dom)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if ( dom->console_evtchn == INVALID_EVTCHN )
|
||||
{
|
||||
xc_dom_panic(dom->xch, XC_INVALID_PARAM,
|
||||
"%s: Caller didn't set dom->console_evtchn", __func__);
|
||||
rc = -1;
|
||||
}
|
||||
if ( dom->console_domid == INVALID_DOMID )
|
||||
{
|
||||
xc_dom_panic(dom->xch, XC_INVALID_PARAM,
|
||||
"%s: Caller didn't set dom->console_domid", __func__);
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
if ( dom->xenstore_evtchn == INVALID_EVTCHN )
|
||||
{
|
||||
xc_dom_panic(dom->xch, XC_INVALID_PARAM,
|
||||
"%s: Caller didn't set dom->xenstore_evtchn", __func__);
|
||||
rc = -1;
|
||||
}
|
||||
if ( dom->xenstore_domid == INVALID_DOMID )
|
||||
{
|
||||
xc_dom_panic(dom->xch, XC_INVALID_PARAM,
|
||||
"%s: Caller didn't set dom->xenstore_domid", __func__);
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
if ( rc )
|
||||
errno = EINVAL;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int xc_dom_boot_image(struct xc_dom_image *dom)
|
||||
{
|
||||
xc_dominfo_t info;
|
||||
@@ -206,9 +170,6 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
|
||||
|
||||
DOMPRINTF_CALLED(dom->xch);
|
||||
|
||||
if ( (rc = xc_dom_check_required_fields(dom)) != 0 )
|
||||
return rc;
|
||||
|
||||
/* misc stuff*/
|
||||
if ( (rc = dom->arch_hooks->bootearly(dom)) != 0 )
|
||||
return rc;
|
||||
|
||||
@@ -61,9 +61,7 @@ int xc_linux_build(xc_interface *xch, uint32_t domid,
|
||||
|
||||
dom->flags |= flags;
|
||||
dom->console_evtchn = console_evtchn;
|
||||
dom->console_domid = 0;
|
||||
dom->xenstore_evtchn = store_evtchn;
|
||||
dom->xenstore_domid = 0;
|
||||
|
||||
if ( (rc = xc_dom_boot_xen_init(dom, xch, domid)) != 0 )
|
||||
goto out;
|
||||
|
||||
@@ -779,11 +779,6 @@ struct xc_dom_image *xc_dom_allocate(xc_interface *xch,
|
||||
dom->parms.elf_paddr_offset = UNSET_ADDR;
|
||||
dom->parms.p2m_base = UNSET_ADDR;
|
||||
|
||||
dom->console_evtchn = INVALID_EVTCHN;
|
||||
dom->xenstore_evtchn = INVALID_EVTCHN;
|
||||
dom->console_domid = INVALID_DOMID;
|
||||
dom->xenstore_domid = INVALID_DOMID;
|
||||
|
||||
dom->flags = SIF_VIRT_P2M_4TOOLS;
|
||||
|
||||
dom->alloc_malloc += sizeof(*dom);
|
||||
|
||||
@@ -617,8 +617,6 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
|
||||
dom->xenstore_gfn = special_pfn(SPECIALPAGE_XENSTORE);
|
||||
xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_gfn);
|
||||
xc_hvm_param_set(xch, domid, HVM_PARAM_STORE_PFN, dom->xenstore_gfn);
|
||||
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_EVTCHN,
|
||||
dom->xenstore_evtchn);
|
||||
|
||||
xc_hvm_param_set(xch, domid, HVM_PARAM_BUFIOREQ_PFN,
|
||||
special_pfn(SPECIALPAGE_BUFIOREQ));
|
||||
@@ -628,8 +626,6 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
|
||||
dom->console_gfn = special_pfn(SPECIALPAGE_CONSOLE);
|
||||
xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_gfn);
|
||||
xc_hvm_param_set(xch, domid, HVM_PARAM_CONSOLE_PFN, dom->console_gfn);
|
||||
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN,
|
||||
dom->console_evtchn);
|
||||
|
||||
xc_hvm_param_set(xch, domid, HVM_PARAM_PAGING_RING_PFN,
|
||||
special_pfn(SPECIALPAGE_PAGING));
|
||||
|
||||
+18
-10
@@ -862,10 +862,14 @@ out:
|
||||
}
|
||||
|
||||
static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
|
||||
libxl_domain_build_info *info)
|
||||
libxl_domain_build_info *info,
|
||||
int store_evtchn, unsigned long *store_mfn,
|
||||
int console_evtchn, unsigned long *console_mfn,
|
||||
domid_t store_domid, domid_t console_domid)
|
||||
{
|
||||
struct hvm_info_table *va_hvm;
|
||||
uint8_t *va_map, sum;
|
||||
uint64_t str_mfn, cons_mfn;
|
||||
int i;
|
||||
|
||||
if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
|
||||
@@ -886,6 +890,15 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
|
||||
munmap(va_map, XC_PAGE_SIZE);
|
||||
}
|
||||
|
||||
xc_hvm_param_get(handle, domid, HVM_PARAM_STORE_PFN, &str_mfn);
|
||||
xc_hvm_param_get(handle, domid, HVM_PARAM_CONSOLE_PFN, &cons_mfn);
|
||||
xc_hvm_param_set(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
|
||||
xc_hvm_param_set(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn);
|
||||
|
||||
*store_mfn = str_mfn;
|
||||
*console_mfn = cons_mfn;
|
||||
|
||||
xc_dom_gnttab_hvm_seed(handle, domid, *console_mfn, *store_mfn, console_domid, store_domid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1146,11 +1159,6 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
|
||||
|
||||
dom->container_type = XC_DOM_HVM_CONTAINER;
|
||||
|
||||
dom->console_evtchn = state->console_port;
|
||||
dom->console_domid = state->console_domid;
|
||||
dom->xenstore_evtchn = state->store_port;
|
||||
dom->xenstore_domid = state->store_domid;
|
||||
|
||||
/* The params from the configuration file are in Mb, which are then
|
||||
* multiplied by 1 Kb. This was then divided off when calling
|
||||
* the old xc_hvm_build_target_mem() which then turned them to bytes.
|
||||
@@ -1255,7 +1263,10 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = hvm_build_set_params(ctx->xch, domid, info);
|
||||
rc = hvm_build_set_params(ctx->xch, domid, info, state->store_port,
|
||||
&state->store_mfn, state->console_port,
|
||||
&state->console_mfn, state->store_domid,
|
||||
state->console_domid);
|
||||
if (rc != 0) {
|
||||
LOG(ERROR, "hvm build set params failed");
|
||||
goto out;
|
||||
@@ -1267,9 +1278,6 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
|
||||
goto out;
|
||||
}
|
||||
|
||||
state->console_mfn = dom->console_gfn;
|
||||
state->store_mfn = dom->xenstore_gfn;
|
||||
|
||||
xc_dom_release(dom);
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
#define STUBDOM_SPECIAL_CONSOLES 3
|
||||
#define TAP_DEVICE_SUFFIX "-emu"
|
||||
#define DOMID_XS_PATH "domid"
|
||||
#define INVALID_DOMID ~0
|
||||
|
||||
/* Size macros. */
|
||||
#define __AC(X,Y) (X##Y)
|
||||
|
||||