[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 028/115] hw/i386/vmport: Set EAX to -1 on failed and unsupported c
From: |
Paolo Bonzini |
Subject: |
[PULL 028/115] hw/i386/vmport: Set EAX to -1 on failed and unsupported commands |
Date: |
Thu, 11 Jun 2020 15:43:22 -0400 |
From: Liran Alon <liran.alon@oracle.com>
This is used as a signal for VMware Tools to know if a command it
attempted to invoke, failed or is unsupported. As a result, VMware Tools
will either report failure to user or fallback to another backdoor command
in attempt to perform some operation.
A few examples:
* open-vm-tools TimeSyncReadHost() function fallbacks to
CMD_GETTIMEFULL command when CMD_GETTIMEFULL_WITH_LAG
fails/unsupported.
* open-vm-tools Hostinfo_NestingSupported() function verifies
EAX != -1 to check for success.
* open-vm-tools Hostinfo_VCPUInfoBackdoor() functions checks
if reserved-bit is set to indicate command is unimplemented.
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200312165431.82118-5-liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/core/machine.c | 1 +
hw/i386/vmport.c | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 83f0fe5c91..fc209d711b 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -44,6 +44,7 @@ GlobalProperty hw_compat_4_2[] = {
{ "qxl-vga", "revision", "4" },
{ "fw_cfg", "acpi-mr-restore", "false" },
{ "vmport", "x-read-set-eax", "off" },
+ { "vmport", "x-signal-unsupported-cmd", "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 3bb420a245..730b61fcaa 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -44,9 +44,12 @@
#define VMPORT_MAGIC 0x564D5868
/* Compatibility flags for migration */
-#define VMPORT_COMPAT_READ_SET_EAX_BIT 0
-#define VMPORT_COMPAT_READ_SET_EAX \
+#define VMPORT_COMPAT_READ_SET_EAX_BIT 0
+#define VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD_BIT 1
+#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(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
@@ -87,17 +90,23 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr
addr,
eax = env->regs[R_EAX];
if (eax != VMPORT_MAGIC) {
- goto out;
+ goto err;
}
command = env->regs[R_ECX];
trace_vmport_command(command);
if (command >= VMPORT_ENTRIES || !s->func[command]) {
qemu_log_mask(LOG_UNIMP, "vmport: unknown command %x\n", command);
- goto out;
+ goto err;
}
eax = s->func[command](s->opaque[command], addr);
+ goto out;
+
+err:
+ if (s->compat_flags & VMPORT_COMPAT_SIGNAL_UNSUPPORTED_CMD) {
+ eax = UINT32_MAX;
+ }
out:
/*
@@ -168,6 +177,8 @@ static Property vmport_properties[] = {
/* Used to enforce compatibility for migration */
DEFINE_PROP_BIT("x-read-set-eax", VMPortState, compat_flags,
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_END_OF_LIST(),
};
--
2.26.2
- [PULL 011/115] icount: fix shift=auto for record/replay, (continued)
- [PULL 011/115] icount: fix shift=auto for record/replay, Paolo Bonzini, 2020/06/11
- [PULL 007/115] run-coverity-scan: download tools outside the container, Paolo Bonzini, 2020/06/11
- [PULL 006/115] run-coverity-scan: use --no-update-tools in docker run, Paolo Bonzini, 2020/06/11
- [PULL 003/115] run-coverity-scan: get Coverity token and email from special git config section, Paolo Bonzini, 2020/06/11
- [PULL 010/115] numa: prevent usage of -M memory-backend and -numa memdev at the same time, Paolo Bonzini, 2020/06/11
- [PULL 016/115] Makefile: Let the 'help' target list the helper targets, Paolo Bonzini, 2020/06/11
- [PULL 015/115] io/task: Move 'qom/object.h' header to source, Paolo Bonzini, 2020/06/11
- [PULL 021/115] i386: Hyper-V VMBus ACPI DSDT entry, Paolo Bonzini, 2020/06/11
- [PULL 018/115] vmbus: add vmbus protocol definitions, Paolo Bonzini, 2020/06/11
- [PULL 020/115] i386:pc: whitelist dynamic vmbus-bridge, Paolo Bonzini, 2020/06/11
- [PULL 028/115] hw/i386/vmport: Set EAX to -1 on failed and unsupported commands,
Paolo Bonzini <=
- [PULL 023/115] target/i386: Fix the CPUID leaf CPUID_Fn80000008, Paolo Bonzini, 2020/06/11
- [PULL 029/115] hw/i386/vmport: Introduce vmware-vmx-version property, Paolo Bonzini, 2020/06/11
- [PULL 012/115] qom/object: Fix object_child_foreach_recursive() return value, Paolo Bonzini, 2020/06/11
- [PULL 027/115] hw/i386/vmport: Propagate IOPort read to vCPU EAX register, Paolo Bonzini, 2020/06/11
[PULL 005/115] run-coverity-scan: add --no-update-tools option, Paolo Bonzini, 2020/06/11
[PULL 033/115] hw/i386/vmport: Add support for CMD_GETBIOSUUID, Paolo Bonzini, 2020/06/11