Commit Graph

31718 Commits (cc13eead53b2e4cf5f209fec606aebf11c1dc8a8)

Author SHA1 Message Date
Stefan Hajnoczi 11f590b1a2 object: add object_get_canonical_path_component()
It is often useful to find an object's child property name.  Also use
this new function to simplify the implementation of
object_get_canonical_path().

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Benoît Canet b5042a3622 block: Rewrite the snapshot authorization mechanism for block filters.
This patch keep the recursive way of doing things but simplify it by giving
two responsabilities to all block filters implementors.

They will need to do two things:

-Set the is_filter field of their block driver to true.

-Implement the bdrv_recurse_is_first_non_filter method of their block driver like
it is done on the Quorum block driver. (block/quorum.c)

[Paolo Bonzini <pbonzini@redhat.com> pointed out that this patch changes
the semantics of blkverify, which now recurses down both bs->file and
s->test_file.
-- Stefan]

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Max Reitz 98d39e34fe iotests: Test corruption during COW request
Extend test file 060 by a test case for corruption occuring concurrently
to a COW request. QEMU should not crash but rather return an appropriate
error message.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Max Reitz 938789ea92 block: bs->drv may be NULL in bdrv_debug_resume()
Currently, bdrv_debug_resume() requires every bs->drv in the BDS stack
to be NULL until a bs->drv with an implementation of bdrv_debug_resume()
is found. For a normal function, this would be fine, but this is a
function for debugging purposes and should therefore allow intermediate
BDS not to have a driver (i.e., be "ejected"). Otherwise, it is hard to
debug such situations.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Max Reitz dba2855572 qcow2: Check bs->drv in copy_sectors()
Before dereferencing bs->drv for a call to its member bdrv_co_readv(),
copy_sectors() should check whether that pointer is indeed valid, since
it may have been set to NULL by e.g. a concurrent write triggering the
corruption prevention mechanism.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Kevin Wolf 3456a8d185 block: Update image size in bdrv_invalidate_cache()
After migration has completed, we call bdrv_invalidate_cache() so that
drivers which cache some data drop their stale copy of the data and
reread it from the image file to get a new version of data that the
source modified while the migration was running.

Reloading metadata from the image file is useless, though, if the size
of the image file stays stale (this is a value that is cached for all
image formats in block.c). Reads from (meta)data after the old EOF
return only zeroes, causing image corruption.

We need to update bs->total_sectors in all layers that could potentially
have changed their size (i.e. backing files are not a concern - if they
are changed, we're in bigger trouble)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Max Reitz 26d49c4675 qcow2-refcount: Sanitize refcount table entry
When reading the refcount table entry in get_refcount(), only bits which
are actually significant for the refcount block offset should be taken
into account.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-13 14:23:27 +01:00
Peter Maydell be86c53c05 PowerPC queue for 2.0-rc0
* QEMUMachine include cleanup
 * SLOF update
 * XICS reset fix
 * sPAPR PCI host bridge refactorings
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTIR0LAAoJEPou0S0+fgE/4rMP/ReyYRPSXFFu2PXt2werCYcA
 P5Agynib/O5LXTBgZCOSkTrRYBE2+5bq3Zp3iQe7gkLrpbRjHJLulwBpFW3rlVQO
 5IWxMoFC1eW+PE9k+V0hRdTFXMfVxvvHam3g77XVGb4lm/thwHkQ2RYa7z1V4zCP
 hbj/gVdZA7pzXQZfLnOU6illaVCBjYeajEle5sagLlN+DANFSm3G/BdYWPTtxKxq
 MLiMEdaZJkBG/NG3zocyuCsWeF+oLyh8fB4IQUjORq7x8v749DgprQjFUy3YMrB5
 Ph5CQXyVyyiZSXmfbdINMpQPxdPaVm2rtBD9ol7p+mXtc6UOS3uzbFQ75XXiG401
 crqDpc74iXYpxmwtSs9FwD8TFqh5n8NFGEN8U3MOkhcNQ3zdjnlbVRMG1aqFIUne
 SbQeWC5Qg3MI7UruStq9n3l/3SL3KJSRRrT11ndO/4UoHT6PZfBKQ4eCD8XiHmPu
 /p0ahfnl8/UvMyTWVJhBvLt5G6+v8aumKJR/47jhrPnqLFCk4yUDbCdT5a5KSDjt
 ZauyfGlIQcORXKRbVw+DRgSQjeGLoQJMtOVqDXnKwS8j8cuhF2JebBCVTPHHjC72
 UTRYk5/tLjcZCLD7Vscpd4uRiuz69xJu/MCvwqUwSZ3TssuoW3Vl0/giLyajMxTU
 RLn0uLaFguDX+DoSNIAy
 =icAj
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/afaerber/tags/ppc-for-2.0' into staging

PowerPC queue for 2.0-rc0

* QEMUMachine include cleanup
* SLOF update
* XICS reset fix
* sPAPR PCI host bridge refactorings

# gpg: Signature made Thu 13 Mar 2014 02:50:51 GMT 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/ppc-for-2.0:
  spapr-pci: Convert fprintf() to error_report()
  spapr-pci: Convert to QOM realize
  xics-kvm: Fix reset function
  pseries: Update SLOF firmware image to qemu-slof-20140304
  Move QEMUMachine typedef to qemu/typedefs.h
  Revert "KVM: Split QEMUMachine typedef into separate header"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-13 13:19:46 +00:00
Peter Maydell c8d146aecc QOM/QTest infrastructure fixes and device conversions
* QTest cleanups and test cases for some virtio devices
 * QTest for sPAPR PCI host bridge
 * qom-test now tests reading all properties beneath /machine
 * QOM API leak fixes
 * QOM cleanups for SSI devices
 * QOM conversion of QEMUMachine
 * QOM realize for buses
 * sPAPR PCI bus name change
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTIPpQAAoJEPou0S0+fgE/waAQAImhHJ9NE9l9ba7xsuZRmr+B
 8LvYDQ6VhiYG0sRQ+wn6GbU9yY91l+OgY2M/AaPRLSnqP84c5ypmRSq33777x19T
 Mvnh6kWwVHFTWTaLpeb7G6rb67fbinx79QOdiNd7QI/WKrEl14meMlIxqDtGH/tk
 e++GYQLzQbhkl13pNGfuqEu7Zwj1cvoPyZYiRmqRkONVoDuZg+3y0Joo9fYnl57p
 lAcw4SxKA9K/mdjZrDJRjpZ8pDuoMx3ILaKDhEscZGSi6/vSRHUHnfqYehWbCFl4
 64V4QmAYuSHEiPjOdHxMaeAUgk5RYgvMTjsu7uDCCbrI1np5j0ELzjrU/X9BGiTP
 X1vYgCXRLmC9yNr4Bs4heIzdvEs7bw4XbM2IQ3ox102q1ZuYnS8BtGTr5G1nS/VE
 p7gdQ9tbfBnuZYE5ahI/nVM853xKWYkgQvYEbFKyCjTtPCN2c/2cbCpptBFUBhHN
 Ud6N3i3x39BuwDRIWXiFmrHEOa4jOcoorTVWmJyoXbE7NLp4cDZPTXEzU3R6aB4v
 KtzFcJAUUQsbXRJCllVieVjfDyuL3WdUdIpLTnXsgcr+495FKVeZI+98Jxi8ncVv
 s8J/OnXoZgE9Uwq9kZFRHTA7knsfxcFtAjTkbT8P/cLLK03o+c95d1m0OeXAl+FM
 RdFERQ0NZP8dRuOTQ3Fn
 =2uZO
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging

QOM/QTest infrastructure fixes and device conversions

* QTest cleanups and test cases for some virtio devices
* QTest for sPAPR PCI host bridge
* qom-test now tests reading all properties beneath /machine
* QOM API leak fixes
* QOM cleanups for SSI devices
* QOM conversion of QEMUMachine
* QOM realize for buses
* sPAPR PCI bus name change

# gpg: Signature made Thu 13 Mar 2014 00:22:40 GMT 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: (31 commits)
  libqtest: Fix possible deadlock in qtest initialization
  pci: Move VMState registration/unregistration to QOM realize/unrealize
  qdev: Realize buses on device realization
  qdev: Prepare realize/unrealize hooks for BusState
  tests: Add spapr-pci-host-bridge qtest
  virtio-serial-port: Convert to QOM realize/unrealize
  virtio-console: QOM cast cleanup for VirtConsole
  tests: Add virtio-console qtest
  tests: Add virtio-serial qtest
  tests: Add virtio-scsi qtest
  tests: Add virtio-rng qtest
  tests: Add virtio-balloon qtest
  tests: Add virtio-blk qtest
  tests: Clean up IndustryPack TPCI200 gcov paths
  qom-test: Test QOM properties
  hw/boards: Convert current_machine to MachineState
  vl: Use MachineClass instead of global QEMUMachine list
  hw/core: Introduce QEMU machine as QOM object
  qdev-monitor-test: Don't test human-readable error message
  qdev-monitor-test: Simplify using g_assert_cmpstr()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-13 12:32:47 +00:00
Peter Maydell 0100f42550 libqtest: Avoid inline varargs functions
Older versions of gcc (eg 4.6) can't handle varargs functions declared
inline for anything other than completely trivial uses, and complain:

tests/qom-test.c: In function 'qmp': tests/libqtest.h:359:60: sorry,
unimplemented: function 'qmp' can never be inlined because it uses
variable argument lists

Avoid this problem by putting the functions into libqtest.c instead
of using inline definitions in libqtest.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
2014-03-13 12:31:05 +00:00
Gal Hammer ac1b84dd1e char: restore read callback on a reattached (hotplug) chardev
Fix a bug that was introduced in commit 386a5a1e. A removal of a device
set the chr handlers to NULL. However when the device is plugged back,
its read callback is not restored so data can't be transferred from the
host to the guest (e.g. via the virtio-serial port).

https://bugzilla.redhat.com/show_bug.cgi?id=1027181

Signed-off-by: Gal Hammer <ghammer@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-13 10:33:45 +01:00
Alexey Kardashevskiy 295d51aa6a spapr-pci: Convert fprintf() to error_report()
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Mike Day <ncmike@ncultra.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 03:49:48 +01:00
Alexey Kardashevskiy c6ba42f6bc spapr-pci: Convert to QOM realize
This converts the old-style SysBusDevice::init() callback to a new-style
DeviceClass::realize() callback.

As a part of conversion, this replaces fprintf(stderr) with error_setg()
as realize() does not "return" any value, instead it puts the extended
error into **errp.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Mike Day <ncmike@ncultra.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 03:49:48 +01:00
Alexey Kardashevskiy fb0e843a11 xics-kvm: Fix reset function
Currently interrupt priorities are set to 0 (highest) at the very
beginning of the guest execution which is not correct and makes the guest
produce random interrupt error messages such as:
"Interrupt 0x1001 (real) is invalid, disabling it".
This also prevents interrupt states from correct migration.

This initializes priority to 0xFF as the emulated XICS does.

Suggested-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 03:49:48 +01:00
Alexey Kardashevskiy 8f3babb74d pseries: Update SLOF firmware image to qemu-slof-20140304
The changelog is:
  > version: update to 20140304
  > Introduce dummy console device
  > vio-vscsi: Fix CRQ allocation alignment
  > version: update to 20140204
  > virtio-9p: disable unused structure
  > Make "boot net:dhcp" boot from IPv4 only
  > Fix virtio device shutdown
  > Change shutdown method name for virtio-scsi
  > Add support for 64bit LE ABI v1 and v2 support
  > Change representation of string environment variable
  > cas: return error when unknown node found
  > version: update
  > Reset obp-tftp arguments before parsing
  > Enable seamless netboot on IPv6 network
  > Fix shutdown for virtio devices
  > Fix zero checksum in UDP header
  > Handle router advertisement message properly
  > [oex]hci_exit: Check before freeing/unmapping memory
  > Work around missing sc 1 traps on pHyp
  > fix print_version() to return where it came from
  > usb-xhci: memory freeing and using returns as bool uniformly
  > Output banner and initial display output in VNC window
  > use VERSION file to generate FW version
  > cas: remove warning
  > Add support for loading little endian ELF binaries.
  > Add bswap_{16,32,64}p
  > dhcpv6 and other minor net-snk fixes
  > Fix missing drop in virtio-fs setup-alias
  > Find next available alias name
  > SLOF does not exit if given 1KB disk
  > boot: enable support for bootindex
  > pci-properties: add properties to enable hotplug for spapr
  > e1000: remember node handle
  > Increase quiesce tokens array size
  > virtio: timeout after 5sec
  > Enable IPv6 support in dns
  > usb-ohci: fix warnings
  > Add ipv6 support in net-snk
  > ipv4: fix frame overwriting following arp_send_request
  > e1000: fix SLOF_dma_map_out arguments
  > Maintain single global packet buffer for tftp
  > Increase virtio-net receive queue size
  > Increase veth receive queue size
  > Fix dprintf macros at various points
  > usb-ohci: rewrite done_head processing code
  > boot: add net in default boot order
  > block 0 address in the allocator
  > scsi: make-media-alias fix
  > usb-xhci: add xhci host controller support
  > usb-xhci: add xhci support
  > Avoid veth read/write calls with zero length buffer
  > boot: include other aliases
  > usb-core: disable xhci

Cc: Andreas Färber <afaerber@suse.de>
Cc: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2014-03-13 03:49:48 +01:00
Andreas Färber 7a1a4dac94 Move QEMUMachine typedef to qemu/typedefs.h
As reported in commit 9c06a1f79f, xen.h is
not self-contained with regards to its use of QEMUMachine. Fix this.

Reported-by: Alexander Graf <agraf@suse.de>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 03:49:48 +01:00
Andreas Färber 602a3921ff Revert "KVM: Split QEMUMachine typedef into separate header"
This reverts commit 9c06a1f79f.
The new header sysemu/qemumachine.h is undesired.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 03:49:48 +01:00
Marcel Apfelbaum f8762027a3 libqtest: Fix possible deadlock in qtest initialization
'socket_accept' waits for QEMU to init its unix socket.
If QEMU encounters an error during command line parsing,
it can exit before initializing the communication channel.

Using a timeout for sockets fixes the issue.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Bandan Das d2f69df746 pci: Move VMState registration/unregistration to QOM realize/unrealize
Use the realize and unrealize hooks to register and unregister
vmstate_pcibus respectively.

Relocate some stuff to avoid forward declarations.

Signed-off-by: Bandan Das <bsd@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
[AF: Keep using PCI_BUS() cast macro]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Bandan Das 5c21ce77d7 qdev: Realize buses on device realization
Integrate (un)realization of child buses with realization/unrealization
of the device hosting them. Code in device_unparent() is reordered for
unrealization of buses to work as part of device unrealization.

That way no changes need to be made to bus instantiation.

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Bandan Das 02e7f85dac qdev: Prepare realize/unrealize hooks for BusState
Add a "realized" property calling realize/unrealize hooks as for devices.

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Alexey Kardashevskiy 04e9a20b49 tests: Add spapr-pci-host-bridge qtest
This adds a test whether sPAPR PHB can be added via the command line.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Andreas Färber 2ef66625f3 virtio-serial-port: Convert to QOM realize/unrealize
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Andreas Färber 0399a3819b virtio-console: QOM cast cleanup for VirtConsole
Introduce type constant, cast macro and rename parent field.

Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Andreas Färber 6e8114a065 tests: Add virtio-console qtest
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Andreas Färber aa97405e32 tests: Add virtio-serial qtest
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:57 +01:00
Andreas Färber 26c9a015ef tests: Add virtio-scsi qtest
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:56 +01:00
Andreas Färber b6f46f02f4 tests: Add virtio-rng qtest
Cc: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:56 +01:00
Andreas Färber 02063aaa65 tests: Add virtio-balloon qtest
Cc: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:56 +01:00
Andreas Färber c7a59bed62 tests: Add virtio-blk qtest
Cc: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:56 +01:00
Andreas Färber 83bb0b2ffd tests: Clean up IndustryPack TPCI200 gcov paths
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:56 +01:00
Andreas Färber dc06cbd286 qom-test: Test QOM properties
Recursively walk all properties under /machine and try to retrieve their
value. This is a regression test for link<> properties and the
DeviceState::hotpluggable property.

Cf. be2f78b6b0 and
    1a37eca107

Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 01:21:45 +01:00
Marcel Apfelbaum 0056ae24bc hw/boards: Convert current_machine to MachineState
In order to allow attaching machine options to a machine instance,
current_machine is converted into MachineState.
As a first step of deprecating QEMUMachine, some of the functions
were modified to return MachineClass.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Marcel Apfelbaum 261747f176 vl: Use MachineClass instead of global QEMUMachine list
The machine registration flow is refactored to use the QOM functionality.
Instead of linking the machines into a list, each machine has a type
and the types can be traversed in the QOM way.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Marcel Apfelbaum 36d20cb2b3 hw/core: Introduce QEMU machine as QOM object
The main functional change is to convert QEMUMachine into MachineClass
and QEMUMachineInitArgs into MachineState, instance of MachineClass.

As a first step, in order to make possible an incremental development,
both QEMUMachine and QEMUMachineInitArgs are being embedded into the
new types.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Markus Armbruster 49649f23db qdev-monitor-test: Don't test human-readable error message
Test the error class instead.  Expecting a specific message is
fragile.  In fact, it broke once already, in commit 75884af.  Restore
the test of error member "class" dropped there, and drop the test of
error member "desc".

There are no other tests of "desc" as far as I can tell.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Stefan Hajnoczi a3d7cbc139 qdev-monitor-test: Simplify using g_assert_cmpstr()
Use g_assert_cmpstr() instead of combining g_assert() and strcmp(3).
This simplifies the code since we no longer have to play games to
distinguish NULL from "" using "(null)".

gcc extension haters will also be happy that ?: was dropped.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Alexey Kardashevskiy 1b8601b0ea spapr-pci: Change the default PCI bus naming
Previously libvirt required the first/default PCI bus to have name "pci".
Since QEMU can support multiple buses now, libvirt wants "pci.0" now.

This removes custom bus name and lets QEMU make up default names.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Peter Crosthwaite cdccf7d7e7 block/m25p80: Remove FROM_SSI_SLAVE() usages
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Rename parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Peter Crosthwaite 1f760d5f2b ssi: Remove SSI_SLAVE_FROM_QDEV() macro
There are no usages left of this legacy cast. Delete.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Rename SSISlave parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>

ssi: Rename parent field
2014-03-12 20:13:02 +01:00
Peter Crosthwaite 7c77b654c5 misc/max111x: QOM casting sweep
Define and use QOM cast macro. Removes some usages of legacy casting
systems.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Rename parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Peter Crosthwaite 5ef4a1c304 misc/max111x: Create abstract max111x type
Create an abstract class that encompasses both max111x variants. This is
needed for QOM cast macro creation (and is the right thing to do
anyway). Macroify type-names in the process.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Peter Crosthwaite d43269dddc ssi: Convert legacy SSI_BUS -> BUS casts
Remove two legacy ->qbus style casts from TYPE_SSI_BUS to TYPE_BUS in
ssi.c.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Convert one missing ->qbus and rename parent field]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Peter Crosthwaite 1a7d9ee6dd ssi: Convert legacy SSI_SLAVE -> DEVICE casts
Convert legacy ->qdev style casts from TYPE_SSI_SLAVE to TYPE_DEVICE.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Introduce local DeviceState variable for transition to QOM realize]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Stefan Hajnoczi a01aedc8d3 qom: Avoid leaking str and bool properties on failure
When object_property_add_str() and object_property_add_bool() fail, they
leak their internal StringProperty and BoolProperty structs.  Remember
to free the structs on error.

Luckily this is a low-impact memory leak since most QOM properties are
static qdev properties that will never take the error case.
object_property_add() only fails if the property name is already in use.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Amos Kong 7b0309490c qdev-monitor: Set properties after parent is assigned in device_add
Test steps:
 (qemu) device_add e1000,addr=adsf
  Property 'e1000.addr' doesn't take value 'adsf'
 (qemu) info qtree
  Then qemu crashed.

Currently we set a link to the new device from its parent bus, but the
device hasn't been added to QOM tree yet. When it fails to set properties,
object_unparent() can't clean up the device.

Delay setting of device properties until the device has been added to
the QOM composition tree. This way, when setting a property fails,
object_unparent() can clean up the device properly.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Igor Mammedov 267a3264cd qdev: Set DeviceClass::hotpluggable default in class_init()
Move setting DeviceClass::hotpluggable default from device's
class_base_init() to device's class_init().

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Andreas Färber 2b81b35f8f qdev: Fix bus dependency of DeviceState::hotpluggable getter
Commit 1a37eca107 (qdev: add
"hotpluggable" property to Device) added a property "hotpluggable" to
each device, with its getter accessing parent_bus->allow_hotplug.

Add a NULL check.

Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-12 20:13:02 +01:00
Peter Maydell 750036a848 PReP machine and devices
* ppc_rom.bin update and submodule
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTIJo4AAoJEPou0S0+fgE/XroP/jEANSW2ryUstXNK6J/rPSYm
 CTCDxL/XC6Y5qrfVca/PMCPjtv+PUuxq5IZ2aMyLponDsQM0uHJGT297pIdwXCHl
 8KRYsdJo0UQwxwFaXCw2R2ofQqoTqB1H59USVunfqaUozdDLHmgjKWqsoj9TTOx4
 yddWWuz72Jg8EvUfMP7bbnqmmij3S1DN3GqFv4WvloDo02dJzcma95CUog4+e0zr
 FD11GCDhTvtU+DcauDEBUBils2q7MFKs3AdADVxRegrTAuWkeOmZ58lXXPM13W/8
 MSWlzjN9zsY4IJzyxMtAESm8nFTqgPDgXVSTj3SjGWCut9SapmAQtBtH2gbdDFFc
 Xr+tQF8hvFhFDUuVo7Pd3qkX6LeHlspfsetmm0OeQEL8dAiU0HmkxzZQ1prnCTqZ
 uKvRaPUeM6sobVH+00lEZI0E/SssICCP43MKPIrDV8PhVSHj73ldeDNZKhwmh2Fc
 BTbEJYORpQ31SYoc1McY/BOPfmMJAKO2ZzpSp4+ZN8xkaKLKErgVYCb+imsgSL5N
 xaE7Y/PrYB+dvYITHIenLRkuUiecgVF2jLgkyS8Q9N82iIuUWAdpD2q/LMIpKD+x
 mNfqGNboLWh83rSTAtYkz47/SANWZutBO5CRcCP39sA5Rr8+UxqX4OdeI6HNxLA0
 TSiISMKEyg2/QC5Jl5dH
 =HRCU
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/afaerber/tags/prep-for-upstream' into staging

PReP machine and devices

* ppc_rom.bin update and submodule

# gpg: Signature made Wed 12 Mar 2014 17:32:40 GMT 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/prep-for-upstream:
  prep: Update ppc_rom.bin
  Add OpenHack'Ware submodule

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-12 17:53:37 +00:00
Peter Maydell 2f23e9ae2c Net patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJTIGWkAAoJEJykq7OBq3PIsvYH/jLFORFyUHflSsEmPjjRKGfR
 Jd41UP67CXqgOyeJfDDN/fks2o6n3woRsoz/EfPXTiOvXB50jBKqmBarOwh/Zejq
 /5hpUC8IyYOFpeKbiCSneXvANP+0CfH/FD8yP64a3FTBXQFQD9GzJpKf3zlcmNvI
 XotlIr/WxTXXNSQf2dTleobGJWg8otDFREBCvalTndSBjYZ0GdvvNOCiAkqYviX2
 wLjrrRvJYW/lxOTIfTmGQFHs89tjq9ZvotKr9QPOQ5MOGaBExYnOTaSHmmPHjYpf
 HsWkk+u85vLSRp5FU5CTW2VfhIujBghwaFFnVh2BdMjIlzkjbDnDMcRr2YgebOw=
 =zhuM
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

Net patches

# gpg: Signature made Wed 12 Mar 2014 13:48:20 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/net-pull-request:
  tap: avoid deadlocking rx

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-12 16:45:25 +00:00