OSDN Git Service

qmiga/qemu.git
9 years agotarget-tricore: Add instructions of ABS, ABSB opcode format
Bastian Koppelmann [Fri, 26 Sep 2014 19:26:31 +0000 (20:26 +0100)]
target-tricore: Add instructions of ABS, ABSB opcode format

Add instructions of ABS, ABSB opcode format.
Add microcode generator functions for ld/st of two 32bit reg as one 64bit value.
Add microcode generator functions for ldmst and swap.
Add helper ldlcx, lducx, stlcx and stucx.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agotarget-tricore: Cleanup and Bugfixes
Bastian Koppelmann [Fri, 26 Sep 2014 19:04:51 +0000 (20:04 +0100)]
target-tricore: Cleanup and Bugfixes

Move FCX loading of save_context_ to caller functions, for STLCX, STUCX insn to use those functions.
Move FCX storing of restore_context_ to caller functions, for LDLCX, LDUCX insn to use those functions.
Remove do_raise_exception function, which caused clang to emit a warning.
Fix: save_context_lower now saves a[11] instead of PSW.
Fix: MASK_OP_ABSB_BPOS starting at wrong offset.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agoglib: add compatibility interface for g_strcmp0()
Gonglei [Thu, 16 Oct 2014 10:59:37 +0000 (18:59 +0800)]
glib: add compatibility interface for g_strcmp0()

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

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-id: 1413457177-10132-1-git-send-email-arei.gonglei@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20141015-1' into staging
Peter Maydell [Thu, 16 Oct 2014 08:26:14 +0000 (09:26 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20141015-1' into staging

vga-pci: add qext region to mmio
vga: Remove unused arrays dmask4 and dmask16

# gpg: Signature made Wed 15 Oct 2014 10:12:06 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vga-20141015-1:
  hw/display/vga: Remove unused arrays dmask4 and dmask16
  vga-pci: add qext region to mmio

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-bootindex-20141015-1' into...
Peter Maydell [Wed, 15 Oct 2014 20:03:28 +0000 (21:03 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-bootindex-20141015-1' into staging

allow changing bootorder via monitor at runtime,
by making bootindex a writable qom property.

* remotes/kraxel/tags/pull-bootindex-20141015-1: (34 commits)
  bootindex: change fprintf to error_report
  bootindex: delete bootindex when device is removed
  bootindex: move calling add_boot_device_patch to bootindex setter function
  ide: add calling add_boot_device_patch in bootindex setter function
  nvma: ide: add bootindex to qom property
  usb-storage: add bootindex to qom property
  virtio-blk: alias bootindex property explicitly for virt-blk-pci/ccw/s390
  block: remove bootindex property from qdev to qom
  virtio-blk: add bootindex to qom property
  ide: add bootindex to qom property
  scsi: add bootindex to qom property
  isa-fdc: remove bootindexA/B property from qdev to qom
  redirect: remove bootindex property from qdev to qom
  vfio: remove bootindex property from qdev to qom
  pci-assign: remove bootindex property from qdev to qom
  host-libusb: remove bootindex property from qdev to qom
  virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390
  net: remove bootindex property from qdev to qom
  usb-net: add bootindex to qom property
  vmxnet3: add bootindex to qom property
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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 agohw/display/vga: Remove unused arrays dmask4 and dmask16
Peter Maydell [Fri, 10 Oct 2014 19:44:29 +0000 (20:44 +0100)]
hw/display/vga: Remove unused arrays dmask4 and dmask16

Following cleanup of the vga device code in commit d2e043a8041,
the arrays dmask4 and dmask16 are now unused. gcc doesn't warn
about this, but clang does; remove them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovga-pci: add qext region to mmio
Gerd Hoffmann [Tue, 23 Sep 2014 10:45:56 +0000 (12:45 +0200)]
vga-pci: add qext region to mmio

Add a qemu extented register range to the standard vga mmio bar.
Right nowe there are two registers:  One readonly register returning the
size of the region (so we can easily add more registers there if needed)
and one endian control register, so guests (especially ppc) can flip
the framebuffer endianness as they need it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
9 years agobootindex: change fprintf to error_report
Gonglei [Tue, 7 Oct 2014 08:00:38 +0000 (16:00 +0800)]
bootindex: change fprintf to error_report

The function may be called by qmp command, we should
report error message to the caller.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: delete bootindex when device is removed
Gonglei [Tue, 7 Oct 2014 08:00:37 +0000 (16:00 +0800)]
bootindex: delete bootindex when device is removed

Device should be removed from global boot list when
it is hot-unplugged.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: move calling add_boot_device_patch to bootindex setter function
Gonglei [Tue, 7 Oct 2014 08:00:36 +0000 (16:00 +0800)]
bootindex: move calling add_boot_device_patch to bootindex setter function

On this way, we can assure the new bootindex take effect
during vm rebooting.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoide: add calling add_boot_device_patch in bootindex setter function
Gonglei [Tue, 7 Oct 2014 08:00:35 +0000 (16:00 +0800)]
ide: add calling add_boot_device_patch in bootindex setter function

On this way, we can assure the new bootindex take effect
during vm rebooting. Meanwhile set the initial value of
bootindex to -1.

Because ide devcies's unit property maybe
do not initialize when set_bootindex function is called,
so that we don't know its suffix. So we have to save the
call add_boot_device_path() on ide realize/init function.
When we want to change bootindex during vm rebooting, we
can call it in setter function.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agonvma: ide: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:34 +0000 (16:00 +0800)]
nvma: ide: add bootindex to qom property

At present, nvma cannot boot. However, it provides already
a bootindex property, so change bootindex to qom for nvma
device, but not call add_boot_device_path.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb-storage: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:33 +0000 (16:00 +0800)]
usb-storage: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Because usb-storage rely on scsi-disk which is created
in usb_msg_realize_storage(), so we should store the SCSIDevice
pointer in MSDState struct. Only in this way, we can change
the global boot_order_list when we want to change the bootindex
during vm rebooting by calling object_property_set_int(Object(SCSIDevice),).

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-blk: alias bootindex property explicitly for virt-blk-pci/ccw/s390
Gonglei [Tue, 7 Oct 2014 08:00:32 +0000 (16:00 +0800)]
virtio-blk: alias bootindex property explicitly for virt-blk-pci/ccw/s390

Since the "bootindex" property is a QOM property and not a qdev property
now, we must alias it explicitly for virtio-blk-pci, as well as CCW and
s390-virtio.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoblock: remove bootindex property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:31 +0000 (16:00 +0800)]
block: remove bootindex property from qdev to qom

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-blk: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:30 +0000 (16:00 +0800)]
virtio-blk: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoide: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:29 +0000 (16:00 +0800)]
ide: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoscsi: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:28 +0000 (16:00 +0800)]
scsi: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoisa-fdc: remove bootindexA/B property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:27 +0000 (16:00 +0800)]
isa-fdc: remove bootindexA/B property from qdev to qom

Remove bootindexA/B form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoredirect: remove bootindex property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:26 +0000 (16:00 +0800)]
redirect: remove bootindex property from qdev to qom

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovfio: remove bootindex property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:25 +0000 (16:00 +0800)]
vfio: remove bootindex property from qdev to qom

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agopci-assign: remove bootindex property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:24 +0000 (16:00 +0800)]
pci-assign: remove bootindex property from qdev to qom

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agohost-libusb: remove bootindex property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:23 +0000 (16:00 +0800)]
host-libusb: remove bootindex property from qdev to qom

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390
Gonglei [Tue, 7 Oct 2014 08:00:22 +0000 (16:00 +0800)]
virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390

Since the "bootindex" property is a QOM property and not a qdev property
now, we must alias it explicitly for virtio-net-pci, as well as CCW and
s390-virtio.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agonet: remove bootindex property from qdev to qom
Gonglei [Tue, 7 Oct 2014 08:00:21 +0000 (16:00 +0800)]
net: remove bootindex property from qdev to qom

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb-net: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:20 +0000 (16:00 +0800)]
usb-net: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovmxnet3: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:19 +0000 (16:00 +0800)]
vmxnet3: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agospapr_lian: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:18 +0000 (16:00 +0800)]
spapr_lian: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agortl8139: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:17 +0000 (16:00 +0800)]
rtl8139: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agopcnet: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:16 +0000 (16:00 +0800)]
pcnet: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agone2000: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:15 +0000 (16:00 +0800)]
ne2000: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

At present, isa_ne2000 device does not support to boot
os, so we register two seprate qom getter/setter functions.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoeepro100: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:14 +0000 (16:00 +0800)]
eepro100: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoe1000: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:13 +0000 (16:00 +0800)]
e1000: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-net: add bootindex to qom property
Gonglei [Tue, 7 Oct 2014 08:00:12 +0000 (16:00 +0800)]
virtio-net: add bootindex to qom property

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: add a setter/getter functions wrapper for bootindex property
Gonglei [Tue, 7 Oct 2014 08:00:11 +0000 (16:00 +0800)]
bootindex: add a setter/getter functions wrapper for bootindex property

when we remove bootindex form qdev.property to qom.property,
we can use those functions set/get bootindex property for all
correlative devices. Meanwhile set the initial value of
bootindex to -1.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: support to set a existent device's bootindex to -1
Gonglei [Tue, 7 Oct 2014 08:00:10 +0000 (16:00 +0800)]
bootindex: support to set a existent device's bootindex to -1

When set a device's bootindex to -1, we remove it from global
fw_boot_order list.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: rework add_boot_device_path function
Gonglei [Tue, 7 Oct 2014 08:00:09 +0000 (16:00 +0800)]
bootindex: rework add_boot_device_path function

Add the function of updating bootindex about fw_boot_order list
in add_boot_device_path(). We should delete the old one if a
device has existed in global fw_boot_order list.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agofw_cfg: add fw_cfg_machine_reset function
Gonglei [Tue, 7 Oct 2014 08:00:08 +0000 (16:00 +0800)]
fw_cfg: add fw_cfg_machine_reset function

We must assure that the changed bootindex can take effect
when guest is rebooted. So we introduce fw_cfg_machine_reset(),
which change the fw_cfg file's bootindex data using the new
global fw_boot_order list.

Signed-off-by: Chenliang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: add del_boot_device_path function
Gonglei [Tue, 7 Oct 2014 08:00:07 +0000 (16:00 +0800)]
bootindex: add del_boot_device_path function

Introduce del_boot_device_path() to clean up fw_cfg content when
hot-unplugging a device that refers to a bootindex or update a
existent devcie's bootindex.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Chenliang <chenliang88@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootindex: add check bootindex function
Gonglei [Tue, 7 Oct 2014 08:00:06 +0000 (16:00 +0800)]
bootindex: add check bootindex function

Determine whether a given bootindex exists or not.
If exists, we report an error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobootdevice: move bootdevice related code to new file bootdevice.c
Gonglei [Tue, 7 Oct 2014 08:00:05 +0000 (16:00 +0800)]
bootdevice: move bootdevice related code to new file bootdevice.c

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
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>