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>
This commit is contained in:
parent
2fd2f799f8
commit
f8bdc55037
|
@ -45,6 +45,7 @@ GlobalProperty hw_compat_4_2[] = {
|
||||||
{ "fw_cfg", "acpi-mr-restore", "false" },
|
{ "fw_cfg", "acpi-mr-restore", "false" },
|
||||||
{ "vmport", "x-read-set-eax", "off" },
|
{ "vmport", "x-read-set-eax", "off" },
|
||||||
{ "vmport", "x-signal-unsupported-cmd", "off" },
|
{ "vmport", "x-signal-unsupported-cmd", "off" },
|
||||||
|
{ "vmport", "x-report-vmx-type", "off" },
|
||||||
};
|
};
|
||||||
const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
|
const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,13 @@
|
||||||
/* Compatibility flags for migration */
|
/* Compatibility flags for migration */
|
||||||
#define VMPORT_COMPAT_READ_SET_EAX_BIT 0
|
#define VMPORT_COMPAT_READ_SET_EAX_BIT 0
|
||||||
#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT 1
|
#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT 1
|
||||||
|
#define VMPORT_COMPAT_REPORT_VMX_TYPE_BIT 2
|
||||||
#define VMPORT_COMPAT_READ_SET_EAX \
|
#define VMPORT_COMPAT_READ_SET_EAX \
|
||||||
(1 << VMPORT_COMPAT_READ_SET_EAX_BIT)
|
(1 << VMPORT_COMPAT_READ_SET_EAX_BIT)
|
||||||
#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD \
|
#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD \
|
||||||
(1 << VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT)
|
(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)
|
#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
|
||||||
|
|
||||||
|
@ -61,6 +64,7 @@ typedef struct VMPortState {
|
||||||
void *opaque[VMPORT_ENTRIES];
|
void *opaque[VMPORT_ENTRIES];
|
||||||
|
|
||||||
uint32_t vmware_vmx_version;
|
uint32_t vmware_vmx_version;
|
||||||
|
uint8_t vmware_vmx_type;
|
||||||
|
|
||||||
uint32_t compat_flags;
|
uint32_t compat_flags;
|
||||||
} VMPortState;
|
} VMPortState;
|
||||||
|
@ -140,6 +144,9 @@ static uint32_t vmport_cmd_get_version(void *opaque, uint32_t addr)
|
||||||
X86CPU *cpu = X86_CPU(current_cpu);
|
X86CPU *cpu = X86_CPU(current_cpu);
|
||||||
|
|
||||||
cpu->env.regs[R_EBX] = VMPORT_MAGIC;
|
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;
|
return port_state->vmware_vmx_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,10 +188,30 @@ static Property vmport_properties[] = {
|
||||||
VMPORT_COMPAT_READ_SET_EAX_BIT, true),
|
VMPORT_COMPAT_READ_SET_EAX_BIT, true),
|
||||||
DEFINE_PROP_BIT("x-signal-unsupported-cmd", VMPortState, compat_flags,
|
DEFINE_PROP_BIT("x-signal-unsupported-cmd", VMPortState, compat_flags,
|
||||||
VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT, true),
|
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 */
|
/* Default value taken from open-vm-tools code VERSION_MAGIC definition */
|
||||||
DEFINE_PROP_UINT32("vmware-vmx-version", VMPortState,
|
DEFINE_PROP_UINT32("vmware-vmx-version", VMPortState,
|
||||||
vmware_vmx_version, 6),
|
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(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue