All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Eddie Dong <eddie.dong@intel.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Don Slutz <dslutz@verizon.com>, Tim Deegan <tim@xen.org>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [PATCH for-4.5 v6 09/16] tools: Add limited support of VMware's hyper-call rpc
Date: Sat, 20 Sep 2014 14:07:20 -0400	[thread overview]
Message-ID: <1411236447-7435-10-git-send-email-dslutz@verizon.com> (raw)
In-Reply-To: <1411236447-7435-1-git-send-email-dslutz@verizon.com>

  This guestinfo support is provided via libxc.  libxl support has
not be written.

Note: VMware RPC support is only available on HVM domU.

This interface is an extension of __HYPERVISOR_HVM_op.  It was
picked because xc_get_hvm_param() also uses it and VMware guest
info is a lot like a hvm param.

The HVMOP_get_vmport_guest_info is used by two libxc functions,
xc_get_vmport_guest_info and xc_fetch_all_vmport_guest_info.
xc_fetch_all_vmport_guest_info is designed to be used to fetch all
currently set guestinfo values.

Signed-off-by: Don Slutz <dslutz@verizon.com>
---
 tools/libxc/xc_domain.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++
 tools/libxc/xenctrl.h   |  24 ++++++++++
 2 files changed, 139 insertions(+)

diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 1a6f90a..ce24dad 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -1577,6 +1577,121 @@ int xc_hvm_set_ioreq_server_state(xc_interface *xch,
     return rc;
 }
 
+int xc_set_vmport_guest_info(xc_interface *handle,
+                             domid_t dom,
+                             unsigned int key_len,
+                             char *key,
+                             unsigned int val_len,
+                             char *val)
+{
+    DECLARE_HYPERCALL;
+    DECLARE_HYPERCALL_BUFFER(xen_hvm_vmport_guest_info_t, arg);
+    int rc;
+
+    if ( (key_len < 1) ||
+        (key_len > VMPORT_GUEST_INFO_KEY_MAX) ||
+        (val_len > VMPORT_GUEST_INFO_VAL_MAX) )
+        return -1;
+
+    arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
+    if ( arg == NULL )
+        return -1;
+
+    hypercall.op     = __HYPERVISOR_hvm_op;
+    hypercall.arg[0] = HVMOP_set_vmport_guest_info;
+    hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+    arg->domid = dom;
+    arg->key_length = key_len;
+    arg->value_length = val_len;
+    memcpy(arg->data, key, key_len);
+    memcpy(&arg->data[key_len], val, val_len);
+    rc = do_xen_hypercall(handle, &hypercall);
+    xc_hypercall_buffer_free(handle, arg);
+    return rc;
+}
+
+int xc_get_vmport_guest_info(xc_interface *handle,
+                             domid_t dom,
+                             unsigned int key_len,
+                             char *key,
+                             unsigned int val_max,
+                             unsigned int *val_len,
+                             char *val)
+{
+    DECLARE_HYPERCALL;
+    DECLARE_HYPERCALL_BUFFER(xen_hvm_vmport_guest_info_t, arg);
+    int rc;
+
+    if ( (key_len < 1) ||
+        (key_len > VMPORT_GUEST_INFO_KEY_MAX) )
+        return -1;
+
+    arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
+
+    hypercall.op     = __HYPERVISOR_hvm_op;
+    hypercall.arg[0] = HVMOP_get_vmport_guest_info;
+    hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+    arg->domid = dom;
+    arg->key_length = key_len;
+    arg->value_length = 0;
+    *val_len = 0;
+    memcpy(arg->data, key, key_len);
+    rc = do_xen_hypercall(handle, &hypercall);
+    if ( rc == 0 )
+    {
+        *val_len = arg->value_length;
+        if ( arg->value_length > val_max )
+            arg->value_length = val_max;
+        memcpy(val, &arg->data[key_len], arg->value_length);
+    }
+    xc_hypercall_buffer_free(handle, arg);
+    return rc;
+}
+
+int xc_fetch_all_vmport_guest_info(xc_interface *handle,
+                                   domid_t dom,
+                                   unsigned int idx,
+                                   unsigned int key_max,
+                                   unsigned int *key_len,
+                                   char *key,
+                                   unsigned int val_max,
+                                   unsigned int *val_len,
+                                   char *val)
+{
+    DECLARE_HYPERCALL;
+    DECLARE_HYPERCALL_BUFFER(xen_hvm_vmport_guest_info_t, arg);
+    int rc;
+
+    arg = xc_hypercall_buffer_alloc(handle, arg, sizeof(*arg));
+
+    hypercall.op     = __HYPERVISOR_hvm_op;
+    hypercall.arg[0] = HVMOP_get_vmport_guest_info;
+    hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+    arg->domid = dom;
+    arg->key_length = 0;
+    arg->value_length = idx;
+    *key_len = 0;
+    *val_len = 0;
+    rc = do_xen_hypercall(handle, &hypercall);
+    if ( rc == 0 )
+    {
+        uint16_t val_off = arg->key_length;
+
+        *key_len = arg->key_length;
+        if ( arg->key_length > key_max )
+            arg->key_length = key_max;
+        memcpy(key, arg->data, arg->key_length);
+        *val_len = arg->value_length;
+        if ( arg->value_length > val_max )
+            arg->value_length = val_max;
+        memcpy(val,
+               &arg->data[val_off],
+               arg->value_length);
+    }
+    xc_hypercall_buffer_free(handle, arg);
+    return rc;
+}
+
 int xc_domain_setdebugging(xc_interface *xch,
                            uint32_t domid,
                            unsigned int enable)
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 514b241..baac464 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -2019,6 +2019,30 @@ int xc_hvm_destroy_ioreq_server(xc_interface *xch,
                                 domid_t domid,
                                 ioservid_t id);
 
+int xc_set_vmport_guest_info(xc_interface *handle,
+                             domid_t dom,
+                             unsigned int key_len,
+                             char *key,
+                             unsigned int val_len,
+                             char *val);
+int xc_get_vmport_guest_info(xc_interface *handle,
+                             domid_t dom,
+                             unsigned int key_len,
+                             char *key,
+                             unsigned int val_max,
+                             unsigned int *val_len,
+                             char *val);
+int xc_fetch_all_vmport_guest_info(xc_interface *handle,
+                                   domid_t dom,
+                                   unsigned int idx,
+                                   unsigned int key_max,
+                                   unsigned int *key_len,
+                                   char *key,
+                                   unsigned int val_max,
+                                   unsigned int *val_len,
+                                   char *val);
+
+
 /* HVM guest pass-through */
 int xc_assign_device(xc_interface *xch,
                      uint32_t domid,
-- 
1.8.4

  parent reply	other threads:[~2014-09-20 18:07 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-20 18:07 [PATCH for-4.5 v6 00/16] Xen VMware tools support Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 01/16] xen: Add support for VMware cpuid leaves Don Slutz
2014-09-22 11:49   ` Andrew Cooper
2014-09-22 16:53     ` Don Slutz
2014-09-24 14:33   ` George Dunlap
2014-09-20 18:07 ` [PATCH for-4.5 v6 02/16] tools: Add vmware_hw support Don Slutz
2014-09-22 13:34   ` Ian Campbell
2014-09-22 22:08     ` Don Slutz
2014-09-24 14:44   ` George Dunlap
2014-09-24 21:06     ` Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 03/16] vmware: Add VMware provided include files Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 04/16] xen: Add vmware_port support Don Slutz
2014-09-23 17:16   ` Boris Ostrovsky
2014-09-24  8:28     ` Jan Beulich
2014-09-26 19:09     ` Don Slutz
2014-09-24 16:01   ` George Dunlap
2014-09-24 16:48     ` Don Slutz
2014-09-24 17:42       ` Andrew Cooper
2014-09-20 18:07 ` [PATCH for-4.5 v6 05/16] tools: " Don Slutz
2014-09-22 13:41   ` Ian Campbell
2014-09-22 16:34     ` Andrew Cooper
2014-09-22 21:22       ` Don Slutz
2014-09-24 16:24         ` George Dunlap
2014-09-24 18:25           ` Don Slutz
2014-09-22 16:42     ` Don Slutz
2014-09-23 12:20       ` Ian Campbell
2014-09-24 16:31         ` Don Slutz
2014-09-24 16:44           ` George Dunlap
2014-09-24 18:29             ` Don Slutz
2014-09-25 11:24           ` Ian Campbell
2014-09-25 14:17             ` George Dunlap
2014-09-25 14:21               ` Ian Campbell
2014-09-26 19:19             ` Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 06/16] xen: Convert vmware_port to xentrace usage Don Slutz
2014-09-24 17:27   ` George Dunlap
2014-09-24 19:07     ` Don Slutz
2014-09-25 15:14       ` George Dunlap
2014-09-29 18:10         ` Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 07/16] tools: " Don Slutz
2014-09-25 15:18   ` George Dunlap
2014-09-20 18:07 ` [PATCH for-4.5 v6 08/16] xen: Add limited support of VMware's hyper-call rpc Don Slutz
2014-09-22 13:47   ` Ian Campbell
2014-09-22 21:18     ` Don Slutz
2014-09-23 12:34       ` Ian Campbell
2014-09-23 22:03         ` Slutz, Donald Christopher
2014-09-25 16:28     ` George Dunlap
2014-09-20 18:07 ` Don Slutz [this message]
2014-09-22 13:52   ` [PATCH for-4.5 v6 09/16] tools: " Ian Campbell
2014-09-22 21:32     ` Don Slutz
2014-09-23 12:35       ` Ian Campbell
2014-09-20 18:07 ` [PATCH for-4.5 v6 10/16] Add VMware tool's triggers Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 11/16] Add live migration of VMware's hyper-call RPC Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 12/16] Add dump of HVM_SAVE_CODE(VMPORT) to xen-hvmctx Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 13/16] Add xen-hvm-param Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 14/16] Add xen-vmware-guestinfo Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 15/16] Add xen-list-vmware-guestinfo Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 16/16] Add xen-hvm-send-trigger Don Slutz
2014-09-22 13:56 ` [PATCH for-4.5 v6 00/16] Xen VMware tools support Ian Campbell
2014-09-22 15:19   ` George Dunlap
2014-09-22 15:34     ` Ian Campbell
2014-09-22 15:38       ` George Dunlap
2014-09-22 15:50         ` Ian Campbell
2014-09-22 15:55           ` George Dunlap
2014-09-22 17:19             ` Don Slutz
2014-09-22 22:00               ` Tian, Kevin
2014-09-23 12:30               ` Ian Campbell
2014-09-23 12:35                 ` George Dunlap
2014-09-23 12:40                   ` Ian Campbell
2014-09-24 15:52                 ` George Dunlap
2014-09-24 18:09                   ` Don Slutz
2014-09-24 17:19                 ` Don Slutz
2014-09-24 20:21                   ` Konrad Rzeszutek Wilk
2014-09-26 19:03                     ` Don Slutz
2014-09-26 19:28                       ` Konrad Rzeszutek Wilk
2014-09-25 11:35                   ` Ian Campbell
2014-09-22 16:18         ` Jan Beulich
2014-09-22 18:32           ` Don Slutz
2014-09-25 10:37           ` Tim Deegan
2014-09-26 20:00             ` Don Slutz
2014-09-29  6:50               ` Jan Beulich
2014-09-29 13:27                 ` George Dunlap
2014-09-29 13:49                   ` Jan Beulich
2014-09-29 23:13                   ` Don Slutz
2014-09-30  7:05                     ` Jan Beulich
2014-09-30 10:02                       ` George Dunlap
2014-09-30 22:11                         ` Slutz, Donald Christopher
2014-09-30 10:09                     ` George Dunlap
2014-09-30 22:23                       ` Slutz, Donald Christopher
2014-10-02 10:05               ` Tim Deegan
2014-10-02 19:20                 ` Don Slutz
2014-10-03  7:09                   ` Tim Deegan
2014-09-22 15:52       ` Andrew Cooper
2014-09-22 18:39         ` Don Slutz

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=1411236447-7435-10-git-send-email-dslutz@verizon.com \
    --to=dslutz@verizon.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tim@xen.org \
    --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.