* [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen
@ 2014-11-20 18:21 Don Slutz
2014-11-20 19:05 ` Eduardo Habkost
2014-11-20 19:46 ` Eric Blake
0 siblings, 2 replies; 4+ messages in thread
From: Don Slutz @ 2014-11-20 18:21 UTC (permalink / raw)
To: qemu-devel, Dr. David Alan Gilbert, Michael S. Tsirkin,
Paolo Bonzini, Eduardo Habkost, Eric Blake
Cc: Don Slutz, Michael Tokarev, Anthony Liguori, Stefan Hajnoczi
c/s 9b23cfb76b3a5e9eb5cc899eaf2f46bc46d33ba4
or
c/s b154537ad07598377ebf98252fb7d2aff127983b
moved the testing of xen_enabled() from pc_init1() to
pc_machine_initfn().
xen_enabled() does not return the correct value in
pc_machine_initfn().
Changed vmport from a bool to an enum. Added the value "auto" to do
the old way.
Signed-off-by: Don Slutz <dslutz@verizon.com>
---
v4:
Michael S. Tsirkin, Eric Blake, Eduardo Habkost:
Rename vmport to OnOffAuto and move to qapi/common.json
Eduardo Habkost:
Simpler convert of enum to no_vmport.
Michael S. Tsirkin:
Add assert for ON_OFF_AUTO_MAX.
hw/i386/pc.c | 23 ++++++++++++++---------
hw/i386/pc_piix.c | 10 +++++++++-
hw/i386/pc_q35.c | 10 +++++++++-
include/hw/i386/pc.h | 2 +-
qapi/common.json | 15 +++++++++++++++
qemu-options.hx | 8 +++++---
vl.c | 2 +-
7 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 1205db8..15fba60 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1711,18 +1711,23 @@ 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)
+static void pc_machine_get_vmport(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
+ int vmport = pcms->vmport;
- return pcms->vmport;
+ visit_type_enum(v, &vmport, OnOffAuto_lookup, NULL, name, errp);
}
-static void pc_machine_set_vmport(Object *obj, bool value, Error **errp)
+static void pc_machine_set_vmport(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
{
PCMachineState *pcms = PC_MACHINE(obj);
+ int vmport;
- pcms->vmport = value;
+ visit_type_enum(v, &vmport, OnOffAuto_lookup, NULL, name, errp);
+ pcms->vmport = vmport;
}
static void pc_machine_initfn(Object *obj)
@@ -1737,11 +1742,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);
+ pcms->vmport = ON_OFF_AUTO_AUTO;
+ object_property_add(obj, PC_MACHINE_VMPORT, "str",
+ pc_machine_get_vmport,
+ pc_machine_set_vmport,
+ NULL, NULL, NULL);
}
static void pc_machine_class_init(ObjectClass *oc, void *data)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7bb97a4..6771979 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -101,6 +101,7 @@ static void pc_init1(MachineState *machine,
FWCfgState *fw_cfg = NULL;
PcGuestInfo *guest_info;
ram_addr_t lowmem;
+ bool no_vmport;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
* If it doesn't, we need to split it in chunks below and above 4G.
@@ -234,9 +235,16 @@ static void pc_init1(MachineState *machine,
pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
+ assert(pc_machine->vmport != ON_OFF_AUTO_MAX);
+ if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {
+ no_vmport = xen_enabled();
+ } else {
+ no_vmport = (pc_machine->vmport != ON_OFF_AUTO_ON);
+ }
+
/* init basic PC hardware */
pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
- !pc_machine->vmport, 0x4);
+ no_vmport, 0x4);
pc_nic_init(isa_bus, pci_bus);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 598e679..6f25868 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -88,6 +88,7 @@ static void pc_q35_init(MachineState *machine)
PcGuestInfo *guest_info;
ram_addr_t lowmem;
DriveInfo *hd[MAX_SATA_PORTS];
+ bool no_vmport;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
* and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
@@ -242,9 +243,16 @@ static void pc_q35_init(MachineState *machine)
pc_register_ferr_irq(gsi[13]);
+ assert(pc_machine->vmport != ON_OFF_AUTO_MAX);
+ if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {
+ no_vmport = xen_enabled();
+ } else {
+ no_vmport = (pc_machine->vmport != ON_OFF_AUTO_ON);
+ }
+
/* init basic PC hardware */
pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
- !pc_machine->vmport, 0xff0104);
+ no_vmport, 0xff0104);
/* connect pm stuff to lpc */
ich9_lpc_pm_init(lpc);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 7c3731f..7f7d2d4 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -37,7 +37,7 @@ struct PCMachineState {
ISADevice *rtc;
uint64_t max_ram_below_4g;
- bool vmport;
+ OnOffAuto vmport;
};
#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
diff --git a/qapi/common.json b/qapi/common.json
index 4e9a21f..63ef3b4 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -87,3 +87,18 @@
##
{ 'command': 'query-commands', 'returns': ['CommandInfo'] }
+##
+# @OnOffAuto
+#
+# An enumeration of three options: on, off, and auto
+#
+# @auto: QEMU selects the value between on and off
+#
+# @on: Enabled
+#
+# @off: Disabled
+#
+# Since: 2.2
+##
+{ 'enum': 'OnOffAuto',
+ 'data': [ 'auto', 'on', 'off' ] }
diff --git a/qemu-options.hx b/qemu-options.hx
index da9851d..64af16d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -33,7 +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"
+ " vmport=on|off|auto controls emulation of vmport (default: auto)\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"
@@ -52,8 +52,10 @@ 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 vmport=on|off|auto
+Enables emulation of VMWare IO port, for vmmouse etc. auto says to select the
+value based on accel. For accel=xen the default is off otherwise the default
+is on.
@item kvm_shadow_mem=size
Defines the size of the KVM shadow MMU.
@item dump-guest-core=on|off
diff --git a/vl.c b/vl.c
index f4a6e5e..eb89d62 100644
--- a/vl.c
+++ b/vl.c
@@ -381,7 +381,7 @@ static QemuOptsList qemu_machine_opts = {
.help = "maximum ram below the 4G boundary (32bit boundary)",
}, {
.name = PC_MACHINE_VMPORT,
- .type = QEMU_OPT_BOOL,
+ .type = QEMU_OPT_STRING,
.help = "Enable vmport (pc & q35)",
},{
.name = "iommu",
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen
2014-11-20 18:21 [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen Don Slutz
@ 2014-11-20 19:05 ` Eduardo Habkost
2014-11-20 19:09 ` Don Slutz
2014-11-20 19:46 ` Eric Blake
1 sibling, 1 reply; 4+ messages in thread
From: Eduardo Habkost @ 2014-11-20 19:05 UTC (permalink / raw)
To: Don Slutz
Cc: Anthony Liguori, Michael S. Tsirkin, Michael Tokarev, qemu-devel,
Dr. David Alan Gilbert, Stefan Hajnoczi, Paolo Bonzini
On Thu, Nov 20, 2014 at 01:21:18PM -0500, Don Slutz wrote:
[...]
> @@ -242,9 +243,16 @@ static void pc_q35_init(MachineState *machine)
>
> pc_register_ferr_irq(gsi[13]);
>
> + assert(pc_machine->vmport != ON_OFF_AUTO_MAX);
> + if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {
> + no_vmport = xen_enabled();
> + } else {
> + no_vmport = (pc_machine->vmport != ON_OFF_AUTO_ON);
> + }
> +
> /* init basic PC hardware */
> pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
> - !pc_machine->vmport, 0xff0104);
> + no_vmport, 0xff0104);
>
Sorry for suggesting yet another change, but: what about changing
pc_machine->vmport here instead of using a no_vmport variable, so the
actual vmport configuration may be queried by anybody later using the
QOM property? It would even make the code shorter.
I mean:
if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {
pc_machine->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON);
}
pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
(pc_machine->vmport != ON_OFF_AUTO_ON), 0xff0104);
--
Eduardo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen
2014-11-20 19:05 ` Eduardo Habkost
@ 2014-11-20 19:09 ` Don Slutz
0 siblings, 0 replies; 4+ messages in thread
From: Don Slutz @ 2014-11-20 19:09 UTC (permalink / raw)
To: Eduardo Habkost, Don Slutz
Cc: Anthony Liguori, Michael S. Tsirkin, Michael Tokarev, qemu-devel,
Dr. David Alan Gilbert, Stefan Hajnoczi, Paolo Bonzini
On 11/20/14 14:05, Eduardo Habkost wrote:
> On Thu, Nov 20, 2014 at 01:21:18PM -0500, Don Slutz wrote:
> [...]
>> @@ -242,9 +243,16 @@ static void pc_q35_init(MachineState *machine)
>>
>> pc_register_ferr_irq(gsi[13]);
>>
>> + assert(pc_machine->vmport != ON_OFF_AUTO_MAX);
>> + if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {
>> + no_vmport = xen_enabled();
>> + } else {
>> + no_vmport = (pc_machine->vmport != ON_OFF_AUTO_ON);
>> + }
>> +
>> /* init basic PC hardware */
>> pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
>> - !pc_machine->vmport, 0xff0104);
>> + no_vmport, 0xff0104);
>>
> Sorry for suggesting yet another change, but: what about changing
> pc_machine->vmport here instead of using a no_vmport variable, so the
> actual vmport configuration may be queried by anybody later using the
> QOM property? It would even make the code shorter.
>
> I mean:
>
> if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {
> pc_machine->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON);
> }
> pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy,
> (pc_machine->vmport != ON_OFF_AUTO_ON), 0xff0104);
>
>
Look better to me also. So will adjust the patch.
-Don Slutz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen
2014-11-20 18:21 [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen Don Slutz
2014-11-20 19:05 ` Eduardo Habkost
@ 2014-11-20 19:46 ` Eric Blake
1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2014-11-20 19:46 UTC (permalink / raw)
To: Don Slutz, qemu-devel, Dr. David Alan Gilbert, Michael S. Tsirkin,
Paolo Bonzini, Eduardo Habkost
Cc: Michael Tokarev, Anthony Liguori, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]
On 11/20/2014 11:21 AM, Don Slutz wrote:
> c/s 9b23cfb76b3a5e9eb5cc899eaf2f46bc46d33ba4
>
> or
>
> c/s b154537ad07598377ebf98252fb7d2aff127983b
>
> moved the testing of xen_enabled() from pc_init1() to
> pc_machine_initfn().
>
> xen_enabled() does not return the correct value in
> pc_machine_initfn().
>
> Changed vmport from a bool to an enum. Added the value "auto" to do
> the old way.
>
> Signed-off-by: Don Slutz <dslutz@verizon.com>
> ---
>
> v4:
> Michael S. Tsirkin, Eric Blake, Eduardo Habkost:
> Rename vmport to OnOffAuto and move to qapi/common.json
> Eduardo Habkost:
> Simpler convert of enum to no_vmport.
> Michael S. Tsirkin:
> Add assert for ON_OFF_AUTO_MAX.
>
> hw/i386/pc.c | 23 ++++++++++++++---------
> hw/i386/pc_piix.c | 10 +++++++++-
> hw/i386/pc_q35.c | 10 +++++++++-
> include/hw/i386/pc.h | 2 +-
> qapi/common.json | 15 +++++++++++++++
> qemu-options.hx | 8 +++++---
> vl.c | 2 +-
> 7 files changed, 54 insertions(+), 16 deletions(-)
I've only reviewed the qapi/common.json and qemu-options.hx files for
QMP interface (and will leave the rest of the patch to others), but I'm
okay with the changes to those files. I guess that means no R-b, since I
didn't do a full review, so here's a weaker:
Acked-by: Eric Blake <eblake@redhat.com>
if you think it is worth adding.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-20 19:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 18:21 [Qemu-devel] [BUGFIX][PATCH for 2.2 v4 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen Don Slutz
2014-11-20 19:05 ` Eduardo Habkost
2014-11-20 19:09 ` Don Slutz
2014-11-20 19:46 ` Eric Blake
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).