[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 030/115] hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION
From: |
Paolo Bonzini |
Subject: |
[PULL 030/115] hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION |
Date: |
Thu, 11 Jun 2020 15:43:24 -0400 |
From: Liran Alon <liran.alon@oracle.com>
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>
---
hw/core/machine.c | 1 +
hw/i386/vmport.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index fc209d711b..9a07e9333a 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -45,6 +45,7 @@ GlobalProperty hw_compat_4_2[] = {
{ "fw_cfg", "acpi-mr-restore", "false" },
{ "vmport", "x-read-set-eax", "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);
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(),
};
--
2.26.2
- [PULL 045/115] cpus: Fix botched configure_icount() error API violation fix, (continued)
- [PULL 045/115] cpus: Fix botched configure_icount() error API violation fix, Paolo Bonzini, 2020/06/11
- [PULL 041/115] qom/object: factor out the initialization of hash table of properties, Paolo Bonzini, 2020/06/11
- [PULL 055/115] target/i386: fix fscale handling of rounding precision, Paolo Bonzini, 2020/06/11
- [PULL 059/115] hw/elf_ops: Do not ignore write failures when loading ELF, Paolo Bonzini, 2020/06/11
- [PULL 025/115] hw/i386/vmport: Add reference to VMware open-vm-tools, Paolo Bonzini, 2020/06/11
- [PULL 017/115] hyperv: expose API to determine if synic is enabled, Paolo Bonzini, 2020/06/11
- [PULL 014/115] qom/object: Move Object typedef to 'qemu/typedefs.h', Paolo Bonzini, 2020/06/11
- [PULL 066/115] x86/cpu: Enable AVX512_VP2INTERSECT cpu feature, Paolo Bonzini, 2020/06/11
- [PULL 067/115] vfio/pci: Use kvm_irqchip_add_irqfd_notifier_gsi() for irqfds, Paolo Bonzini, 2020/06/11
- [PULL 035/115] hw/i386/vmport: Allow x2apic without IR, Paolo Bonzini, 2020/06/11
- [PULL 030/115] hw/i386/vmport: Report vmware-vmx-type in CMD_GETVERSION,
Paolo Bonzini <=
- [PULL 064/115] target/i386: fix fisttpl, fisttpll handling of out-of-range values, Paolo Bonzini, 2020/06/11
- [PULL 024/115] target/i386: fix phadd* with identical destination and source register, Paolo Bonzini, 2020/06/11
- [PULL 048/115] megasas: use unsigned type for reply_queue_head and check index, Paolo Bonzini, 2020/06/11
- [PULL 060/115] target/i386: fix floating-point load-constant rounding, Paolo Bonzini, 2020/06/11
- [PULL 019/115] vmbus: vmbus implementation, Paolo Bonzini, 2020/06/11
- [PULL 022/115] vmbus: add infrastructure to save/load vmbus requests, Paolo Bonzini, 2020/06/11
- [PULL 057/115] exec: Propagate cpu_memory_rw_debug() error, Paolo Bonzini, 2020/06/11
- [PULL 031/115] hw/i386/vmport: Introduce vmport.h, Paolo Bonzini, 2020/06/11
- [PULL 047/115] i386/kvm: fix a use-after-free when vcpu plug/unplug, Paolo Bonzini, 2020/06/11
- [PULL 040/115] qom: remove index from object_resolve_abs_path(), Paolo Bonzini, 2020/06/11