tools/dombuilder: Fix asymmetry when setting up console and xenstore rings
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 12 Oct 2017 19:19:08 +0000 (20:19 +0100)
committerWei Liu <wei.liu2@citrix.com>
Thu, 2 Nov 2017 17:07:23 +0000 (17:07 +0000)
commit87b0ae7e8277d2fa13486ce2e11a941e55f8df40
treecf892f1bc1a97eae7ad765565792417a8b4027c6
parentf48b5449dabc770acdde6d25cfbd265cfb71034d
tools/dombuilder: Fix asymmetry when setting up console and xenstore rings

libxl always uses xc_dom_gnttab_init(), which internally calls
xc_dom_gnttab{_hvm,}_seed() to set up the grants point at the console and
xenstore rings.  For HVM guests, libxl then asks Xen for the information set
up previously, and calls xc_dom_gnttab_hvm_seed() a second time, which is
wasteful.  ARM construction expects libxl to have set up
dom->{console,xenstore}_evtchn earlier, so only actually functions because of
this second call.

Rationalise everything and make it consistent for all guests.

 1) Users of the domain builder are expected to provide
    dom->{console,xenstore}_{evtchn,domid} unconditionally.  This is checked
    by setting invalid values in xc_dom_allocate(), and checking in
    xc_dom_boot_image().

 2) For x86 HVM and ARM guests, the event channels are given to Xen at the
    same time as the ring gfns.  ARM already did this, but x86 is updated to
    match.  x86 PV already provides this information in the start_info page.

 3) Libxl is updated to drop all relevant functionality from
    hvm_build_set_params(), and behave consistently with PV guests when it
    comes to the handling of dom->{console,xenstore}_{evtchn,domid,gfn}.

This removes several redundant hypercalls (including a foreign mapping) from
the x86 HVM and ARM construction paths.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Julien Grall <julien.grall@arm.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
tools/libxc/include/xc_dom.h
tools/libxc/xc_dom_arm.c
tools/libxc/xc_dom_boot.c
tools/libxc/xc_dom_compat_linux.c
tools/libxc/xc_dom_core.c
tools/libxc/xc_dom_x86.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h