All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2/6] libxc: use xc_vcpu_setcontext() instead of calling do_domctl()
Date: Fri, 12 Jul 2013 18:48:08 +0200	[thread overview]
Message-ID: <20130712164808.14010.10185.stgit@hit-nxdomain.opendns.com> (raw)
In-Reply-To: <20130712163607.14010.39937.stgit@hit-nxdomain.opendns.com>

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 <dario.faggioli@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
---
 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);

  parent reply	other threads:[~2013-07-12 16:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 16:47 [PATCH 0/6] xen-mfndump and some libxc cleanups Dario Faggioli
2013-07-12 16:48 ` [PATCH 1/6] libxc: introduce xc_domain_get_address_size Dario Faggioli
2013-07-12 17:23   ` Andrew Cooper
2013-07-12 17:30   ` Wei Liu
2013-07-12 16:48 ` Dario Faggioli [this message]
2013-07-12 17:26   ` [PATCH 2/6] libxc: use xc_vcpu_setcontext() instead of calling do_domctl() Andrew Cooper
2013-07-12 16:48 ` [PATCH 3/6] libxc: use xc_vcpu_getinfo() " Dario Faggioli
2013-07-12 17:35   ` Andrew Cooper
2013-07-12 16:48 ` [PATCH 4/6] libxc: allow for ctxt to be NULL in xc_vcpu_setcontext Dario Faggioli
2013-07-12 17:38   ` Andrew Cooper
2013-07-12 16:48 ` [PATCH 5/6] libxc: introduce xc_map_domain_meminfo (and xc_unmap_domain_meminfo) Dario Faggioli
2013-07-12 16:48 ` [PATCH 6/6] tools/misc: introduce xen-mfndump Dario Faggioli
2013-07-12 16:57 ` [PATCH 0/6] xen-mfndump and some libxc cleanups Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130712164808.14010.10185.stgit@hit-nxdomain.opendns.com \
    --to=dario.faggioli@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.