[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/dombuilder: Switch to using gfn terminology for console and xenstore rings
commit f48b5449dabc770acdde6d25cfbd265cfb71034d Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Thu Oct 12 20:19:07 2017 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Thu Nov 2 17:07:11 2017 +0000 tools/dombuilder: Switch to using gfn terminology for console and xenstore rings The sole use of xc_dom_translated() and xc_dom_p2m() outside of the domain builder is for libxl_dom() to translate the console and xenstore pfns back into useful values. PV guest pfns are only interesting to the domain builder, and gfns are the address space used by all other hypercalls. Renaming the fields in xc_dom_image is deliberate, as it will cause out-of-tree users of the dombuilder to notice the different semantics. Correct the terminology throughout xc_dom_gnttab{_hvm,}_seed(), which are all using gfns despite the existing variable names. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Tested-by: Julien Grall <julien.grall@xxxxxxx> Release-acked-by: Julien Grall <julien.grall@xxxxxxxxxx> [ wei: fix stubdom build ] Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- stubdom/grub/kexec.c | 4 ++-- tools/libxc/include/xc_dom.h | 10 +++++++-- tools/libxc/xc_dom_arm.c | 12 +++++------ tools/libxc/xc_dom_boot.c | 45 ++++++++++++++++++--------------------- tools/libxc/xc_dom_compat_linux.c | 4 ++-- tools/libxc/xc_dom_x86.c | 45 ++++++++++++++++++++------------------- tools/libxl/libxl_dom.c | 11 +++------- 7 files changed, 65 insertions(+), 66 deletions(-) diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c index 437a0a9..e744561 100644 --- a/stubdom/grub/kexec.c +++ b/stubdom/grub/kexec.c @@ -312,8 +312,8 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char } /* Move current console, xenstore and boot MFNs to the allocated place */ - do_exchange(dom, dom->console_pfn, start_info.console.domU.mfn); - do_exchange(dom, dom->xenstore_pfn, start_info.store_mfn); + do_exchange(dom, dom->console_gfn, start_info.console.domU.mfn); + do_exchange(dom, dom->xenstore_gfn, start_info.store_mfn); DEBUG("virt base at %llx\n", dom->parms.virt_base); DEBUG("bootstack_pfn %lx\n", dom->bootstack_pfn); _boot_target = dom->parms.virt_base + PFN_PHYS(dom->bootstack_pfn); diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index cdcdd07..5907559 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -94,8 +94,6 @@ struct xc_dom_image { struct xc_dom_seg devicetree_seg; struct xc_dom_seg start_info_seg; /* HVMlite only */ xen_pfn_t start_info_pfn; - xen_pfn_t console_pfn; - xen_pfn_t xenstore_pfn; xen_pfn_t shared_info_pfn; xen_pfn_t bootstack_pfn; xen_pfn_t pfn_alloc_end; @@ -103,6 +101,14 @@ struct xc_dom_image { xen_vaddr_t bsd_symtab_start; /* + * Details for the toolstack-prepared rings. + * + * *_gfn fields are allocated by the domain builder. + */ + xen_pfn_t console_gfn; + xen_pfn_t xenstore_gfn; + + /* * initrd parameters as specified in start_info page * Depending on capabilities of the booted kernel this may be a virtual * address or a pfn. Type is neutral and large enough to hold a virtual diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index fce151d..2fe75cd 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -84,19 +84,19 @@ static int alloc_magic_pages(struct xc_dom_image *dom) if ( rc < 0 ) return rc; - dom->console_pfn = base + CONSOLE_PFN_OFFSET; - dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET; + dom->console_gfn = base + CONSOLE_PFN_OFFSET; + dom->xenstore_gfn = base + XENSTORE_PFN_OFFSET; dom->vuart_gfn = base + VUART_PFN_OFFSET; - xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); - xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_gfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_gfn); xc_clear_domain_page(dom->xch, dom->guest_domid, base + MEMACCESS_PFN_OFFSET); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->vuart_gfn); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, - dom->console_pfn); + dom->console_gfn); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN, - dom->xenstore_pfn); + dom->xenstore_gfn); xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_MONITOR_RING_PFN, base + MEMACCESS_PFN_OFFSET); /* allocated by toolstack */ diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index 2e5681d..bbf98b6 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -257,24 +257,23 @@ static xen_pfn_t xc_dom_gnttab_setup(xc_interface *xch, uint32_t domid) } int xc_dom_gnttab_seed(xc_interface *xch, uint32_t domid, - xen_pfn_t console_gmfn, - xen_pfn_t xenstore_gmfn, + xen_pfn_t console_gfn, + xen_pfn_t xenstore_gfn, uint32_t console_domid, uint32_t xenstore_domid) { - - xen_pfn_t gnttab_gmfn; + xen_pfn_t gnttab_gfn; grant_entry_v1_t *gnttab; - gnttab_gmfn = xc_dom_gnttab_setup(xch, domid); - if ( gnttab_gmfn == -1 ) + gnttab_gfn = xc_dom_gnttab_setup(xch, domid); + if ( gnttab_gfn == -1 ) return -1; gnttab = xc_map_foreign_range(xch, domid, PAGE_SIZE, PROT_READ|PROT_WRITE, - gnttab_gmfn); + gnttab_gfn); if ( gnttab == NULL ) { xc_dom_panic(xch, XC_INTERNAL_ERROR, @@ -284,17 +283,17 @@ int xc_dom_gnttab_seed(xc_interface *xch, uint32_t domid, return -1; } - if ( domid != console_domid && console_gmfn != -1) + if ( domid != console_domid && console_gfn != -1 ) { gnttab[GNTTAB_RESERVED_CONSOLE].flags = GTF_permit_access; gnttab[GNTTAB_RESERVED_CONSOLE].domid = console_domid; - gnttab[GNTTAB_RESERVED_CONSOLE].frame = console_gmfn; + gnttab[GNTTAB_RESERVED_CONSOLE].frame = console_gfn; } - if ( domid != xenstore_domid && xenstore_gmfn != -1) + if ( domid != xenstore_domid && xenstore_gfn != -1 ) { gnttab[GNTTAB_RESERVED_XENSTORE].flags = GTF_permit_access; gnttab[GNTTAB_RESERVED_XENSTORE].domid = xenstore_domid; - gnttab[GNTTAB_RESERVED_XENSTORE].frame = xenstore_gmfn; + gnttab[GNTTAB_RESERVED_XENSTORE].frame = xenstore_gfn; } if ( munmap(gnttab, PAGE_SIZE) == -1 ) @@ -308,19 +307,19 @@ int xc_dom_gnttab_seed(xc_interface *xch, uint32_t domid, /* Guest shouldn't really touch its grant table until it has * enabled its caches. But lets be nice. */ - xc_domain_cacheflush(xch, domid, gnttab_gmfn, 1); + xc_domain_cacheflush(xch, domid, gnttab_gfn, 1); return 0; } int xc_dom_gnttab_hvm_seed(xc_interface *xch, uint32_t domid, - xen_pfn_t console_gpfn, - xen_pfn_t xenstore_gpfn, + xen_pfn_t console_gfn, + xen_pfn_t xenstore_gfn, uint32_t console_domid, uint32_t xenstore_domid) { int rc; - xen_pfn_t scratch_gpfn; + xen_pfn_t scratch_gfn; struct xen_add_to_physmap xatp = { .domid = domid, .space = XENMAPSPACE_grant_table, @@ -330,7 +329,7 @@ int xc_dom_gnttab_hvm_seed(xc_interface *xch, uint32_t domid, .domid = domid, }; - rc = xc_core_arch_get_scratch_gpfn(xch, domid, &scratch_gpfn); + rc = xc_core_arch_get_scratch_gpfn(xch, domid, &scratch_gfn); if ( rc < 0 ) { xc_dom_panic(xch, XC_INTERNAL_ERROR, @@ -339,11 +338,10 @@ int xc_dom_gnttab_hvm_seed(xc_interface *xch, uint32_t domid, __FUNCTION__, errno); return -1; } - xatp.gpfn = scratch_gpfn; - xrfp.gpfn = scratch_gpfn; + xatp.gpfn = xrfp.gpfn = scratch_gfn; - xc_dom_printf(xch, "%s: called, pfn=0x%"PRI_xen_pfn, __FUNCTION__, - scratch_gpfn); + xc_dom_printf(xch, "%s: called, scratch gfn=0x%"PRI_xen_pfn, __FUNCTION__, + scratch_gfn); rc = do_memory_op(xch, XENMEM_add_to_physmap, &xatp, sizeof(xatp)); @@ -357,7 +355,7 @@ int xc_dom_gnttab_hvm_seed(xc_interface *xch, uint32_t domid, } rc = xc_dom_gnttab_seed(xch, domid, - console_gpfn, xenstore_gpfn, + console_gfn, xenstore_gfn, console_domid, xenstore_domid); if (rc != 0) { @@ -385,12 +383,11 @@ int xc_dom_gnttab_init(struct xc_dom_image *dom) { if ( xc_dom_translated(dom) ) { return xc_dom_gnttab_hvm_seed(dom->xch, dom->guest_domid, - dom->console_pfn, dom->xenstore_pfn, + dom->console_gfn, dom->xenstore_gfn, dom->console_domid, dom->xenstore_domid); } else { return xc_dom_gnttab_seed(dom->xch, dom->guest_domid, - xc_dom_p2m(dom, dom->console_pfn), - xc_dom_p2m(dom, dom->xenstore_pfn), + dom->console_gfn, dom->xenstore_gfn, dom->console_domid, dom->xenstore_domid); } } diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c index c922c61..6d27ec2 100644 --- a/tools/libxc/xc_dom_compat_linux.c +++ b/tools/libxc/xc_dom_compat_linux.c @@ -78,8 +78,8 @@ int xc_linux_build(xc_interface *xch, uint32_t domid, if ( (rc = xc_dom_gnttab_init(dom)) != 0) goto out; - *console_mfn = xc_dom_p2m(dom, dom->console_pfn); - *store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); + *console_mfn = dom->console_gfn; + *store_mfn = dom->xenstore_gfn; out: xc_dom_release(dom); diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index bff68a0..c74fb96 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -536,21 +536,23 @@ static int alloc_p2m_list_x86_64(struct xc_dom_image *dom) static int alloc_magic_pages_pv(struct xc_dom_image *dom) { + xen_pfn_t pfn; + dom->start_info_pfn = xc_dom_alloc_page(dom, "start info"); if ( dom->start_info_pfn == INVALID_PFN ) return -1; - dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore"); - if ( dom->xenstore_pfn == INVALID_PFN ) + pfn = xc_dom_alloc_page(dom, "xenstore"); + if ( pfn == INVALID_PFN ) return -1; - xc_clear_domain_page(dom->xch, dom->guest_domid, - xc_dom_p2m(dom, dom->xenstore_pfn)); + dom->xenstore_gfn = xc_dom_p2m(dom, pfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_gfn); - dom->console_pfn = xc_dom_alloc_page(dom, "console"); - if ( dom->console_pfn == INVALID_PFN ) + pfn = xc_dom_alloc_page(dom, "console"); + if ( pfn == INVALID_PFN ) return -1; - xc_clear_domain_page(dom->xch, dom->guest_domid, - xc_dom_p2m(dom, dom->console_pfn)); + dom->console_gfn = xc_dom_p2m(dom, pfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_gfn); dom->alloc_bootstack = 1; @@ -612,14 +614,19 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom) X86_HVM_NR_SPECIAL_PAGES) ) goto error_out; - xc_hvm_param_set(xch, domid, HVM_PARAM_STORE_PFN, - special_pfn(SPECIALPAGE_XENSTORE)); + 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(xch, domid, HVM_PARAM_BUFIOREQ_PFN, special_pfn(SPECIALPAGE_BUFIOREQ)); xc_hvm_param_set(xch, domid, HVM_PARAM_IOREQ_PFN, special_pfn(SPECIALPAGE_IOREQ)); - xc_hvm_param_set(xch, domid, HVM_PARAM_CONSOLE_PFN, - special_pfn(SPECIALPAGE_CONSOLE)); + + 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(xch, domid, HVM_PARAM_PAGING_RING_PFN, special_pfn(SPECIALPAGE_PAGING)); xc_hvm_param_set(xch, domid, HVM_PARAM_MONITOR_RING_PFN, @@ -699,12 +706,6 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom) xc_hvm_param_set(xch, domid, HVM_PARAM_IDENT_PT, special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT); - dom->console_pfn = special_pfn(SPECIALPAGE_CONSOLE); - xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); - - dom->xenstore_pfn = special_pfn(SPECIALPAGE_XENSTORE); - xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); - dom->parms.virt_hypercall = -1; rc = 0; @@ -744,9 +745,9 @@ static int start_info_x86_32(struct xc_dom_image *dom) start_info->mfn_list = dom->p2m_seg.vstart; start_info->flags = dom->flags; - start_info->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); + start_info->store_mfn = dom->xenstore_gfn; start_info->store_evtchn = dom->xenstore_evtchn; - start_info->console.domU.mfn = xc_dom_p2m(dom, dom->console_pfn); + start_info->console.domU.mfn = dom->console_gfn; start_info->console.domU.evtchn = dom->console_evtchn; if ( dom->ramdisk_blob ) @@ -795,9 +796,9 @@ static int start_info_x86_64(struct xc_dom_image *dom) } start_info->flags = dom->flags; - start_info->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); + start_info->store_mfn = dom->xenstore_gfn; start_info->store_evtchn = dom->xenstore_evtchn; - start_info->console.domU.mfn = xc_dom_p2m(dom, dom->console_pfn); + start_info->console.domU.mfn = dom->console_gfn; start_info->console.domU.evtchn = dom->console_evtchn; if ( dom->ramdisk_blob ) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index ef834e6..0389a06 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -851,14 +851,9 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, if (ret != 0) goto out; - if (xc_dom_translated(dom)) { - state->console_mfn = dom->console_pfn; - state->store_mfn = dom->xenstore_pfn; - state->vuart_gfn = dom->vuart_gfn; - } else { - state->console_mfn = xc_dom_p2m(dom, dom->console_pfn); - state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); - } + state->console_mfn = dom->console_gfn; + state->store_mfn = dom->xenstore_gfn; + state->vuart_gfn = dom->vuart_gfn; ret = 0; out: -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |