Skip to contentSkip to conversation

-machine vmport=off: Allow disabling of VMWare ioport emulation

PATCH In review Don Slutz 5 participants 8 messages Oct 3, 2014 – Oct 20, 2014

lore
Share & tools
lore

Don Slutz

author
#0 lore raw

v2 cover -machine vmport=off: Allow disabling of VMWare ioport emulation

Changes v1 to v2 (Don Slutz):
make vmport a pc & q35 only machine opt I.E. a machine property.

Dr. David Alan Gilbert (1):
-machine vmport=off: Allow disabling of VMWare ioport emulation

 hw/i386/pc.c         | 19 +++++++++++++++++++
 hw/i386/pc_piix.c    |  4 ++--
 hw/i386/pc_q35.c     |  3 ++-
 include/hw/i386/pc.h |  2 ++
 qemu-options.hx      |  3 +++
 vl.c                 |  4 ++++
 6 files changed, 32 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.4
author
#1 lore raw

PATCH v2 1/1 -machine vmport=off: Allow disabling of VMWare ioport emulation

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our incomplete emulation of it's special IO Port. This adds a pc & q35 property to allow it to be turned off.

---
 hw/i386/pc.c         | 19 +++++++++++++++++++
 hw/i386/pc_piix.c    |  4 ++--
 hw/i386/pc_q35.c     |  3 ++-
 include/hw/i386/pc.h |  2 ++
 qemu-options.hx      |  3 +++
 vl.c                 |  4 ++++
 6 files changed, 32 insertions(+), 3 deletions(-)
hw/i386/pc.c +19 -0
index 82a7daa..8e37a99 100644
@@ -1687,6 +1687,20 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
     pcms->max_ram_below_4g = value;
 }
 
+static bool pc_machine_get_vmport(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->vmport;
+}
+
+static void pc_machine_set_vmport(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->vmport = value;
+}
+
 static void pc_machine_initfn(Object *obj)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1699,6 +1713,11 @@ static void pc_machine_initfn(Object *obj)
                         pc_machine_get_max_ram_below_4g,
                         pc_machine_set_max_ram_below_4g,
                         NULL, NULL, NULL);
+    pcms->vmport = !xen_enabled();
+    object_property_add_bool(obj, PC_MACHINE_VMPORT,
+                             pc_machine_get_vmport,
+                             pc_machine_set_vmport,
+                             NULL);
 }
 
 static void pc_machine_class_init(ObjectClass *oc, void *data)
hw/i386/pc_piix.c +2 -2
index 103d756..03a73ce 100644
@@ -234,8 +234,8 @@ static void pc_init1(MachineState *machine,
     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
 
     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
-        0x4);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0x4);
 
     pc_nic_init(isa_bus, pci_bus);
 
hw/i386/pc_q35.c +2 -1
index d4a907c..c5ba93d 100644
@@ -241,7 +241,8 @@ static void pc_q35_init(MachineState *machine)
     pc_register_ferr_irq(gsi[13]);
 
     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0xff0104);
 
     /* connect pm stuff to lpc */
     ich9_lpc_pm_init(lpc);
include/hw/i386/pc.h +2 -0
index 77316d5..96febb9 100644
@@ -35,11 +35,13 @@ struct PCMachineState {
     HotplugHandler *acpi_dev;
 
     uint64_t max_ram_below_4g;
+    bool vmport;
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
 #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
+#define PC_MACHINE_VMPORT           "vmport"
 
 /**
  * PCMachineClass:
qemu-options.hx +3 -0
index 365b56c..fe6b6e5 100644
@@ -33,6 +33,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "                property accel=accel1[:accel2[:...]] selects accelerator\n"
     "                supported accelerators are kvm, xen, tcg (default: tcg)\n"
     "                kernel_irqchip=on|off controls accelerated irqchip support\n"
+    "                vmport=on|off controls emulation of vmport (default: on)\n"
     "                kvm_shadow_mem=size of KVM shadow MMU\n"
     "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
     "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -51,6 +52,8 @@ than one accelerator specified, the next one is used if the previous one fails
 to initialize.
 @item kernel_irqchip=on|off
 Enables in-kernel irqchip support for the chosen accelerator when available.
+@item vmport=on|off
+Enables emulation of VMWare IO port, for vmmouse etc. (enabled by default)
 @item kvm_shadow_mem=size
 Defines the size of the KVM shadow MMU.
 @item dump-guest-core=on|off
vl.c +4 -0
index 9d2aaaf..26fa864 100644
@@ -389,6 +389,10 @@ static QemuOptsList qemu_machine_opts = {
             .name = PC_MACHINE_MAX_RAM_BELOW_4G,
             .type = QEMU_OPT_SIZE,
             .help = "maximum ram below the 4G boundary (32bit boundary)",
+        }, {
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_BOOL,
+            .help = "Enable vmport (pc & q35)",
         },{
             .name = "iommu",
             .type = QEMU_OPT_BOOL,
Signature · 1 line
1.8.4
Reviewed-by on v2 1/1
#2 lore raw

Il 03/10/2014 23:33, Don Slutz ha scritto:

Quoted 130 lines

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our incomplete emulation of it's special IO Port. This adds a pc & q35 property to allow it to be turned off.

---
 hw/i386/pc.c         | 19 +++++++++++++++++++
 hw/i386/pc_piix.c    |  4 ++--
 hw/i386/pc_q35.c     |  3 ++-
 include/hw/i386/pc.h |  2 ++
 qemu-options.hx      |  3 +++
 vl.c                 |  4 ++++
 6 files changed, 32 insertions(+), 3 deletions(-)
hw/i386/pc.c +19 -0
index 82a7daa..8e37a99 100644
@@ -1687,6 +1687,20 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
     pcms->max_ram_below_4g = value;
 }
 
+static bool pc_machine_get_vmport(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->vmport;
+}
+
+static void pc_machine_set_vmport(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->vmport = value;
+}
+
 static void pc_machine_initfn(Object *obj)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1699,6 +1713,11 @@ static void pc_machine_initfn(Object *obj)
                         pc_machine_get_max_ram_below_4g,
                         pc_machine_set_max_ram_below_4g,
                         NULL, NULL, NULL);
+    pcms->vmport = !xen_enabled();
+    object_property_add_bool(obj, PC_MACHINE_VMPORT,
+                             pc_machine_get_vmport,
+                             pc_machine_set_vmport,
+                             NULL);
 }
 
 static void pc_machine_class_init(ObjectClass *oc, void *data)
hw/i386/pc_piix.c +2 -2
index 103d756..03a73ce 100644
@@ -234,8 +234,8 @@ static void pc_init1(MachineState *machine,
     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
 
     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
-        0x4);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0x4);
 
     pc_nic_init(isa_bus, pci_bus);
 
hw/i386/pc_q35.c +2 -1
index d4a907c..c5ba93d 100644
@@ -241,7 +241,8 @@ static void pc_q35_init(MachineState *machine)
     pc_register_ferr_irq(gsi[13]);
 
     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0xff0104);
 
     /* connect pm stuff to lpc */
     ich9_lpc_pm_init(lpc);
include/hw/i386/pc.h +2 -0
index 77316d5..96febb9 100644
@@ -35,11 +35,13 @@ struct PCMachineState {
     HotplugHandler *acpi_dev;
 
     uint64_t max_ram_below_4g;
+    bool vmport;
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
 #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
+#define PC_MACHINE_VMPORT           "vmport"
 
 /**
  * PCMachineClass:
qemu-options.hx +3 -0
index 365b56c..fe6b6e5 100644
@@ -33,6 +33,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "                property accel=accel1[:accel2[:...]] selects accelerator\n"
     "                supported accelerators are kvm, xen, tcg (default: tcg)\n"
     "                kernel_irqchip=on|off controls accelerated irqchip support\n"
+    "                vmport=on|off controls emulation of vmport (default: on)\n"
     "                kvm_shadow_mem=size of KVM shadow MMU\n"
     "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
     "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -51,6 +52,8 @@ than one accelerator specified, the next one is used if the previous one fails
 to initialize.
 @item kernel_irqchip=on|off
 Enables in-kernel irqchip support for the chosen accelerator when available.
+@item vmport=on|off
+Enables emulation of VMWare IO port, for vmmouse etc. (enabled by default)
 @item kvm_shadow_mem=size
 Defines the size of the KVM shadow MMU.
 @item dump-guest-core=on|off
vl.c +0 -0
index 9d2aaaf..26fa864 100644

vl.c static QemuOptsList qemu_machine_opts = { · line 398

Quoted 10 lines
vl.c +4 -0
@@ -389,6 +389,10 @@ static QemuOptsList qemu_machine_opts = {
             .name = PC_MACHINE_MAX_RAM_BELOW_4G,
             .type = QEMU_OPT_SIZE,
             .help = "maximum ram below the 4G boundary (32bit boundary)",
+        }, {
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_BOOL,
+            .help = "Enable vmport (pc & q35)",
         },{
             .name = "iommu",
             .type = QEMU_OPT_BOOL,
Reviewed-by on v2 1/1
#3 lore raw
In reply to Don Slutz
Quoted 141 lines · Don Slutz

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our incomplete emulation of it's special IO Port. This adds a pc & q35 property to allow it to be turned off.

---
 hw/i386/pc.c         | 19 +++++++++++++++++++
 hw/i386/pc_piix.c    |  4 ++--
 hw/i386/pc_q35.c     |  3 ++-
 include/hw/i386/pc.h |  2 ++
 qemu-options.hx      |  3 +++
 vl.c                 |  4 ++++
 6 files changed, 32 insertions(+), 3 deletions(-)
hw/i386/pc.c +19 -0
index 82a7daa..8e37a99 100644
@@ -1687,6 +1687,20 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
     pcms->max_ram_below_4g = value;
 }
 
+static bool pc_machine_get_vmport(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->vmport;
+}
+
+static void pc_machine_set_vmport(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->vmport = value;
+}
+
 static void pc_machine_initfn(Object *obj)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1699,6 +1713,11 @@ static void pc_machine_initfn(Object *obj)
                         pc_machine_get_max_ram_below_4g,
                         pc_machine_set_max_ram_below_4g,
                         NULL, NULL, NULL);
+    pcms->vmport = !xen_enabled();
+    object_property_add_bool(obj, PC_MACHINE_VMPORT,
+                             pc_machine_get_vmport,
+                             pc_machine_set_vmport,
+                             NULL);
 }
 
 static void pc_machine_class_init(ObjectClass *oc, void *data)
hw/i386/pc_piix.c +2 -2
index 103d756..03a73ce 100644
@@ -234,8 +234,8 @@ static void pc_init1(MachineState *machine,
     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
 
     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
-        0x4);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0x4);
 
     pc_nic_init(isa_bus, pci_bus);
 
hw/i386/pc_q35.c +2 -1
index d4a907c..c5ba93d 100644
@@ -241,7 +241,8 @@ static void pc_q35_init(MachineState *machine)
     pc_register_ferr_irq(gsi[13]);
 
     /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0xff0104);
 
     /* connect pm stuff to lpc */
     ich9_lpc_pm_init(lpc);
include/hw/i386/pc.h +2 -0
index 77316d5..96febb9 100644
@@ -35,11 +35,13 @@ struct PCMachineState {
     HotplugHandler *acpi_dev;
 
     uint64_t max_ram_below_4g;
+    bool vmport;
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
 #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
+#define PC_MACHINE_VMPORT           "vmport"
 
 /**
  * PCMachineClass:
qemu-options.hx +3 -0
index 365b56c..fe6b6e5 100644
@@ -33,6 +33,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "                property accel=accel1[:accel2[:...]] selects accelerator\n"
     "                supported accelerators are kvm, xen, tcg (default: tcg)\n"
     "                kernel_irqchip=on|off controls accelerated irqchip support\n"
+    "                vmport=on|off controls emulation of vmport (default: on)\n"
     "                kvm_shadow_mem=size of KVM shadow MMU\n"
     "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
     "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -51,6 +52,8 @@ than one accelerator specified, the next one is used if the previous one fails
 to initialize.
 @item kernel_irqchip=on|off
 Enables in-kernel irqchip support for the chosen accelerator when available.
+@item vmport=on|off
+Enables emulation of VMWare IO port, for vmmouse etc. (enabled by default)
 @item kvm_shadow_mem=size
 Defines the size of the KVM shadow MMU.
 @item dump-guest-core=on|off
vl.c +4 -0
index 9d2aaaf..26fa864 100644
@@ -389,6 +389,10 @@ static QemuOptsList qemu_machine_opts = {
             .name = PC_MACHINE_MAX_RAM_BELOW_4G,
             .type = QEMU_OPT_SIZE,
             .help = "maximum ram below the 4G boundary (32bit boundary)",
+        }, {
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_BOOL,
+            .help = "Enable vmport (pc & q35)",
         },{
             .name = "iommu",
             .type = QEMU_OPT_BOOL,
Signature · 1 line
1.8.4

I reviewed the code and compiled-tested it, but didn't run it since I've moved my ESXi server to baremetal *. You can add:

Rich.

* For other reasons: QEMU emulates vmxnet3, but it's quite unreliable when used with an ESXi hypervisor guest. I saw frequent random network disconnections.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
#4 lore raw

PATCH v2 1/1 -machine vmport=off: Allow disabling of VMWare ioport emulation

Do I need to repost with the 2 Reviewed-by ?
-Don Slutz

Quoted 153 lines · Richard W.M. Jones
Quoted 141 lines · Don Slutz

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our incomplete emulation of it's special IO Port. This adds a pc & q35 property to allow it to be turned off.

---
  hw/i386/pc.c         | 19 +++++++++++++++++++
  hw/i386/pc_piix.c    |  4 ++--
  hw/i386/pc_q35.c     |  3 ++-
  include/hw/i386/pc.h |  2 ++
  qemu-options.hx      |  3 +++
  vl.c                 |  4 ++++
  6 files changed, 32 insertions(+), 3 deletions(-)
hw/i386/pc.c +19 -0
index 82a7daa..8e37a99 100644
@@ -1687,6 +1687,20 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
      pcms->max_ram_below_4g = value;
  }
 
+static bool pc_machine_get_vmport(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->vmport;
+}
+
+static void pc_machine_set_vmport(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->vmport = value;
+}
+
  static void pc_machine_initfn(Object *obj)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
@@ -1699,6 +1713,11 @@ static void pc_machine_initfn(Object *obj)
                          pc_machine_get_max_ram_below_4g,
                          pc_machine_set_max_ram_below_4g,
                          NULL, NULL, NULL);
+    pcms->vmport = !xen_enabled();
+    object_property_add_bool(obj, PC_MACHINE_VMPORT,
+                             pc_machine_get_vmport,
+                             pc_machine_set_vmport,
+                             NULL);
  }
 
  static void pc_machine_class_init(ObjectClass *oc, void *data)
hw/i386/pc_piix.c +2 -2
index 103d756..03a73ce 100644
@@ -234,8 +234,8 @@ static void pc_init1(MachineState *machine,
      pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
 
      /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
-        0x4);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0x4);
 
      pc_nic_init(isa_bus, pci_bus);
 
hw/i386/pc_q35.c +2 -1
index d4a907c..c5ba93d 100644
@@ -241,7 +241,8 @@ static void pc_q35_init(MachineState *machine)
      pc_register_ferr_irq(gsi[13]);
 
      /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0xff0104);
 
      /* connect pm stuff to lpc */
      ich9_lpc_pm_init(lpc);
include/hw/i386/pc.h +2 -0
index 77316d5..96febb9 100644
@@ -35,11 +35,13 @@ struct PCMachineState {
      HotplugHandler *acpi_dev;
 
      uint64_t max_ram_below_4g;
+    bool vmport;
  };
 
  #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
  #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
  #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
+#define PC_MACHINE_VMPORT           "vmport"
 
  /**
   * PCMachineClass:
qemu-options.hx +3 -0
index 365b56c..fe6b6e5 100644
@@ -33,6 +33,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
      "                property accel=accel1[:accel2[:...]] selects accelerator\n"
      "                supported accelerators are kvm, xen, tcg (default: tcg)\n"
      "                kernel_irqchip=on|off controls accelerated irqchip support\n"
+    "                vmport=on|off controls emulation of vmport (default: on)\n"
      "                kvm_shadow_mem=size of KVM shadow MMU\n"
      "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
      "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -51,6 +52,8 @@ than one accelerator specified, the next one is used if the previous one fails
  to initialize.
  @item kernel_irqchip=on|off
  Enables in-kernel irqchip support for the chosen accelerator when available.
+@item vmport=on|off
+Enables emulation of VMWare IO port, for vmmouse etc. (enabled by default)
  @item kvm_shadow_mem=size
  Defines the size of the KVM shadow MMU.
  @item dump-guest-core=on|off
vl.c +4 -0
index 9d2aaaf..26fa864 100644
@@ -389,6 +389,10 @@ static QemuOptsList qemu_machine_opts = {
              .name = PC_MACHINE_MAX_RAM_BELOW_4G,
              .type = QEMU_OPT_SIZE,
              .help = "maximum ram below the 4G boundary (32bit boundary)",
+        }, {
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_BOOL,
+            .help = "Enable vmport (pc & q35)",
          },{
              .name = "iommu",
              .type = QEMU_OPT_BOOL,
Signature · 1 line
1.8.4

I reviewed the code and compiled-tested it, but didn't run it since I've moved my ESXi server to baremetal *. You can add:

Rich.

* For other reasons: QEMU emulates vmxnet3, but it's quite unreliable when used with an ESXi hypervisor guest. I saw frequent random network disconnections.

#5 lore raw

Il 15/10/2014 23:20, Slutz, Donald Christopher ha scritto:

Quoted 1 line

Do I need to repost with the 2 Reviewed-by ?

No, I'll attend to this as soon as I get back home.

Paolo

Quoted 154 lines · Richard W.M. Jones
Quoted 153 lines · Don Slutz
Quoted 141 lines

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our incomplete emulation of it's special IO Port. This adds a pc & q35 property to allow it to be turned off.

---
  hw/i386/pc.c         | 19 +++++++++++++++++++
  hw/i386/pc_piix.c    |  4 ++--
  hw/i386/pc_q35.c     |  3 ++-
  include/hw/i386/pc.h |  2 ++
  qemu-options.hx      |  3 +++
  vl.c                 |  4 ++++
  6 files changed, 32 insertions(+), 3 deletions(-)
hw/i386/pc.c +19 -0
index 82a7daa..8e37a99 100644
@@ -1687,6 +1687,20 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v,
      pcms->max_ram_below_4g = value;
  }
 
+static bool pc_machine_get_vmport(Object *obj, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    return pcms->vmport;
+}
+
+static void pc_machine_set_vmport(Object *obj, bool value, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    pcms->vmport = value;
+}
+
  static void pc_machine_initfn(Object *obj)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
@@ -1699,6 +1713,11 @@ static void pc_machine_initfn(Object *obj)
                          pc_machine_get_max_ram_below_4g,
                          pc_machine_set_max_ram_below_4g,
                          NULL, NULL, NULL);
+    pcms->vmport = !xen_enabled();
+    object_property_add_bool(obj, PC_MACHINE_VMPORT,
+                             pc_machine_get_vmport,
+                             pc_machine_set_vmport,
+                             NULL);
  }
 
  static void pc_machine_class_init(ObjectClass *oc, void *data)
hw/i386/pc_piix.c +2 -2
index 103d756..03a73ce 100644
@@ -234,8 +234,8 @@ static void pc_init1(MachineState *machine,
      pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
 
      /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
-        0x4);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0x4);
 
      pc_nic_init(isa_bus, pci_bus);
 
hw/i386/pc_q35.c +2 -1
index d4a907c..c5ba93d 100644
@@ -241,7 +241,8 @@ static void pc_q35_init(MachineState *machine)
      pc_register_ferr_irq(gsi[13]);
 
      /* init basic PC hardware */
-    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
+    pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
+                         !pc_machine->vmport, 0xff0104);
 
      /* connect pm stuff to lpc */
      ich9_lpc_pm_init(lpc);
include/hw/i386/pc.h +2 -0
index 77316d5..96febb9 100644
@@ -35,11 +35,13 @@ struct PCMachineState {
      HotplugHandler *acpi_dev;
 
      uint64_t max_ram_below_4g;
+    bool vmport;
  };
 
  #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
  #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
  #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
+#define PC_MACHINE_VMPORT           "vmport"
 
  /**
   * PCMachineClass:
qemu-options.hx +3 -0
index 365b56c..fe6b6e5 100644
@@ -33,6 +33,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
      "                property accel=accel1[:accel2[:...]] selects accelerator\n"
      "                supported accelerators are kvm, xen, tcg (default: tcg)\n"
      "                kernel_irqchip=on|off controls accelerated irqchip support\n"
+    "                vmport=on|off controls emulation of vmport (default: on)\n"
      "                kvm_shadow_mem=size of KVM shadow MMU\n"
      "                dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
      "                mem-merge=on|off controls memory merge support (default: on)\n"
@@ -51,6 +52,8 @@ than one accelerator specified, the next one is used if the previous one fails
  to initialize.
  @item kernel_irqchip=on|off
  Enables in-kernel irqchip support for the chosen accelerator when available.
+@item vmport=on|off
+Enables emulation of VMWare IO port, for vmmouse etc. (enabled by default)
  @item kvm_shadow_mem=size
  Defines the size of the KVM shadow MMU.
  @item dump-guest-core=on|off
vl.c +4 -0
index 9d2aaaf..26fa864 100644
@@ -389,6 +389,10 @@ static QemuOptsList qemu_machine_opts = {
              .name = PC_MACHINE_MAX_RAM_BELOW_4G,
              .type = QEMU_OPT_SIZE,
              .help = "maximum ram below the 4G boundary (32bit boundary)",
+        }, {
+            .name = PC_MACHINE_VMPORT,
+            .type = QEMU_OPT_BOOL,
+            .help = "Enable vmport (pc & q35)",
          },{
              .name = "iommu",
              .type = QEMU_OPT_BOOL,
Signature · 1 line
1.8.4

I reviewed the code and compiled-tested it, but didn't run it since I've moved my ESXi server to baremetal *. You can add:

Rich.

* For other reasons: QEMU emulates vmxnet3, but it's quite unreliable when used with an ESXi hypervisor guest. I saw frequent random network disconnections.

Reviewed-by on v2 1/1
#6 lore raw
In reply to Don Slutz
Quoted 10 lines · Don Slutz

From: "Dr. David Alan Gilbert" <[email protected]>

This is a pc & q35 only machine opt.

VMWare apparently doesn't like running under QEMU due to our incomplete emulation of it's special IO Port. This adds a pc & q35 property to allow it to be turned off.

Signature · 1 line
Eduardo
#7 lore raw
In reply to Don Slutz
Quoted 5 lines · * Don Slutz ([email protected]) wrote:

Changes v1 to v2 (Don Slutz):
make vmport a pc & q35 only machine opt I.E. a machine property.

Dr. David Alan Gilbert (1):
-machine vmport=off: Allow disabling of VMWare ioport emulation

Thanks for updating this!

Dave

Quoted 12 lines
 hw/i386/pc.c         | 19 +++++++++++++++++++
 hw/i386/pc_piix.c    |  4 ++--
 hw/i386/pc_q35.c     |  3 ++-
 include/hw/i386/pc.h |  2 ++
 qemu-options.hx      |  3 +++
 vl.c                 |  4 ++++
 6 files changed, 32 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.4

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK