OSDN Git Service

qmiga/qemu.git
9 years agoglib: add compatibility interface for g_get_monotonic_time()
Stefan Hajnoczi [Wed, 15 Oct 2014 12:29:30 +0000 (14:29 +0200)]
glib: add compatibility interface for g_get_monotonic_time()

This patch fixes compilation errors when building against glib <2.28.0
due to the missing g_get_monotonic_time() function.

The compilation error in tests/libqos/virtio.c was introduced in commit
70556264a89a268efba1d7e8e341adcdd7881eb4 ("libqos: use microseconds
instead of iterations for virtio timeout").

Add a simple g_get_monotonic_time() implementation to glib-compat.h
based on code from vhost-user-test.c.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
[Igor: add G_TIME_SPAN_SECOND, include glib-compat.h in libqtest.h]
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20141015' into...
Peter Maydell [Wed, 15 Oct 2014 10:55:53 +0000 (11:55 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20141015' into staging

migration/next for 20141015

# gpg: Signature made Wed 15 Oct 2014 09:21:54 BST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20141015:
  migration: catch unknown flag combinations in ram_load
  qemu-file: Move stdio implementation to qemu-file-stdio.c
  qemu-file: Move unix and socket implementations to qemu-file-unix.c
  qemu-file: Use qemu_file_is_writable() on stdio_fclose()
  qemu-file: Make qemu_file_is_writable() non-static
  qemu-file: Add copyright header to qemu-file.c
  vmstate: Allow dynamic allocation for VBUFFER during migration
  block/migration: Disable cache invalidate for incoming migration
  Tests: QEMUSizedBuffer/QEMUBuffer
  QEMUSizedBuffer based QEMUFile

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
Peter Maydell [Wed, 15 Oct 2014 07:12:53 +0000 (08:12 +0100)]
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging

QOM infrastructure fixes and device conversions

* GPIO conversion to QOM, continued
* Device property description support
* QTest cases for hotplug
* Hotplug handler conversion

# gpg: Signature made Wed 15 Oct 2014 04:05:17 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-devices-for-peter: (47 commits)
  qdev: Drop legacy_name from qdev properties
  qmp: Print descriptions of object properties
  qdev: Set the object property's description to the qdev property's.
  qom: Add description field in ObjectProperty struct
  qdev: Add description field in PropertyInfo struct
  qdev: device_del: Search for to be unplugged device in 'peripheral' container
  qdev: HotplugHandler: Add support for unplugging BUS-less devices
  qdev: Drop legacy hotplug fields/methods
  usb: Convert usb devices to hotplug handler API
  usb: Convert usb-ccid to hotplug handler API
  usb-storage: Drop not needed "allow_hotplug = 0"
  usb-bot: Drop not needed "allow_hotplug = 0"
  usb-bot: Mark device as non hotpluggable
  scsi: Cleanup not used anymore SCSIBusInfo{hotplug, hot_unplug} fields
  scsi: Convert virtio-scsi HBA to hotplug handler API
  scsi: Convert pvscsi HBA to hotplug handler API
  scsi: Set SCSI BUS itself as default HotplugHandler
  s390x: Convert virtio-ccw to hotplug handler API
  s390x: Convert s390-virtio to hotplug handler API
  s390x: Drop not used allow_hotplug in event-facility
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoqdev: Drop legacy_name from qdev properties
Gonglei [Tue, 7 Oct 2014 06:33:24 +0000 (14:33 +0800)]
qdev: Drop legacy_name from qdev properties

The legacy_name is useless now, better help
information is provided by description field of property.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqmp: Print descriptions of object properties
Gonglei [Tue, 7 Oct 2014 06:33:23 +0000 (14:33 +0800)]
qmp: Print descriptions of object properties

Add a new "description" field to DevicePropertyInfo.
The descriptions can serve as documentation in the code,
and they can be used to provide better help. For example:

$./qemu-system-x86_64 -device virtio-blk-pci,?

Before this patch:

virtio-blk-pci.iothread=link<iothread>
virtio-blk-pci.x-data-plane=bool
virtio-blk-pci.scsi=bool
virtio-blk-pci.config-wce=bool
virtio-blk-pci.serial=str
virtio-blk-pci.secs=uint32
virtio-blk-pci.heads=uint32
virtio-blk-pci.cyls=uint32
virtio-blk-pci.discard_granularity=uint32
virtio-blk-pci.bootindex=int32
virtio-blk-pci.opt_io_size=uint32
virtio-blk-pci.min_io_size=uint16
virtio-blk-pci.physical_block_size=uint16
virtio-blk-pci.logical_block_size=uint16
virtio-blk-pci.drive=str
virtio-blk-pci.virtio-backend=child<virtio-blk-device>
virtio-blk-pci.command_serr_enable=on/off
virtio-blk-pci.multifunction=on/off
virtio-blk-pci.rombar=uint32
virtio-blk-pci.romfile=str
virtio-blk-pci.addr=pci-devfn
virtio-blk-pci.event_idx=on/off
virtio-blk-pci.indirect_desc=on/off
virtio-blk-pci.vectors=uint32
virtio-blk-pci.ioeventfd=on/off
virtio-blk-pci.class=uint32

After:

virtio-blk-pci.iothread=link<iothread>
virtio-blk-pci.x-data-plane=bool (on/off)
virtio-blk-pci.scsi=bool (on/off)
virtio-blk-pci.config-wce=bool (on/off)
virtio-blk-pci.serial=str
virtio-blk-pci.secs=uint32
virtio-blk-pci.heads=uint32
virtio-blk-pci.cyls=uint32
virtio-blk-pci.discard_granularity=uint32
virtio-blk-pci.bootindex=int32
virtio-blk-pci.opt_io_size=uint32
virtio-blk-pci.min_io_size=uint16
virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and 32768)
virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and 32768)
virtio-blk-pci.drive=str (ID of a drive to use as a backend)
virtio-blk-pci.virtio-backend=child<virtio-blk-device>
virtio-blk-pci.command_serr_enable=bool (on/off)
virtio-blk-pci.multifunction=bool (on/off)
virtio-blk-pci.rombar=uint32
virtio-blk-pci.romfile=str
virtio-blk-pci.addr=int32 (Slot and optional function number, example: 06.0 or 06)
virtio-blk-pci.event_idx=bool (on/off)
virtio-blk-pci.indirect_desc=bool (on/off)
virtio-blk-pci.vectors=uint32
virtio-blk-pci.ioeventfd=bool (on/off)
virtio-blk-pci.class=uint32

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: Set the object property's description to the qdev property's.
Gonglei [Tue, 7 Oct 2014 06:33:22 +0000 (14:33 +0800)]
qdev: Set the object property's description to the qdev property's.

Set all static qdev properties' descriptions to object property's
description.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqom: Add description field in ObjectProperty struct
Gonglei [Tue, 7 Oct 2014 06:33:21 +0000 (14:33 +0800)]
qom: Add description field in ObjectProperty struct

The descriptions can serve as documentation in the code,
and they can be used to provide better help.

Copy property descriptions when copying alias properties.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: Add description field in PropertyInfo struct
Gonglei [Tue, 7 Oct 2014 06:33:20 +0000 (14:33 +0800)]
qdev: Add description field in PropertyInfo struct

The descriptions can serve as documentation in the code,
and they can be used to provide better help.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: device_del: Search for to be unplugged device in 'peripheral' container
Igor Mammedov [Thu, 2 Oct 2014 10:08:45 +0000 (10:08 +0000)]
qdev: device_del: Search for to be unplugged device in 'peripheral' container

device_add puts every device with 'id' inside of 'peripheral'
container using id's value as the last component name.
Use it by replacing recursive search on sysbus with path
lookup in 'peripheral' container, which could handle both
BUS and BUS-less device cases.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: HotplugHandler: Add support for unplugging BUS-less devices
Igor Mammedov [Fri, 26 Sep 2014 09:28:41 +0000 (09:28 +0000)]
qdev: HotplugHandler: Add support for unplugging BUS-less devices

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: Drop legacy hotplug fields/methods
Igor Mammedov [Fri, 26 Sep 2014 09:28:40 +0000 (09:28 +0000)]
qdev: Drop legacy hotplug fields/methods

It removes not needed anymore BusState::allow_hotplug field and
DeviceClass::unplug callback.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agousb: Convert usb devices to hotplug handler API
Igor Mammedov [Fri, 26 Sep 2014 09:28:39 +0000 (09:28 +0000)]
usb: Convert usb devices to hotplug handler API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agousb: Convert usb-ccid to hotplug handler API
Igor Mammedov [Fri, 26 Sep 2014 09:28:38 +0000 (09:28 +0000)]
usb: Convert usb-ccid to hotplug handler API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agousb-storage: Drop not needed "allow_hotplug = 0"
Igor Mammedov [Fri, 26 Sep 2014 09:28:37 +0000 (09:28 +0000)]
usb-storage: Drop not needed "allow_hotplug = 0"

Drop useless hack that disables hotplug on bus, after backend
storage was added to it, by setting "allow_hotplug = 0". Even
if bus is hotpluggable, it won't be possible to add another
SCSI device to bus since its realize will fail early with
error "no free target" in scsi_qdev_realize() method.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agousb-bot: Drop not needed "allow_hotplug = 0"
Igor Mammedov [Fri, 26 Sep 2014 09:28:36 +0000 (09:28 +0000)]
usb-bot: Drop not needed "allow_hotplug = 0"

Drop useless hack that disables hotplug on bus by setting
"allow_hotplug = 0". Even if bus is hotpluggable, It won't
be possible to add another SCSI device to bus since its
realization will fail early with error "no free target"
in scsi_qdev_realize() method.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agousb-bot: Mark device as non hotpluggable
Igor Mammedov [Fri, 26 Sep 2014 09:28:35 +0000 (09:28 +0000)]
usb-bot: Mark device as non hotpluggable

usb-bot creates SCSI bus and immediately makes it
non hotpluggable which was making not possible to
hotplug usb-bot since QEMU would abort at
bus_add_child(scsi-hd) time when usb-bot is
realized.

Mark usb-bot as not hotpluggable so that attempt
to hotplug it would error out even before it gets
to device initialization point.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoscsi: Cleanup not used anymore SCSIBusInfo{hotplug, hot_unplug} fields
Igor Mammedov [Fri, 26 Sep 2014 09:28:34 +0000 (09:28 +0000)]
scsi: Cleanup not used anymore SCSIBusInfo{hotplug, hot_unplug} fields

SCSI subsytem was converted to hotplug handler API and
doesn't use SCSIBusInfo{hotplug, hot_unplug} fields and
related callbacks anymore.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoscsi: Convert virtio-scsi HBA to hotplug handler API
Igor Mammedov [Fri, 26 Sep 2014 09:28:33 +0000 (09:28 +0000)]
scsi: Convert virtio-scsi HBA to hotplug handler API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoscsi: Convert pvscsi HBA to hotplug handler API
Igor Mammedov [Fri, 26 Sep 2014 09:28:32 +0000 (09:28 +0000)]
scsi: Convert pvscsi HBA to hotplug handler API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoscsi: Set SCSI BUS itself as default HotplugHandler
Igor Mammedov [Fri, 26 Sep 2014 09:28:31 +0000 (09:28 +0000)]
scsi: Set SCSI BUS itself as default HotplugHandler

That would allow to handle SCSI device unplug
on HBAs without dedicated hot(un)plug handlers
and avoid making such HBAs explicitly hotpluggable.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agos390x: Convert virtio-ccw to hotplug handler API
Igor Mammedov [Fri, 26 Sep 2014 09:28:30 +0000 (09:28 +0000)]
s390x: Convert virtio-ccw to hotplug handler API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agos390x: Convert s390-virtio to hotplug handler API
Igor Mammedov [Fri, 26 Sep 2014 12:37:30 +0000 (12:37 +0000)]
s390x: Convert s390-virtio to hotplug handler API

Beside of conversion, patch drops present unplug
handling, effectively disabling hot-unplug of
s390-virtio devices.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agos390x: Drop not used allow_hotplug in event-facility
Igor Mammedov [Fri, 26 Sep 2014 09:28:28 +0000 (09:28 +0000)]
s390x: Drop not used allow_hotplug in event-facility

s390-sclp-event-facility creates s390-sclp-events-bus
and immediately sets its allow_hotplug field to 0,
which is NOP since it's already 0 by default.

Also since BUS is not hotpluggable, it's not possible
to call SCLP_EVENT{ DeviceClass::unplug } callback
from qdev_unplug() making this unreachable code,
so drop it as well.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agovirtio-mmio: Drop useless bus->allow_hotplug = 0
Igor Mammedov [Fri, 26 Sep 2014 09:28:27 +0000 (09:28 +0000)]
virtio-mmio: Drop useless bus->allow_hotplug = 0

Bus by default is not hotpluggable.
virtio-mmio-bus and its parent types do not set allow_hotplug
anywhere explicitly, so remove not needed field access
and wrapper along with it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agovirtio-serial: Convert to hotplug-handler API
Igor Mammedov [Fri, 26 Sep 2014 09:28:26 +0000 (09:28 +0000)]
virtio-serial: Convert to hotplug-handler API

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agovirtio-pci: Drop BusState::allow_hotplug
Igor Mammedov [Fri, 26 Sep 2014 09:28:25 +0000 (09:28 +0000)]
virtio-pci: Drop BusState::allow_hotplug

virtio-pci-bus is an internal object of composite
virtio-pci device and it doesn't participate in
-device/device_add hotplug flow, and since it's
not required by bus_add_child() that BUS must
be hotpluggable to be able to add child at runtime,
it's possible to drop not needed 'allow_hotplug'
field.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotarget-i386: ICC bus: Drop BusState::allow_hotplug
Igor Mammedov [Fri, 26 Sep 2014 09:28:24 +0000 (09:28 +0000)]
target-i386: ICC bus: Drop BusState::allow_hotplug

Since bus_add_child() no longer cares if BUS is hotpluggable
or not, there is no need in setting allow_hotplug field.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: Drop hotplug check from bus_add_child()
Igor Mammedov [Fri, 26 Sep 2014 09:28:23 +0000 (09:28 +0000)]
qdev: Drop hotplug check from bus_add_child()

Check is too restrictive and does not allow
to add children to just created bus during hotplug
when the bus is part of composite device.

Removing check from bus_add_child() doesn't affect
devices creatable with device_add/del commands since
they have a similar builtin check and patch will
allow to create complex composite devices during
hotplug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: Add wrapper to set BUS as HotplugHandler
Igor Mammedov [Fri, 26 Sep 2014 09:28:22 +0000 (09:28 +0000)]
qdev: Add wrapper to set BUS as HotplugHandler

To be used for conversion of SCSI and USB devices,
and would allow to make every HBA/USB host switch
to HotplugHandler API without touching each controller
explicitly.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: Add simple/generic unplug callback for HotplugHandler
Igor Mammedov [Fri, 26 Sep 2014 09:28:21 +0000 (09:28 +0000)]
qdev: Add simple/generic unplug callback for HotplugHandler

It will be used in shallow conversion from legacy hotplug
mechanism and eventually replace all the uses of old mechanism
DeviceClass::unplug = qdev_simple_unplug_cb()

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: HotplugHandler: Provide unplug callback
Igor Mammedov [Fri, 26 Sep 2014 09:28:20 +0000 (09:28 +0000)]
qdev: HotplugHandler: Provide unplug callback

It is to be called for actual device removal and
will allow to separate request and removal handling
phases of x86-CPU devices and also it's a handler
to be called for synchronously removable devices.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: HotplugHandler: Rename unplug callback to unplug_request
Igor Mammedov [Fri, 26 Sep 2014 09:28:19 +0000 (09:28 +0000)]
qdev: HotplugHandler: Rename unplug callback to unplug_request

'HotplugHandler.unplug' callback is currently used as async
call to issue unplug request for device that implements it.
Renaming 'unplug' callback to 'unplug_request' should help to
avoid confusion about what callback does and would allow to
introduce 'unplug' callback that would perform actual device
removal when guest is ready for it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: do not allow to instantiate non hotpluggable device with device_add
Igor Mammedov [Fri, 26 Sep 2014 09:28:18 +0000 (09:28 +0000)]
qdev: do not allow to instantiate non hotpluggable device with device_add

It will allow explicitly mark device as not hotpluggable and
avoid its creation with following error at realize time
and destroying it afterwards anyway. Instead of it will
error out even before instance of device is created.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoAccess BusState::allow_hotplug using wraper qbus_is_hotpluggable()
Igor Mammedov [Fri, 26 Sep 2014 09:28:17 +0000 (09:28 +0000)]
Access BusState::allow_hotplug using wraper qbus_is_hotpluggable()

It would allow to transparently switch detection whether Bus
is hotpluggable from allow_hotplug field to hotplug_handler
link and to drop allow_hotplug field once all users are
converted to hotplug handler API.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: usb: usb-uas hotplug test
Igor Mammedov [Fri, 26 Sep 2014 09:28:16 +0000 (09:28 +0000)]
tests: usb: usb-uas hotplug test

checks that it's possible to hotplug usb-uas HBA and
then if it's possible to hot(un)plug scsi-disk to it.
Thest basically covers hot(un)plug on dummy HBAs
without means of hot(un)plug notification of the guest.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: usb: usb-storage hotplug test
Igor Mammedov [Fri, 26 Sep 2014 09:28:15 +0000 (09:28 +0000)]
tests: usb: usb-storage hotplug test

usb-storage is different from usual usb devices
in that it uses a child SCSI bus for underlying storage.
This commit verifies that the SCSI bus is hotpluggable, as
hotplug operation wouldn't succeed without it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: usb: Generic usb device hotplug
Igor Mammedov [Fri, 26 Sep 2014 09:28:14 +0000 (09:28 +0000)]
tests: usb: Generic usb device hotplug

use usb-tablet as a hotplugged usb device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: usb: add port test to uhci unit test
Igor Mammedov [Fri, 26 Sep 2014 09:28:13 +0000 (09:28 +0000)]
tests: usb: add port test to uhci unit test

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: usb: Move uhci port test code to libqos/usb.c
Igor Mammedov [Fri, 26 Sep 2014 09:28:12 +0000 (09:28 +0000)]
tests: usb: Move uhci port test code to libqos/usb.c

Move code necessary for testing uhci port into library
so it could be used by other USB tests.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: virtio-blk: Check if hot-plug/unplug works
Igor Mammedov [Fri, 26 Sep 2014 09:28:11 +0000 (09:28 +0000)]
tests: virtio-blk: Check if hot-plug/unplug works

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: virtio-net: Check if hot-plug/unplug works
Igor Mammedov [Fri, 26 Sep 2014 09:28:10 +0000 (09:28 +0000)]
tests: virtio-net: Check if hot-plug/unplug works

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: virtio-rng: Check if hot-plug/unplug works
Igor Mammedov [Fri, 26 Sep 2014 09:28:09 +0000 (09:28 +0000)]
tests: virtio-rng: Check if hot-plug/unplug works

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agolibqos: Add qpci_plug_device_test() and qpci_unplug_acpi_device_test()
Igor Mammedov [Fri, 26 Sep 2014 09:28:08 +0000 (09:28 +0000)]
libqos: Add qpci_plug_device_test() and qpci_unplug_acpi_device_test()

Functions will be used for testing hot(un)plug of PCI devices.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: virtio-serial: Check if hot-plug/unplug works
Igor Mammedov [Fri, 26 Sep 2014 09:28:07 +0000 (09:28 +0000)]
tests: virtio-serial: Check if hot-plug/unplug works

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agotests: virtio-scsi: Check if hot-plug/unplug works
Igor Mammedov [Fri, 26 Sep 2014 09:28:06 +0000 (09:28 +0000)]
tests: virtio-scsi: Check if hot-plug/unplug works

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqom: Add error handler for object alias property
Gonglei [Sat, 27 Sep 2014 05:13:56 +0000 (13:13 +0800)]
qom: Add error handler for object alias property

object_property_add_alias() is called at some
places at present. And its parameter errp may not NULL,
such as
 object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothread",
                              &error_abort);
This patch add error handler for security.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqom: Add error handler for object_property_print()
Gonglei [Sat, 27 Sep 2014 05:13:55 +0000 (13:13 +0800)]
qom: Add error handler for object_property_print()

Avoid the caller of object_property_print() leaking string
argument's memory, such as qdev_print_props() when
encounter errors.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agomigration: catch unknown flag combinations in ram_load
Peter Lieven [Tue, 24 Jun 2014 09:32:36 +0000 (11:32 +0200)]
migration: catch unknown flag combinations in ram_load

this patch extends commit db80fac by not only checking
for unknown flags, but also filtering out unknown flag
combinations.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqemu-file: Move stdio implementation to qemu-file-stdio.c
Eduardo Habkost [Wed, 1 Oct 2014 20:34:37 +0000 (17:34 -0300)]
qemu-file: Move stdio implementation to qemu-file-stdio.c

Separate the QEMUFile interface from the stdio-specific implementation,
to reduce dependencies from code using QEMUFile.

The code that is being moved is similar to the one that was on savevm.c before
it was moved in commit 093c455a8c6d8f715eabd8c8d346f08f17d686ec, except for
some changes done by Markus, Juan, and myself. So, I am using the copyright and
license header from savevm.c, but CCing Juan and Markus so they can review the
copyright/license header.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqemu-file: Move unix and socket implementations to qemu-file-unix.c
Eduardo Habkost [Wed, 1 Oct 2014 20:34:36 +0000 (17:34 -0300)]
qemu-file: Move unix and socket implementations to qemu-file-unix.c

Separate the QEMUFile interface from the implementation, to reduce
dependencies from code using QEMUFile.

All the code that is being moved to the new file is exactly the same
code that was on savevm.c (moved by commit
093c455a8c6d8f715eabd8c8d346f08f17d686ec), so I am using the copyright
and license header from savevm.c for the new file.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqemu-file: Use qemu_file_is_writable() on stdio_fclose()
Eduardo Habkost [Wed, 1 Oct 2014 20:34:35 +0000 (17:34 -0300)]
qemu-file: Use qemu_file_is_writable() on stdio_fclose()

Use the existing function which checks if writev_buffer() or
put_buffer() are set, instead of duplicating it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqemu-file: Make qemu_file_is_writable() non-static
Eduardo Habkost [Wed, 1 Oct 2014 20:34:34 +0000 (17:34 -0300)]
qemu-file: Make qemu_file_is_writable() non-static

The QEMUFileStdio code will use qemu_file_is_writable() and will be
moved to a separate file.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqemu-file: Add copyright header to qemu-file.c
Eduardo Habkost [Wed, 1 Oct 2014 17:47:33 +0000 (14:47 -0300)]
qemu-file: Add copyright header to qemu-file.c

The person who created qemu-file.c (me, on commit
093c455a8c6d8f715eabd8c8d346f08f17d686ec) didn't add a copyright/license
header to the file, even though the whole code was copied from savevm.c
(which had a copyright/license header).

To correct this, copy the copyright information and license from
savevm.c, that's where the original code came from.

Luckily, very few changes were made on qemu-file.c after it was created.
All the authors who touched the code are being CCed, so they can confirm
if they are OK with the copyright/license information being added.

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agovmstate: Allow dynamic allocation for VBUFFER during migration
Alexey Kardashevskiy [Thu, 2 Oct 2014 09:56:02 +0000 (19:56 +1000)]
vmstate: Allow dynamic allocation for VBUFFER during migration

This extends use of VMS_ALLOC flag from arrays to VBUFFER as well.

This defines VMSTATE_VBUFFER_ALLOC_UINT32 which makes use of VMS_ALLOC
and uses uint32_t type for a size.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoblock/migration: Disable cache invalidate for incoming migration
Alexey Kardashevskiy [Thu, 9 Oct 2014 02:50:46 +0000 (13:50 +1100)]
block/migration: Disable cache invalidate for incoming migration

When migrated using libvirt with "--copy-storage-all", at the end of
migration there is race between NBD mirroring task trying to do flush
and migration completion, both end up invalidating cache. Since qcow2
driver does not handle this situation very well, random crashes happen.

This disables the BDRV_O_INCOMING flag for the block device being migrated
once the cache has been invalidated.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
--

fixed parens by hand
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoTests: QEMUSizedBuffer/QEMUBuffer
Dr. David Alan Gilbert [Fri, 10 Oct 2014 11:39:05 +0000 (12:39 +0100)]
Tests: QEMUSizedBuffer/QEMUBuffer

Modify some of tests/test-vmstate.c to use the in memory file based
on QEMUSizedBuffer to provide basic testing of QEMUSizedBuffer and
the associated memory backed QEMUFile type.

Only some of the tests are changed so that the fd backed QEMUFile is
still tested.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoQEMUSizedBuffer based QEMUFile
Dr. David Alan Gilbert [Fri, 10 Oct 2014 11:39:04 +0000 (12:39 +0100)]
QEMUSizedBuffer based QEMUFile

This is based on Stefan and Joel's patch that creates a QEMUFile that goes
to a memory buffer; from:

http://lists.gnu.org/archive/html/qemu-devel/2013-03/msg05036.html

Using the QEMUFile interface, this patch adds support functions for
operating on in-memory sized buffers that can be written to or read from.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
For fixes/tweeks I've done:
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqdev: gpio: Register GPIO outputs as QOM links
Peter Crosthwaite [Fri, 26 Sep 2014 05:18:14 +0000 (22:18 -0700)]
qdev: gpio: Register GPIO outputs as QOM links

Within the object that contains the GPIO output. This allows for
connecting GPIO outputs via setting of a Link property.

Also clear the link value to zero. This catch-alls the case
where a device improperly inits a gpio_out (malloc instead of
malloc0).

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: gpio: Register GPIO inputs as child objects
Peter Crosthwaite [Fri, 26 Sep 2014 05:17:41 +0000 (22:17 -0700)]
qdev: gpio: Register GPIO inputs as child objects

To the device that contains them. This will allow for referencing
a GPIO input from it's canonical path (exciting for dynamic machine
generation!)

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoqdev: gpio: Don't allow name share between I and O
Peter Crosthwaite [Fri, 26 Sep 2014 05:17:08 +0000 (22:17 -0700)]
qdev: gpio: Don't allow name share between I and O

Only allow a GPIO name to be one or the other. Inputs and outputs are
functionally different and should be in different namespaces. Prepares
support for the QOMification of IRQs as Links or Child objects.

The alternative is to munge names .e.g. with "-in" or "-out" suffixes
when giving QOM names. But that reduces clarity and if there are cases
out there where users want I and O with same name they can manually add
their own suffixes.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20141010' into staging
Peter Maydell [Fri, 10 Oct 2014 13:55:29 +0000 (14:55 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20141010' into staging

various s390x updates:
- cpu state handling in qemu and migration
- vhost-scsi-ccw bugfix

# gpg: Signature made Fri 10 Oct 2014 14:01:34 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20141010:
  s390x/virtio-ccw: fix vhost-scsi intialization
  s390x/migration: migrate CPU state
  s390x/kvm: synchronize the cpu state after SIGP (INITIAL) CPU RESET
  s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs
  s390x/kvm: propagate s390 cpu state to kvm
  s390x/kvm: proper use of the cpu states OPERATING and STOPPED
  s390x/kvm: introduce proper states for s390 cpus
  linux-headers: update to 3.17-rc7

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agokvm fix compilation with GCC 4.3.4
Paolo Bonzini [Fri, 10 Oct 2014 10:23:35 +0000 (12:23 +0200)]
kvm fix compilation with GCC 4.3.4

As usual, SLES11's GCC complained about double typedefs:

/home/cohuck/git/qemu/kvm-all.c:110: error: redefinition of typedef ‘KVMState’
/home/cohuck/git/qemu/include/sysemu/kvm.h:161: error: previous declaration of ‘KVMState’ was here

Reported-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agos390x/virtio-ccw: fix vhost-scsi intialization
Cornelia Huck [Tue, 30 Sep 2014 11:55:04 +0000 (13:55 +0200)]
s390x/virtio-ccw: fix vhost-scsi intialization

The vhost-scsi-ccw backend is of type VHostSCSICcw, not VirtIOSCSICcw.

This fixes a segfault when invoking

    qemu-system-s390x -device vhost-scsi-ccw,?

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/migration: migrate CPU state
Thomas Huth [Tue, 30 Sep 2014 08:58:42 +0000 (10:58 +0200)]
s390x/migration: migrate CPU state

This patch provides the cpu save information for dumps and later life
migration and enables migration of the CPU state. The code is based on
earlier work from Christian Borntraeger and Jason Herne.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
[provide cpu_post_load()]
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
CC: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Jason J. Herne <jjherne@us.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
[Cornelia Huck: tweaked cpu_post_load() comment]
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: synchronize the cpu state after SIGP (INITIAL) CPU RESET
David Hildenbrand [Tue, 30 Sep 2014 08:57:32 +0000 (10:57 +0200)]
s390x/kvm: synchronize the cpu state after SIGP (INITIAL) CPU RESET

We need to synchronize registers after a reset has been performed. The
current code does that in qemu_system_reset(), load_normal_reset() and
modified_clear_reset() for all vcpus. After SIGP (INITIAL) CPU RESET,
this needs to be done for the targeted vcpu as well, so let's call
cpu_synchronize_post_reset() in the respective handlers.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs
David Hildenbrand [Tue, 30 Sep 2014 08:57:31 +0000 (10:57 +0200)]
s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs

This patch reuses kvm_s390_reset_vcpu() to get rid of some CONFIG_KVM and
CONFIG_USER_ONLY ifdefs in cpu.c.

In order to get rid of CONFIG_USER_ONLY, kvm_s390_reset_vcpu() has to provide a
dummy implementation - the two definitions are moved to the proper section in
cpu.h.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: propagate s390 cpu state to kvm
David Hildenbrand [Tue, 30 Sep 2014 08:57:30 +0000 (10:57 +0200)]
s390x/kvm: propagate s390 cpu state to kvm

Let QEMU propagate the cpu state to kvm. If kvm doesn't yet support it, it is
silently ignored as kvm will still handle the cpu state itself in that case.

The state is not synced back, thus kvm won't have a chance to actively modify
the cpu state. To do so, control has to be given back to QEMU (which is already
done so in all relevant cases).

Setting of the cpu state can fail either because kvm doesn't support the
interface yet, or because the state is invalid/not supported. Failed attempts
will be traced

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: proper use of the cpu states OPERATING and STOPPED
David Hildenbrand [Tue, 30 Sep 2014 08:57:29 +0000 (10:57 +0200)]
s390x/kvm: proper use of the cpu states OPERATING and STOPPED

This patch makes sure that halting a cpu and stopping a cpu are two different
things. Stopping a cpu will also set the cpu halted - this is needed for common
infrastructure to work (note that the stop and stopped flag cannot be used for
our purpose because they are already used by other mechanisms).

A cpu can be halted ("waiting") when it is operating. If interrupts are
disabled, this is called a "disabled wait", as it can't be woken up anymore. A
stopped cpu is treated like a "disabled wait" cpu, but in order to prepare for a
proper cpu state synchronization with the kvm part, we need to track the real
logical state of a cpu.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: introduce proper states for s390 cpus
David Hildenbrand [Tue, 30 Sep 2014 08:57:28 +0000 (10:57 +0200)]
s390x/kvm: introduce proper states for s390 cpus

Until now, when a s390 cpu was stopped or halted, the number of running
CPUs was tracked in a global variable. This was problematic for migration,
so Jason came up with a per-cpu running state.
As it turns out, we want to track the full logical state of a target vcpu,
so we need real s390 cpu states.

This patch is based on an initial patch by Jason Herne, but was heavily
rewritten when adding the cpu states STOPPED and OPERATING. On the way we
move add_del_running to cpu.c (the declaration is already in cpu.h) and
modify the users where appropriate.

Please note that the cpu is still set to be stopped when it is
halted, which is wrong. This will be fixed in the next patch. The LOAD and
CHECK-STOP state will not be used in the first step.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
[folded Jason's patch into David's patch to avoid add/remove same lines]
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agolinux-headers: update to 3.17-rc7
Jens Freimann [Tue, 30 Sep 2014 08:57:27 +0000 (10:57 +0200)]
linux-headers: update to 3.17-rc7

Sync headers with 3.17-rc7

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Thu, 9 Oct 2014 14:09:05 +0000 (15:09 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

Four changes here.  Polling for reconnection of character devices,
the QOMification of accelerators, a fix for -kernel support on x86, and one
for a recently-introduced virtio-scsi optimization.

# gpg: Signature made Thu 09 Oct 2014 14:36:50 BST using RSA key ID 4E6B09D7
# gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>"
# gpg:                 aka "Paolo Bonzini <bonzini@gnu.org>"

* remotes/bonzini/tags/for-upstream: (28 commits)
  qemu-char: Fix reconnect socket error reporting
  qemu-sockets: Add error to non-blocking connect handler
  qemu-error: Add error_vreport()
  virtio-scsi: fix use-after-free of VirtIOSCSIReq
  linuxboot: compute initrd loading address
  kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct
  accel: Create accel object when initializing machine
  accel: Pass MachineState object to accel init functions
  accel: Rename 'init' method to 'init_machine'
  accel: Move accel init/allowed code to separate function
  accel: Remove tcg_available() function
  accel: Move qtest accel registration to qtest.c
  accel: Move Xen registration code to xen-common.c
  accel: Move KVM accel registration to kvm-all.c
  accel: Report unknown accelerator as "not found" instead of "does not exist"
  accel: Make AccelClass.available() optional
  accel: Use QOM classes for accel types
  accel: Move accel name lookup to separate function
  accel: Simplify configure_accelerator() using AccelType *acc variable
  accel: Create AccelType typedef
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoqemu-char: Fix reconnect socket error reporting
Corey Minyard [Wed, 8 Oct 2014 12:11:55 +0000 (07:11 -0500)]
qemu-char: Fix reconnect socket error reporting

If reconnect was set, errors wouldn't always be reported.
Fix that and also only report a connect error once until a
connection has been made.

The primary purpose of this is to tell the user that a
connection failed so they can know they need to figure out
what went wrong.  So we don't want to spew too much
out here, just enough so they know.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqemu-sockets: Add error to non-blocking connect handler
Corey Minyard [Wed, 8 Oct 2014 12:11:56 +0000 (07:11 -0500)]
qemu-sockets: Add error to non-blocking connect handler

An error value here would be quite handy and more consistent
with the rest of the code.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
[Make sure SO_ERROR value is passed to error_setg_errno. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoqemu-error: Add error_vreport()
Corey Minyard [Wed, 8 Oct 2014 12:11:54 +0000 (07:11 -0500)]
qemu-error: Add error_vreport()

Needed to nicely print socket error reports.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agovirtio-scsi: fix use-after-free of VirtIOSCSIReq
Paolo Bonzini [Tue, 7 Oct 2014 23:19:00 +0000 (01:19 +0200)]
virtio-scsi: fix use-after-free of VirtIOSCSIReq

scsi_req_continue can complete the request and cause the VirtIOSCSIReq
to be freed.  Fetch req->sreq just once to avoid the bug.

Reported-by: Richard Jones <rjones@redhat.com>
Tested-by: Richard Jones <rjones@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agolinuxboot: compute initrd loading address
Paolo Bonzini [Mon, 6 Oct 2014 14:49:57 +0000 (16:49 +0200)]
linuxboot: compute initrd loading address

Even though hw/i386/pc.c tries to compute a valid loading address for the
initrd, close to the top of RAM, this does not take into account other
data that is malloced into that memory by SeaBIOS.

Luckily we can easily look at the memory map to find out how much memory is
used up there.  This patch places the initrd in the first four gigabytes,
below the first hole (as returned by INT 15h, AX=e801h).

Without this patch:
[    0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff]
[    0.000000] RAMDISK: [mem 0x0710a000-0x07fd7fff]

With this patch:
[    0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff]
[    0.000000] RAMDISK: [mem 0x07112000-0x07fdffff]

So linuxboot is able to use the 64k that were added as padding for
QEMU <= 2.1.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agokvm: Make KVMState be the TYPE_KVM_ACCEL instance struct
Eduardo Habkost [Fri, 26 Sep 2014 20:45:32 +0000 (17:45 -0300)]
kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct

Now that we create an accel object before calling machine_init, we can
simply use the accel object to save all KVMState data, instead of
allocationg KVMState manually.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoaccel: Create accel object when initializing machine
Eduardo Habkost [Fri, 26 Sep 2014 20:45:31 +0000 (17:45 -0300)]
accel: Create accel object when initializing machine

Create an actual TYPE_ACCEL object when initializing a machine. This
will allow accelerator classes to implement some initialization on
instance_init, and to save state on the TYPE_ACCEL object.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoaccel: Pass MachineState object to accel init functions
Eduardo Habkost [Fri, 26 Sep 2014 20:45:30 +0000 (17:45 -0300)]
accel: Pass MachineState object to accel init functions

Most of the machine options and machine state information is in the
MachineState object, not on the MachineClass. This will allow init
functions to use the MachineState object directly instead of
qemu_get_machine_opts() or the current_machine global.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20141006-2' into...
Peter Maydell [Tue, 7 Oct 2014 09:41:48 +0000 (10:41 +0100)]
Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20141006-2' into staging

linux-user pull for 2.2

Clearest linux-user patches sent to the list since august,
Apart from Mikhails patch, the rest are quite trivial.

v2: check for CONFIG_TIMERFD only after it has been defined

# gpg: Signature made Mon 06 Oct 2014 20:08:10 BST using RSA key ID DE3C9BC0
# gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>"
# gpg:                 aka "Riku Voipio <riku.voipio@linaro.org>"

* remotes/riku/tags/pull-linux-user-20141006-2:
  translate-all.c: memory walker initial address miscalculation
  linux-user: don't include timerfd if not needed
  linux-user: Simplify timerid checks on g_posix_timers range
  linux-user: Convert blkpg to use a special subop handler
  linux-user: Enable epoll_pwait syscall for ARM

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotranslate-all.c: memory walker initial address miscalculation
Mikhail Ilyin [Mon, 8 Sep 2014 13:28:56 +0000 (17:28 +0400)]
translate-all.c: memory walker initial address miscalculation

The initial base address is miscalculated in walk_memory_regions().
It has to be shifted TARGET_PAGE_BITS more. Holder variables are
extended to target_ulong size otherwise they don't fit for MIPS N32
(a 32-bit ABI with a 64-bit address space) and qemu won't compile.
The issue led to incorrect debug output of memory maps and a
mis-formed coredumped file.

Signed-off-by: Mikhail Ilyin <m.ilin@samsung.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: don't include timerfd if not needed
Riku Voipio [Wed, 1 Oct 2014 13:05:46 +0000 (16:05 +0300)]
linux-user: don't include timerfd if not needed

Without this, builds on older systems fail with:

qemu/linux-user/syscall.c:61:25: warning: sys/timerfd.h: No such file or directory

v2: fix the usual case where CONFIG_TIMERFD is enabled..

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: Simplify timerid checks on g_posix_timers range
Alexander Graf [Fri, 22 Aug 2014 11:56:18 +0000 (13:56 +0200)]
linux-user: Simplify timerid checks on g_posix_timers range

We check whether the passed in timer id is negative on all calls
that involve g_posix_timers.

However, these checks are bogus. First off we limit the timer_id to
16 bits which is not what Linux does. Then we check whether it's negative
which it can't be because we masked it.

We can safely remove the masking. For the negativity check we can just
treat the timerid as unsigned and only check for upper boundaries.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: Convert blkpg to use a special subop handler
Alexander Graf [Fri, 22 Aug 2014 11:15:50 +0000 (13:15 +0200)]
linux-user: Convert blkpg to use a special subop handler

The blkpg ioctl can take different payloads depending on the opcode in
its payload structure. Create a new special ioctl handler that can only
deal with partition style ones for now.

This patch fixes running parted for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agolinux-user: Enable epoll_pwait syscall for ARM
Peter Maydell [Fri, 19 Sep 2014 01:35:20 +0000 (02:35 +0100)]
linux-user: Enable epoll_pwait syscall for ARM

We have support for the epoll_pwait syscall, but it wasn't enabled for
ARM guests because we hadn't defined the syscall number; correct this
deficiency.

Reported-by: Dave Flogeras <dflogeras2@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
9 years agogdbstub: Allow target CPUs to specify watchpoint STOP_BEFORE_ACCESS flag
Peter Maydell [Fri, 12 Sep 2014 18:04:17 +0000 (19:04 +0100)]
gdbstub: Allow target CPUs to specify watchpoint STOP_BEFORE_ACCESS flag

GDB assumes that watchpoint set via the gdbstub remote protocol will
behave in the same way as hardware watchpoints for the target. In
particular, whether the CPU stops with the PC before or after the insn
which triggers the watchpoint is target dependent. Allow guest CPU
code to specify which behaviour to use. This fixes a bug where with
guest CPUs which stop before the accessing insn GDB would manually
step forward over what it thought was the insn and end up one insn
further forward than it should be.

We set this flag for the CPU architectures which set
gdbarch_have_nonsteppable_watchpoint in gdb 7.7:
ARM, CRIS, LM32, MIPS and Xtensa.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Max Filippov <jcmvbkbc@gmail.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Michael Walle <michael@walle.cc> (for lm32)
Message-id: 1410545057-14014-1-git-send-email-peter.maydell@linaro.org

9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Mon, 6 Oct 2014 09:59:55 +0000 (10:59 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Sat 04 Oct 2014 21:24:46 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request: (23 commits)
  blockdev-test: Test device_del after drive_del
  blockdev-test: Factor out some common code into helpers
  blockdev-test: Simplify by using g_assert_cmpstr()
  blockdev-test: Clean up bogus drive_add argument
  blockdev-test: Use single rather than double quotes in QMP
  drive_del-test: Merge of qdev-monitor-test, blockdev-test
  iotests: qemu-img info output for corrupt image
  qapi: Add corrupt field to ImageInfoSpecificQCow2
  iotests: Use _img_info
  util: Emancipate id_wellformed() from QemuOpts
  q35/ahci: Pick up -cdrom and -hda options
  qtest/bios-tables: Correct Q35 command line
  ide: Update ide_drive_get to be HBA agnostic
  pc/vl: Add units-per-default-bus property
  blockdev: Allow overriding if_max_dev property
  blockdev: Orphaned drive search
  qemu-iotests: Fix supported cache modes for 052
  make check-block: Use default cache modes
  Modify qemu_opt_rename to realize renaming all items in opts
  vmdk: Fix integer overflow in offset calculation
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoblockdev-test: Test device_del after drive_del
Markus Armbruster [Thu, 2 Oct 2014 14:51:36 +0000 (16:51 +0200)]
blockdev-test: Test device_del after drive_del

Executed in this order, drive_del and device_del's automatic drive
deletion take notoriously tricky special paths.

[Fixed "an device" -> "a device" typo as requested by Eric Blake.
--Stefan]

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412261496-24455-7-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblockdev-test: Factor out some common code into helpers
Markus Armbruster [Thu, 2 Oct 2014 14:51:35 +0000 (16:51 +0200)]
blockdev-test: Factor out some common code into helpers

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412261496-24455-6-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblockdev-test: Simplify by using g_assert_cmpstr()
Markus Armbruster [Thu, 2 Oct 2014 14:51:34 +0000 (16:51 +0200)]
blockdev-test: Simplify by using g_assert_cmpstr()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412261496-24455-5-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblockdev-test: Clean up bogus drive_add argument
Markus Armbruster [Thu, 2 Oct 2014 14:51:33 +0000 (16:51 +0200)]
blockdev-test: Clean up bogus drive_add argument

The first argument should be a PCI address, which pci-addr=auto isn't.
Doesn't really matter, as drive_add ignores its first argument when
its second argument has if=none.  Clean it up anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412261496-24455-4-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoblockdev-test: Use single rather than double quotes in QMP
Markus Armbruster [Thu, 2 Oct 2014 14:51:32 +0000 (16:51 +0200)]
blockdev-test: Use single rather than double quotes in QMP

QMP accepts both single and double quotes.  This is the only test
using double quotes.  They need to be quoted in C strings.  Replace
them by single quotes.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412261496-24455-3-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agodrive_del-test: Merge of qdev-monitor-test, blockdev-test
Markus Armbruster [Thu, 2 Oct 2014 14:51:31 +0000 (16:51 +0200)]
drive_del-test: Merge of qdev-monitor-test, blockdev-test

Each of qdev-monitor-test and blockdev-test has just one test case,
and both are about drive_del.

[Extended copyright from 2013 to 2013-2014 as requested by Eric Blake.
--Stefan]

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412261496-24455-2-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoiotests: qemu-img info output for corrupt image
Max Reitz [Tue, 30 Sep 2014 19:31:29 +0000 (21:31 +0200)]
iotests: qemu-img info output for corrupt image

The "corrupt" entry in the format-specific information section should be
"true".

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412105489-7681-4-git-send-email-mreitz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoqapi: Add corrupt field to ImageInfoSpecificQCow2
Max Reitz [Tue, 30 Sep 2014 19:31:28 +0000 (21:31 +0200)]
qapi: Add corrupt field to ImageInfoSpecificQCow2

Just like lazy-refcounts, this field will be present iff the qcow2
compat level is 1.1 (or probably any future revision).

As expected, this breaks some tests due to the new field present in
qemu-img info output; so fix their output accordingly.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412105489-7681-3-git-send-email-mreitz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoiotests: Use _img_info
Max Reitz [Tue, 30 Sep 2014 19:31:27 +0000 (21:31 +0200)]
iotests: Use _img_info

qemu-img info should only be used directly if the format-specific
information or the name of the format is relevant (some tests explicitly
test format-specific information; test 082 uses qcow2-specific settings
to test the qemu-img interface); otherwise, tests should always use
_img_info instead.

Test 082 was touched only partially. It does test the qemu-img
interface; however, its invocations of qemu-img info are not real tests
but rather verifications, so if format-specific information is not
important for the test, there is no reason not to use _img_info. In
contrast to directly invoking qemu-img info, "qcow2" is replaced by
"IMGFMT"; but as "qcow2" is only mentioned once in test 082 (in
_supported_fmt), I consider this an improvement.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1412105489-7681-2-git-send-email-mreitz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoaccel: Rename 'init' method to 'init_machine'
Eduardo Habkost [Fri, 26 Sep 2014 20:45:29 +0000 (17:45 -0300)]
accel: Rename 'init' method to 'init_machine'

Today, all accelerator init functions affect some global state:
* tcg_init() calls tcg_exec_init() and affects globals such as tcg_tcx,
  page size globals, and possibly others;
* kvm_init() changes the kvm_state global, cpu_interrupt_handler, and possibly
  others;
* xen_init() changes the xen_xc global, and registers a change state handler.

With the new accelerator QOM classes, initialization may now be split in two
steps:
* instance_init() will do basic initialization that doesn't affect any global
  state and don't need MachineState or MachineClass data. This will allow
  probing code to safely create multiple accelerator objects on the fly just
  for reporting host/accelerator capabilities, for example.
* accel_init_machine()/init_machine() will save the accelerator object in
  MachineState, and do initialization steps which still affect global state,
  machine state, or that need data from MachineClass or MachineState.

To clarify the difference between those two steps, rename init() to
init_machine().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoaccel: Move accel init/allowed code to separate function
Eduardo Habkost [Fri, 26 Sep 2014 20:45:28 +0000 (17:45 -0300)]
accel: Move accel init/allowed code to separate function

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoaccel: Remove tcg_available() function
Eduardo Habkost [Fri, 26 Sep 2014 20:45:27 +0000 (17:45 -0300)]
accel: Remove tcg_available() function

As the function always return 1, it is not needed anymore.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoaccel: Move qtest accel registration to qtest.c
Eduardo Habkost [Fri, 26 Sep 2014 20:45:26 +0000 (17:45 -0300)]
accel: Move qtest accel registration to qtest.c

As qtest_availble() returns 1 only when CONFIG_POSIX is set, keep
setting AccelClass.available to keep current behavior (this is different
from what we did for KVM and Xen).

This also allows us to make qtest_init_accel() static.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>