[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 05/16] tools part of add vmware_port to xl.cfg



If non-zero then
  enable a limited support of VMware's hyper-call.

VMware's hyper-call is also known as VMware Backdoor I/O Port.

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
 docs/man/xl.cfg.pod.5           |  7 +++++++
 tools/libxc/xc_domain_restore.c | 11 +++++++++++
 tools/libxc/xc_domain_save.c    | 11 +++++++++++
 tools/libxc/xg_save_restore.h   |  1 +
 tools/libxl/libxl_create.c      |  5 ++++-
 tools/libxl/libxl_dom.c         |  2 ++
 tools/libxl/libxl_types.idl     |  1 +
 tools/libxl/xl_cmdimpl.c        |  2 ++
 8 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index 7f7319a..c083af8 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1153,6 +1153,13 @@ Turns on or off the exposure of VMware cpuid.  The 
number is the
 VMware's hardware version number, where 0 is off.  If on it also
 forces the use of VMware's VGA in QEMU.
 
+=item B<vmware_port=BOOLEAN>
+
+Turns on or off the exposure of VMware port.  This is known as
+vmport in QEMU.  Also called VMware Backdoor I/O Port.  Not all
+defined VMware backdoor commands are implemented.  A lot of the
+ones that Linux uses are defined.
+
 =back
 
 =head3 Emulated VGA Graphics Device
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index bc5cd57..0f35186 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -744,6 +744,7 @@ typedef struct {
     uint64_t ioreq_server_pfn;
     uint64_t nr_ioreq_server_pages;
     uint64_t vmware_hw;
+    uint64_t vmware_port;
 
     struct toolstack_data_t tdata;
 } pagebuf_t;
@@ -938,6 +939,16 @@ static int pagebuf_get_one(xc_interface *xch, struct 
restore_ctx *ctx,
         }
         return pagebuf_get_one(xch, ctx, buf, fd, dom);
 
+    case XC_SAVE_ID_HVM_VMWARE_PORT:
+        /* Skip padding 4 bytes then read the vmware port flag. */
+        if ( RDEXACT(fd, &buf->vmware_port, sizeof(uint32_t)) ||
+             RDEXACT(fd, &buf->vmware_port, sizeof(uint64_t)) )
+        {
+            PERROR("error read the vmware_port flag");
+            return -1;
+        }
+        return pagebuf_get_one(xch, ctx, buf, fd, dom);
+
     case XC_SAVE_ID_TOOLSTACK:
         {
             if ( RDEXACT(fd, &buf->tdata.len, sizeof(buf->tdata.len)) )
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index 76dc307..d53bc38 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -1761,6 +1761,17 @@ int xc_domain_save(xc_interface *xch, int io_fd, 
uint32_t dom, uint32_t max_iter
             PERROR("Error when writing the vmware_hw value");
             goto out;
         }
+
+        chunk.id = XC_SAVE_ID_HVM_VMWARE_PORT;
+        chunk.data = 0;
+        xc_hvm_param_get(xch, dom, HVM_PARAM_VMWARE_PORT, &chunk.data);
+
+        if ( (chunk.data != 0) &&
+             wrexact(io_fd, &chunk, sizeof(chunk)) )
+        {
+            PERROR("Error when writing the vmware_port flag");
+            goto out;
+        }
     }
 
     if ( callbacks != NULL && callbacks->toolstack_save != NULL )
diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h
index d185ba9..097e06b 100644
--- a/tools/libxc/xg_save_restore.h
+++ b/tools/libxc/xg_save_restore.h
@@ -264,6 +264,7 @@
 #define XC_SAVE_ID_HVM_NR_IOREQ_SERVER_PAGES -20
 /* VMware data */
 #define XC_SAVE_ID_HVM_VMWARE_HW      -21
+#define XC_SAVE_ID_HVM_VMWARE_PORT    -22
 
 /*
 ** We process save/restore/migrate in batches of pages; the below
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 54842ee..ca0effc 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -295,6 +295,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         libxl_defbool_setdefault(&b_info->u.hvm.viridian,           false);
         libxl_defbool_setdefault(&b_info->u.hvm.hpet,               true);
         libxl_defbool_setdefault(&b_info->u.hvm.vpt_align,          true);
+        libxl_defbool_setdefault(&b_info->u.hvm.vmware_port,        false);
         libxl_defbool_setdefault(&b_info->u.hvm.nested_hvm,         false);
         libxl_defbool_setdefault(&b_info->u.hvm.usb,                false);
         libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci,   true);
@@ -428,7 +429,7 @@ int libxl__domain_build(libxl__gc *gc,
         vments[4] = "start_time";
         vments[5] = libxl__sprintf(gc, "%lu.%02d", 
start_time.tv_sec,(int)start_time.tv_usec/10000);
 
-        localents = libxl__calloc(gc, 9, sizeof(char *));
+        localents = libxl__calloc(gc, 11, sizeof(char *));
         localents[0] = "platform/acpi";
         localents[1] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
         localents[2] = "platform/acpi_s3";
@@ -437,6 +438,8 @@ int libxl__domain_build(libxl__gc *gc,
         localents[5] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
         localents[6] = "platform/vmware_hw";
         localents[7] = libxl__sprintf(gc, "%"PRId64, info->u.hvm.vmware_hw);
+        localents[8] = "platform/vmware_port";
+        localents[9] = libxl_defbool_val(info->u.hvm.vmware_port) ? "1" : "0";
 
         break;
     case LIBXL_DOMAIN_TYPE_PV:
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 63ae4c5..5d9796d 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -221,6 +221,8 @@ static void hvm_set_conf_params(xc_interface *handle, 
uint32_t domid,
                     libxl_defbool_val(info->u.hvm.hpet));
     xc_set_hvm_param(handle, domid, HVM_PARAM_VMWARE_HW,
                      info->u.hvm.vmware_hw);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_VMWARE_PORT,
+                     libxl_defbool_val(info->u.hvm.vmware_port));
 #endif
     xc_hvm_param_set(handle, domid, HVM_PARAM_TIMER_MODE, timer_mode(info));
     xc_hvm_param_set(handle, domid, HVM_PARAM_VPT_ALIGN,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index d0bd657..278309d 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -376,6 +376,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("hpet",             libxl_defbool),
                                        ("vpt_align",        libxl_defbool),
                                        ("vmware_hw",        UInt(64, init_val 
= 0)),
+                                       ("vmware_port",      libxl_defbool),
                                        ("timer_mode",       libxl_timer_mode),
                                        ("nested_hvm",       libxl_defbool),
                                        ("smbios_firmware",  string),
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index c30341a..90efc02 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1035,6 +1035,8 @@ static void parse_config_data(const char *config_source,
         xlu_cfg_get_defbool(config, "viridian", &b_info->u.hvm.viridian, 0);
         if (!xlu_cfg_get_long(config, "vmware_hw",  &l, 1))
             b_info->u.hvm.vmware_hw = l;
+        xlu_cfg_get_defbool(config, "vmware_port", &b_info->u.hvm.vmware_port,
+                            0);
         xlu_cfg_get_defbool(config, "hpet", &b_info->u.hvm.hpet, 0);
         xlu_cfg_get_defbool(config, "vpt_align", &b_info->u.hvm.vpt_align, 0);
 
-- 
1.8.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.