summaryrefslogtreecommitdiffstats
path: root/hw/i386/vmport.c
diff options
context:
space:
mode:
authorLiran Alon2020-03-12 17:54:21 +0100
committerPaolo Bonzini2020-06-10 18:09:45 +0200
commitf8bdc550370f9a652a00db891f9b7640d83c0c43 (patch)
tree16d8cd1bd5e75b7db38eb633fd87dbf21fe5b141 /hw/i386/vmport.c
parenthw/i386/vmport: Introduce vmware-vmx-version property (diff)
downloadqemu-f8bdc550370f9a652a00db891f9b7640d83c0c43.tar.gz
qemu-f8bdc550370f9a652a00db891f9b7640d83c0c43.tar.xz
qemu-f8bdc550370f9a652a00db891f9b7640d83c0c43.zip
hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION
As can be seen from VmCheck_GetVersion() in open-vm-tools code, CMD_GETVERSION should return vmware-vmx-type in ECX register. Default is to fake host as VMware ESX server. But user can control this value by "-global vmport.vmware-vmx-type=X". Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com> Signed-off-by: Liran Alon <liran.alon@oracle.com> Message-Id: <20200312165431.82118-7-liran.alon@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/vmport.c')
-rw-r--r--hw/i386/vmport.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index dfebaf5b73..dabb443367 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -46,10 +46,13 @@
/* Compatibility flags for migration */
#define VMPORT_COMPAT_READ_SET_EAX_BIT 0
#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT 1
+#define VMPORT_COMPAT_REPORT_VMX_TYPE_BIT 2
#define VMPORT_COMPAT_READ_SET_EAX \
(1 << VMPORT_COMPAT_READ_SET_EAX_BIT)
#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD \
(1 << VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT)
+#define VMPORT_COMPAT_REPORT_VMX_TYPE \
+ (1 << VMPORT_COMPAT_REPORT_VMX_TYPE_BIT)
#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
@@ -61,6 +64,7 @@ typedef struct VMPortState {
void *opaque[VMPORT_ENTRIES];
uint32_t vmware_vmx_version;
+ uint8_t vmware_vmx_type;
uint32_t compat_flags;
} VMPortState;
@@ -140,6 +144,9 @@ static uint32_t vmport_cmd_get_version(void *opaque, uint32_t addr)
X86CPU *cpu = X86_CPU(current_cpu);
cpu->env.regs[R_EBX] = VMPORT_MAGIC;
+ if (port_state->compat_flags & VMPORT_COMPAT_REPORT_VMX_TYPE) {
+ cpu->env.regs[R_ECX] = port_state->vmware_vmx_type;
+ }
return port_state->vmware_vmx_version;
}
@@ -181,10 +188,30 @@ static Property vmport_properties[] = {
VMPORT_COMPAT_READ_SET_EAX_BIT, true),
DEFINE_PROP_BIT("x-signal-unsupported-cmd", VMPortState, compat_flags,
VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT, true),
+ DEFINE_PROP_BIT("x-report-vmx-type", VMPortState, compat_flags,
+ VMPORT_COMPAT_REPORT_VMX_TYPE_BIT, true),
/* Default value taken from open-vm-tools code VERSION_MAGIC definition */
DEFINE_PROP_UINT32("vmware-vmx-version", VMPortState,
vmware_vmx_version, 6),
+ /*
+ * Value determines which VMware product type host report itself to guest.
+ *
+ * Most guests are fine with exposing host as VMware ESX server.
+ * Some legacy/proprietary guests hard-code a given type.
+ *
+ * For a complete list of values, refer to enum VMXType at open-vm-tools
+ * project (Defined at lib/include/vm_vmx_type.h).
+ *
+ * Reasonable options:
+ * 0 - Unset
+ * 1 - VMware Express (deprecated)
+ * 2 - VMware ESX Server
+ * 3 - VMware Server (Deprecated)
+ * 4 - VMware Workstation
+ * 5 - ACE 1.x (Deprecated)
+ */
+ DEFINE_PROP_UINT8("vmware-vmx-type", VMPortState, vmware_vmx_type, 2),
DEFINE_PROP_END_OF_LIST(),
};