Skip to contentSkip to conversation

tools/libxc: Exposed XEN_DOMCTL_getvcpuextstate

PATCH In review Razvan Cojocaru 2 participants 2 messages Mar 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxc: Exposed XEN_DOMCTL_getvcpuextstate

It's useful for an introspection tool to be able to inspect XSAVE states. Xen already has a DOMCTL that can be used for this purpose, but it had no public libxc wrapper. This patch adds xc_vcpu_get_extstate().

---
 tools/libxc/include/xenctrl.h | 23 +++++++++++++++++
 tools/libxc/xc_domain.c       | 59 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)
tools/libxc/include/xenctrl.h +23 -0
index a48981a..b80d150 100644
@@ -487,6 +487,11 @@ typedef union
 } start_info_any_t;
 #endif
 
+typedef struct xc_vcpu_extstate {
+    uint64_t xfeature_mask;
+    uint64_t size;
+    void *buffer;
+} xc_vcpu_extstate_t;
 
 typedef struct xen_arch_domainconfig xc_domain_configuration_t;
 int xc_domain_create(xc_interface *xch, uint32_t ssidref,
@@ -880,6 +885,24 @@ int xc_vcpu_getcontext(xc_interface *xch,
                        uint32_t vcpu,
                        vcpu_guest_context_any_t *ctxt);
 
+/**
+ * This function returns information about the XSAVE state of a particular
+ * vcpu of a domain. If extstate->size and extstate->xfeature_mask are 0,
+ * the call is considered a query to retrieve them and the buffer is not
+ * filled.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid the domain to get information from
+ * @parm vcpu the vcpu number
+ * @parm extstate a pointer to a structure to store the XSAVE state of the
+ *                domain
+ * @return 0 on success, negative error code on failure
+ */
+int xc_vcpu_get_extstate(xc_interface *xch,
+                         uint32_t domid,
+                         uint32_t vcpu,
+                         xc_vcpu_extstate_t *extstate);
+
 typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
 int xc_vcpu_getinfo(xc_interface *xch,
                     uint32_t domid,
tools/libxc/xc_domain.c +59 -0

65 lines not on this page · raw message

Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Razvan Cojocaru

It's useful for an introspection tool to be able to inspect XSAVE states. Xen already has a DOMCTL that can be used for this purpose, but it had no public libxc wrapper. This patch adds xc_vcpu_get_extstate().

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel