xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCHv1 2/5] tools/libxc: add xc_domain_get_param() and xc_domain_set_param()
Date: Thu, 18 Feb 2016 18:52:07 +0000	[thread overview]
Message-ID: <1455821530-4263-3-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1455821530-4263-1-git-send-email-david.vrabel@citrix.com>

These are a thin wrapper around the XEN_DOMCTL_param hypercall.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
 tools/libxc/include/xenctrl.h |  5 +++++
 tools/libxc/xc_domain.c       | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 42eafa4..862c748 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -812,6 +812,11 @@ int xc_domain_hvm_setcontext(xc_interface *xch,
 const char *xc_domain_get_native_protocol(xc_interface *xch,
                                           uint32_t domid);
 
+int xc_domain_get_param(xc_interface *xch, unsigned int domid,
+                        uint32_t param, uint64_t *value);
+int xc_domain_set_param(xc_interface *xch, unsigned int domid,
+                        uint32_t param, uint64_t value, uint64_t *old_value);
+
 /**
  * This function returns information about the execution context of a
  * particular vcpu of a domain.
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 4fa993a..4caa250 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -2574,6 +2574,41 @@ int xc_domain_soft_reset(xc_interface *xch,
     domctl.domain = (domid_t)domid;
     return do_domctl(xch, &domctl);
 }
+
+static int xc_domain_param(xc_interface *xch, unsigned int domid,
+                           uint32_t param, int set, uint64_t *value)
+{
+    int ret;
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_param;
+    domctl.domain = domid;
+    domctl.u.param.param = param | (set ? XEN_DOMCTL_PARAM_SET : 0);
+    domctl.u.param.value = *value;
+
+    ret = do_domctl(xch, &domctl);
+    if ( ret == 0 )
+        *value = domctl.u.param.value;
+    return ret;
+}
+
+int xc_domain_get_param(xc_interface *xch, unsigned int domid,
+                        uint32_t param, uint64_t *value)
+{
+    return xc_domain_param(xch, domid, param, 0, value);
+}
+
+int xc_domain_set_param(xc_interface *xch, unsigned int domid,
+                        uint32_t param, uint64_t value, uint64_t *old_value)
+{
+    int ret;
+
+    ret = xc_domain_param(xch, domid, param, 1, &value);
+    if ( ret == 0 && old_value )
+        *old_value = value;
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
-- 
2.1.4

  parent reply	other threads:[~2016-02-18 18:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 18:52 [RFC PATCH 0/5] x86: workaround inability to fully restore FPU state David Vrabel
2016-02-18 18:52 ` [PATCHv1 1/5] domctl: Add op to get/set generic numeric parameters David Vrabel
2016-02-18 19:02   ` Andrew Cooper
2016-02-19 13:59   ` Jan Beulich
2016-02-18 18:52 ` David Vrabel [this message]
2016-02-18 19:03   ` [PATCHv1 2/5] tools/libxc: add xc_domain_get_param() and xc_domain_set_param() Andrew Cooper
2016-02-18 18:52 ` [PATCHv1 3/5] x86/fpu: Add a per-domain field to set the width of FIP/FDP David Vrabel
2016-02-18 19:13   ` Andrew Cooper
2016-02-19 10:03     ` David Vrabel
2016-02-19 14:08   ` Jan Beulich
2016-02-19 14:16     ` David Vrabel
2016-02-19 14:36       ` Jan Beulich
2016-02-19 14:49         ` David Vrabel
2016-02-19 15:14           ` Jan Beulich
2016-02-19 15:43             ` David Vrabel
2016-02-19 16:38               ` David Vrabel
2016-02-19 17:20                 ` Jan Beulich
2016-02-18 18:52 ` [PATCHv1 4/5] x86/viridian: set x87 FIP width to 4 for Windows guests David Vrabel
2016-02-18 19:19   ` Andrew Cooper
2016-02-19 14:11   ` Jan Beulich
2016-02-18 18:52 ` [PATCHv1 5/5] x86/domctl: Add XEN_DOMCTL_PARAM_ARCH_X86_FIP_WIDTH parameter David Vrabel
2016-02-19 10:05   ` David Vrabel
2016-02-19 14:13     ` Jan Beulich

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=1455821530-4263-3-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).