[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 06/25 v7] xen/arm: vpl011: Add a new domctl API to initialize vpl011
On Mon, Aug 07, 2017 at 02:22:58PM +0530, Bhupinder Thakur wrote: > Add a new domctl API to initialize vpl011. It takes the GFN and console > backend domid as input and returns an event channel to be used for > sending and receiving events from Xen. > > Xen will communicate with xenconsole using GFN as the ring buffer and > the event channel to transmit and receive pl011 data on the guest domain's > behalf. > > Signed-off-by: Bhupinder Thakur <bhupinder.thakur@xxxxxxxxxx> > --- [...] > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > index 3bab4e8..899bbd4 100644 > --- a/tools/libxc/xc_domain.c > +++ b/tools/libxc/xc_domain.c > @@ -343,6 +343,31 @@ int xc_domain_get_guest_width(xc_interface *xch, > uint32_t domid, > return 0; > } > > +int xc_dom_vuart_init(xc_interface *xch, > + uint32_t type, > + domid_t domid, > + domid_t console_domid, > + xen_pfn_t gfn, > + evtchn_port_t *evtchn) > +{ > + DECLARE_DOMCTL; > + int rc = 0; > + > + domctl.cmd = XEN_DOMCTL_vuart_op; > + domctl.domain = (domid_t)domid; The cast is pointless. > + domctl.u.vuart_op.cmd = XEN_DOMCTL_VUART_OP_INIT; > + domctl.u.vuart_op.type = type; > + domctl.u.vuart_op.console_domid = console_domid; > + domctl.u.vuart_op.gfn = gfn; > + > + if ( (rc = do_domctl(xch, &domctl)) < 0 ) > + return rc; > + > + *evtchn = domctl.u.vuart_op.evtchn; > + > + return rc; > +} > + [...] > > +int libxl__arch_build_dom_finish(libxl__gc *gc, > + libxl_domain_build_info *info, > + struct xc_dom_image *dom, > + libxl__domain_build_state *state) > +{ > + int ret = 0; int rc = 0; > + > + if (info->arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) { > + ret = xc_dom_vuart_init(CTX->xch, > + XEN_DOMCTL_VUART_TYPE_VPL011, > + dom->guest_domid, > + dom->console_domid, > + dom->vuart_gfn, > + &state->vuart_port); > + if (ret < 0) rc = ERROR_FAIL; > + LOG(ERROR, "xc_dom_vuart_init failed\n"); > + } > + > + return ret; return rc; For reasons, see libxl/CODING_STYLE. > +} > + [...] > uint32_t domid, > diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c > index db6838d..c7f650e 100644 > --- a/xen/arch/arm/domctl.c > +++ b/xen/arch/arm/domctl.c > @@ -5,9 +5,11 @@ > */ > > #include <xen/errno.h> > +#include <xen/guest_access.h> > #include <xen/hypercall.h> > #include <xen/iocap.h> > #include <xen/lib.h> > +#include <xen/mm.h> > #include <xen/sched.h> > #include <xen/types.h> > #include <xsm/xsm.h> > @@ -119,6 +121,46 @@ long arch_do_domctl(struct xen_domctl *domctl, struct > domain *d, > d->disable_migrate = domctl->u.disable_migrate.disable; > return 0; > > + case XEN_DOMCTL_vuart_op: > + { > + int rc; > + struct xen_domctl_vuart_op *vuart_op = &domctl->u.vuart_op; > + > + switch(vuart_op->cmd) Coding style. > + { > + case XEN_DOMCTL_VUART_OP_INIT: > + > + if ( !d->creation_finished ) > + { > + if (vuart_op->type == XEN_DOMCTL_VUART_TYPE_VPL011) > + { > + struct vpl011_init_info info; > + > + info.console_domid = vuart_op->console_domid; > + info.gfn = _gfn(vuart_op->gfn); > + > + rc = domain_vpl011_init(d, &info); > + if ( !rc ) > + { > + vuart_op->evtchn = info.evtchn; > + rc = __copy_to_guest(u_domctl, domctl, 1); > + } > + } > + else > + rc = -EINVAL; Indentation. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |