From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 2/6] libxc: use xc_vcpu_setcontext() instead of calling do_domctl() Date: Fri, 12 Jul 2013 18:26:13 +0100 Message-ID: <51E03C35.8090807@citrix.com> References: <20130712163607.14010.39937.stgit@hit-nxdomain.opendns.com> <20130712164808.14010.10185.stgit@hit-nxdomain.opendns.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130712164808.14010.10185.stgit@hit-nxdomain.opendns.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dario Faggioli Cc: George Dunlap , Ian Jackson , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 12/07/13 17:48, Dario Faggioli wrote: > The wrapper is there already, so better use it in place of > all the stuff required to issue a call to do_domctl() for > XEN_DOMCTL_setvcpucontext. > > Signed-off-by: Dario Faggioli > Cc: Ian Jackson > Cc: Ian Campbell > Cc: George Dunlap Reviewed-by: Andrew Cooper > --- > tools/libxc/xc_dom_boot.c | 14 ++++---------- > tools/libxc/xc_domain_restore.c | 6 +----- > 2 files changed, 5 insertions(+), 15 deletions(-) > > diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c > index d4d57b4..cf509fa 100644 > --- a/tools/libxc/xc_dom_boot.c > +++ b/tools/libxc/xc_dom_boot.c > @@ -62,19 +62,13 @@ static int setup_hypercall_page(struct xc_dom_image *dom) > return rc; > } > > -static int launch_vm(xc_interface *xch, domid_t domid, xc_hypercall_buffer_t *ctxt) > +static int launch_vm(xc_interface *xch, domid_t domid, > + vcpu_guest_context_any_t *ctxt) > { > - DECLARE_DOMCTL; > - DECLARE_HYPERCALL_BUFFER_ARGUMENT(ctxt); > int rc; > > xc_dom_printf(xch, "%s: called, ctxt=%p", __FUNCTION__, ctxt); > - memset(&domctl, 0, sizeof(domctl)); > - domctl.cmd = XEN_DOMCTL_setvcpucontext; > - domctl.domain = domid; > - domctl.u.vcpucontext.vcpu = 0; > - set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt); > - rc = do_domctl(xch, &domctl); > + rc = xc_vcpu_setcontext(xch, domid, 0, ctxt); > if ( rc != 0 ) > xc_dom_panic(xch, XC_INTERNAL_ERROR, > "%s: SETVCPUCONTEXT failed (rc=%d)", __FUNCTION__, rc); > @@ -270,7 +264,7 @@ int xc_dom_boot_image(struct xc_dom_image *dom) > if ( (rc = dom->arch_hooks->vcpu(dom, ctxt)) != 0 ) > return rc; > xc_dom_unmap_all(dom); > - rc = launch_vm(dom->xch, dom->guest_domid, HYPERCALL_BUFFER(ctxt)); > + rc = launch_vm(dom->xch, dom->guest_domid, ctxt); > > xc_hypercall_buffer_free(dom->xch, ctxt); > return rc; > diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c > index 63d36cd..41a63cb 100644 > --- a/tools/libxc/xc_domain_restore.c > +++ b/tools/libxc/xc_domain_restore.c > @@ -2113,11 +2113,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, > } > ctxt->x64.ctrlreg[1] = FOLD_CR3(ctx->p2m[pfn]); > } > - domctl.cmd = XEN_DOMCTL_setvcpucontext; > - domctl.domain = (domid_t)dom; > - domctl.u.vcpucontext.vcpu = i; > - set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt); > - frc = xc_domctl(xch, &domctl); > + frc = xc_vcpu_setcontext(xch, dom, i, ctxt); > if ( frc != 0 ) > { > PERROR("Couldn't build vcpu%d", i); > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel