Commit Graph

35292 Commits

Author SHA1 Message Date
Markus Armbruster d224469d87 block: Improve message for device name clashing with node name
Suggested-by: Benoit Canet <benoit.canet@nodalink.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-09-25 15:24:14 +02:00
Markus Armbruster e5d7bbeb10 qemu-nbd: Destroy the BlockDriverState properly
Match the bdrv_new() with a bdrv_unref(), just to be tidy.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-09-25 15:24:14 +02:00
Markus Armbruster 3ae59580a0 block: Keep DriveInfo alive until BlockDriverState dies
If the BDS's refcnt > 0, drive_del() destroys the DriveInfo, but not
the BDS.  This can happen in three places:

* Device model destruction during unplug: blockdev_auto_del()

* Xen IDE unplug: pci_piix3_xen_ide_unplug()

* drive_del command when no device model is attached: do_drive_del()

The other callers of drive_del are on error paths where refcnt == 1.

If the user somehow manages to plug in a device model using a BDS that
has gone through drive_del(), the legacy configuration passed in
DriveInfo doesn't reach the device model, and automatic deletion on
unplug doesn't work.  Worse, some device models such as scsi-disk
crash when DriveInfo doesn't exist.

This is theoretical; I didn't research an actual reproducer. The problem
was introduced when we replaced DriveInfo reference counting by BDS
reference counting in commit a94a3fa..fa510eb.

Fix by keeping DriveInfo alive until its BDS dies.

This affects qemu_drive_opts: now you can't reuse the same ID for new
drive options until the BDS dies.  Before, you could, but since the
code always attempts to create a BDS with the same ID next, the
enclosing operation "create a new drive" failed anyway.  Different
error path, same result.

Unfortunately, the fix involves use of blockdev.c stuff from block.c,
which is a layering violation.  Fortunately, my forthcoming
BlockBackend work will get rid of it again.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-09-25 15:24:14 +02:00
Markus Armbruster a0f1eab157 blockdev: Disentangle BlockDriverState and DriveInfo creation
blockdev_init() mixes up BlockDriverState and DriveInfo initialization
Finish the BlockDriverState job before starting to mess with
DriveInfo.  Easier on the eyes.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-09-25 15:24:14 +02:00
Stefan Hajnoczi d4362d642e blkdebug: show an error for invalid event names
It is easy to typo a blkdebug configuration and waste a lot of time
figuring out why no rules are matching.

Push the Error** down into add_rule() so we can report an error when the
event name is invalid.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-09-25 15:24:14 +02:00
Peter Maydell 4f2280b219 tcx: Implement hardware acceleration
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJUIeuiAAoJEFvCxW+uDzIffmUH/0IQC/tNdUjlHBvVIpZ6Va5H
 cWbcX1qIlgn7JkF7gjSWdow2XuD/qqxYQIasV3GvMgNLWcBBiEK8vxFU7gStC3sq
 zAt0i7EzZGQrWj1QHfHCIJqHkgNFrNXaEmVwQJEsg63OGLfwRW3fmdIEBI7Zf2Uw
 XaDXjj+R6aFMHtON31KjBs46fVfVReiQxBNRNUbaXjC6hKcgREXq2+wR4SpxGpI6
 tvH3Ace9gPeTLOeP1z1mIj4gcsXmK+CbGVWqyujdC3G2aebfXFCbeAYDycJpmEqH
 GAganCwyUbOKi/wsjeThV0dtz3BqTTYEAPrNZ39uSeLVRBk9JttVtVoyWr/dziY=
 =M9S/
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging

tcx: Implement hardware acceleration

# gpg: Signature made Tue 23 Sep 2014 22:52:34 BST using RSA key ID AE0F321F
# gpg: Can't check signature: public key not found

* remotes/mcayland/tags/qemu-sparc-signed:
  tcx: Implement hardware acceleration

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-24 13:45:13 +01:00
Stefan Weil c0f896810b virtio: Fix wrong type cast from pointer to long
Compiler warning (w32, w64):

include/hw/virtio/virtio_ring.h:142:26: warning:
 cast from pointer to integer of different size [-Wpointer-to-int-cast]

When sizeof(long) < sizeof(void *), this is not only a warning but a
real program error.

Add also missing blanks in the same statement.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1411536002-14088-1-git-send-email-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-24 12:51:38 +01:00
Peter Maydell ca976d1803 Endian updates to re-fix cross endian host and guest and
enable the same for ROM loading (Alexey)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUIafHAAoJECObm247sIsihf4P/06fd5TozmQjRMWMq/at9xmG
 CRAetoolT1CfTVuaTHLzpncS+WuWVYRSUWyWY9g6VEJBg9aCBoypgo/4nRAb6AER
 iE2Jeh1SWYtBUZJ9WzsE9RR4Yt+dy8ErzVWSjaUp1RffwL3m0VJK44ExGFFnyvfD
 SMHwfR4m9YJ33/XmmxY2GPUmfFuQI1xMaFYSykvx4Tgo8O9XzVpLjN53o/n2pFFv
 RnsIX7DR4yELj+E4fkYW4Epr1BRwjX2zSuDvzVLqWNt+yNgrplPiEYPHMFP3JFWi
 Vos55XYYxDSVnthtrXHGAbbFJIjES1fzAftW8K7XupqwrMeN4TgebUV7Hkvbf7BW
 VIrBrEntZnShfPzSJrsY+ZXTX3knfd1AUtXAb9VDUSoCBHgYgnegOT3ZnwVzUFwx
 F9/aqEfQLx+44zZIYvFgQkJo73tGHoji5wvDQPT3XESCMuIV1pkfss+LKd/RLzZl
 a629OXw90wiCTCu90OUnjLicLVXp7fpRueKp+/PM+PWz9BeyKIv5X4ZVGpySNLXA
 lwlwxOsASthDMIxmseV80tWiddKJbR0tvOxG2x/+eOuSIBM3raQi8BaNaBVyPfyV
 EC0HmdxtwxNqN8nE+C5n+7Nz0miCviDb1DcDRRmvEYEH69n7zru+HSXTdsJ5WDU4
 XdoxhhvuzgezGmVYj0Pa
 =D4De
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140923.0' into staging

Endian updates to re-fix cross endian host and guest and
enable the same for ROM loading (Alexey)

# gpg: Signature made Tue 23 Sep 2014 18:03:03 BST using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

* remotes/awilliam/tags/vfio-pci-for-qemu-20140923.0:
  vfio: make rom read endian sensitive
  Revert "vfio: Make BARs native endian"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-24 12:00:08 +01:00
Mark Cave-Ayland 55d7bfe229 tcx: Implement hardware acceleration
The S24/TCX framebuffer is a mildly accelerated video card with
blitter, stippler and hardware cursor.

* Solaris and NetBSD 6.x use all the hardware acceleration features
* The Xorg driver (used by Linux) can use the hardware cursor only

This patch implements hardware acceleration in both 8 bit and 24 bit
modes. It is based on the NetBSD driver sources and from tests with
Solaris.

Signed-off-by: Olivier Danet <odanet@caramail.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2014-09-23 22:23:14 +01:00
Petr Matousek 01f7cecf00 slirp: udp: fix NULL pointer dereference because of uninitialized socket
When guest sends udp packet with source port and source addr 0,
uninitialized socket is picked up when looking for matching and already
created udp sockets, and later passed to sosendto() where NULL pointer
dereference is hit during so->slirp->vnetwork_mask.s_addr access.

Fix this by checking that the socket is not just a socket stub.

This is CVE-2014-3640.

Signed-off-by: Petr Matousek <pmatouse@redhat.com>
Reported-by: Xavier Mehrenberger <xavier.mehrenberger@airbus.com>
Reported-by: Stephane Duverger <stephane.duverger@eads.net>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Message-id: 20140918063537.GX9321@dhcp-25-225.brq.redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-23 19:15:05 +01:00
Peter Maydell 769188d3bb usb: enable hotplug, switch to realize, ohci tracing, misc fixes.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJUIVylAAoJEEy22O7T6HE4WKQP/3HbMmYSNJc3zN+1QH/dIH6X
 l70Aj6XECdq7FtnciYNArVmHVejq7/6WH7SsF5abPIuZFCszMlstFaskD+hlUBlN
 kLp+ExVg/oXzgvw1Kw+3H2k54QJcVoMEdfQ+/5ly6WKcLni9KNVqGFQpZG6z+kXC
 /lk+W6JjJiXhNxo1zXxgqi8IDB83u0ej0pu8AbEDnT8lXZ25t17vJEs8N1ZeccIU
 mz6EMnzE68H3EOJmJH901D3kEiuA9npFSgOetgvDys6NoieV6rzEFeD9RWqafYV2
 mYkGV+S1TH7L8wMx0KeQuA7gzlmoqrIkt8k0BAOALKwjthlx2Tb2is7XZb7h2Lkn
 uQ5hGroD9QQblCMnZie32htxJwSUA5/G8sKF3X3yLq6gd8JinzF1QTjc1WKRWTKM
 z43dUtvrM8stbf3NzQTu636qdhnw1Ig/Fv/IoLepH5jpqOFHdZx/ZWcVLgRwAv9m
 tiSeFHppU9cRnXu/yeu41kL8rZVU3bn/bilfY8HCWyHB8XEs91Nu2YX391aa6bTS
 Cn9h4DHbCh1Lr4/Gddu/Jo4FK0PqW8ioS/uwH6MN/uaIDuUj5ie00bls2UP4Hk/3
 hxdpD5xJ1XW//e81El64srrOnSCrFQRtF0Jj8gmU0wkKLVBQSQzbnGmMxjcoZ7zh
 JyvwicFows38e9kQa9Br
 =9nh5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20140923-1' into staging

usb: enable hotplug, switch to realize, ohci tracing, misc fixes.

# gpg: Signature made Tue 23 Sep 2014 12:42:29 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-usb-20140923-1: (26 commits)
  usb: tag standalone ehci as hotpluggable
  usb: tag standalone uhci as hotpluggable
  usb: tag xhci as hotpluggable
  usb-serial: only check speed once at realize time
  usb-bus: introduce a wrapper function to check speed
  usb-bus: remove "init" from USBDeviceClass struct
  usb-mtp: convert init to realize
  usb-redir: convert init to realize
  usb-audio: convert init to realize
  dev-wacom: convert init to realize
  dev-hid: convert init to realize
  usb-ccid: convert init to realize
  dev-serial: convert init to realize
  dev-bluetooth: convert init to realize
  dev-uas: using error_report instead of fprintf
  dev-uas: convert init to realize
  dev-storage: usring error_report instead of fprintf/printf
  dev-storage: convert init to realize
  usb-hub: convert init to realize
  libusb: using error_report instead of fprintf
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-23 14:43:47 +01:00
Peter Maydell cad684c538 s390x/kvm: some fixes and cleanups
1. sclp: get of of duplicate defines
 2. ccw: implement and fix handling of some special cases
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJUIWNHAAoJEBF7vIC1phx8pmUQAIrcXEdPG+aIfzalAnksHhnB
 v0bL13aCOsWKNuYfWdNdrkOUlmCI2tkSyQ/D0qmoOQya4k7vWxEXehYgCp7VGS3U
 s3IrsORRolHOskqWhI+jzejo3DeGWgcAsFl7TEFwzWmo2MZfuugOwOxL9GDz01Qy
 vsJCwsh4yq7G5z+dm17FF2+qMCkcrQNONrmBrEronfsH2Zfz/aFDcJeWdFYqemaB
 369htZqWQ1Q5LJzc5U3eWHAMS8/e3F/6rxMRbC8oeo2kPqBie795Z/1lezIO19TX
 5P4ck5cxTuK07Xbzr23sErcbnS8Ktg8LG/2N1/kah0fgjrccDIE3i86kMXXxRfwF
 xZBsAzr/0+sVuUHnD7ZtwShZqOoPMQwCBQ23pFV0YpnmLfMLfGkCU6zROy1c63wU
 PGiaUAhttQT7B6kxvsKznf7+F6qSLkvt/e9IYKJGsZVVEHdOfDwCPgbAjEasotFh
 7rCjgg8acqFQse2kfEXotRPQA7ASMAq3mTrgMKW+cX55VtsvsyOsp8sEDPQ7X75t
 nLfM1vQtMXOuRjx/fIakYmLkiUcxvmm8MPEle1PCR7S719B964AGLpivRKX5vR2I
 H2Mum9L/LjjFWoQLjA1F0lnkOmo7rZCtFHOksIwvc9VarVo0ZJslZ08BFlHePFRn
 z5Nv056VFDEAKzaA6x0p
 =B/kw
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20140923' into staging

s390x/kvm: some fixes and cleanups

1. sclp: get of of duplicate defines
2. ccw: implement and fix handling of some special cases

# gpg: Signature made Tue 23 Sep 2014 13:10:47 BST using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found

* remotes/borntraeger/tags/s390x-20140923:
  s390x/css: catch ccw sequence errors
  s390x/css: support format-0 ccws
  s390x: remove duplicate defines in SCLP code

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-23 13:28:06 +01:00
Cornelia Huck e8601dd5d0 s390x/css: catch ccw sequence errors
We must not allow chains of more than 255 ccws without data transfer.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-23 14:10:17 +02:00
Cornelia Huck a327c9215d s390x/css: support format-0 ccws
Add support for format-0 ccws in channel programs. As a format-1 ccw
contains the same information as format-0 ccws, only supporting larger
addresses, simply convert every ccw to format-1 as we walk the chain.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-23 14:10:17 +02:00
Jens Freimann 450749141e s390x: remove duplicate defines in SCLP code
Let's get rid of these duplicate defines.

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-23 14:10:17 +02:00
Peter Maydell 380f649e02 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQEcBAABAgAGBQJUIAsHAAoJEJykq7OBq3PIyR4H/ikrs35Boxv08mR8rTyfpSnQ
 ERQhMnKWIe3cy5pzNG5TKiPliljF0FnkNC3KmBLU5TsoqXeW76WJF//Db5hNnTzG
 FAIeJu2RUSqhjqoz5K6TNYOJGH2XQ+/EZbMyrIeLBwYFn0gFMvZJOVYgpBWP0QTQ
 7sImrlxihUalwwL/6twfE6s5aA12DXN8hlC57u+9nvf+5ocaDyOJ7jUBU2EEhSNr
 TzDTO3gTCSEmnDriwKi3m3mIW/y7kLTXWyGolprZ0UpRyYRSmjcfgBHu8l0X8NCv
 lKkrYuE4V3QIzJk4BWbZQSPjoDlLbH9gnq3H+VwMxMZDxDKtAqAJRw/3H4yWhZ8=
 =JJEF
 -----END PGP SIGNATURE-----

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

# gpg: Signature made Mon 22 Sep 2014 12:41:59 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: (59 commits)
  block: Always compile virtio-blk dataplane
  vring: Better error handling if num is too large
  virtio: Import virtio_vring.h
  async: aio_context_new(): Handle event_notifier_init failure
  block: vhdx - fix reading beyond pointer during image creation
  block: delete cow block driver
  block/archipelago: Fix typo in qemu_archipelago_truncate()
  ahci: Add test_identify case to ahci-test.
  ahci: Add test_hba_enable to ahci-test.
  ahci: Add test_hba_spec to ahci-test.
  ahci: properly shadow the TFD register
  ahci: add test_pci_enable to ahci-test.
  ahci: Add test_pci_spec to ahci-test.
  ahci: MSI capability should be at 0x80, not 0x50.
  ahci: Adding basic functionality qtest.
  layout: Add generators for refcount table and blocks
  fuzz: Add fuzzing functions for entries of refcount table and blocks
  docs: List all image elements currently supported by the fuzzer
  qapi/block-core: Add "new" qcow2 options
  qcow2: Add overlap-check.template option
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-23 12:08:55 +01:00
Gerd Hoffmann ec56214f6f usb: tag standalone ehci as hotpluggable
Add a flag to EHCIPCIInfo saying whenever the controller supports
companions or not.  Make sure we only allow registering companions for
ehci versions supporting that.  Enable pci hotplug for the ehci
variants not supporting companions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:08 +02:00
Gerd Hoffmann 638ca939d8 usb: tag standalone uhci as hotpluggable
uhci hostadapters in companion setups can't be hotplugged.  So leave
hotplug disabled for all ich9 variants (which are already tagged with
unplug = true in the info struct).  For the other variants we'll enable
hotplug and remove the companion setup properties.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:08 +02:00
Gerd Hoffmann 3533c3d2bf usb: tag xhci as hotpluggable
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:08 +02:00
Gonglei 7334d6507a usb-serial: only check speed once at realize time
Whatever the chardev is open or not, we should assure
the speed is matched each other. So, call usb_check_attach()
check speed. And then pass &error_abort at all calls to
usb_device_attach().

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:08 +02:00
Gonglei 594a53607e usb-bus: introduce a wrapper function to check speed
In this way, we can check speed directly, don't need
call usb_device_attach(), which has other conditions,
such as checking the chardev is open.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:08 +02:00
Gonglei bd2ba2752d usb-bus: remove "init" from USBDeviceClass struct
All usb-bus devices are realized by realize(),
remove init callback function from USBDeviceClass struct.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:08 +02:00
Gonglei df9bb6660d usb-mtp: convert init to realize
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 77e35b4bbe usb-redir: convert init to realize
In this way, all the implementations now use
error_setg instead of qerror_report for reporting error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 5450eeaaad usb-audio: convert init to realize
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 27107d416e dev-wacom: convert init to realize
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 276b7ac8e9 dev-hid: convert init to realize
In this way, all the implementations now use
error_setg instead of error_report for reporting error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 0b8b863fb2 usb-ccid: convert init to realize
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 38fff2c9f4 dev-serial: convert init to realize
In this way, all the implementations now use
error_setg instead of error_report for reporting error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 63cdca364c dev-bluetooth: convert init to realize
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 6b7afb7f0b dev-uas: using error_report instead of fprintf
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei b89dc7e33f dev-uas: convert init to realize
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei f5dc597878 dev-storage: usring error_report instead of fprintf/printf
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 5a882e40d5 dev-storage: convert init to realize
In this way, all the implementations now use
error_setg instead of error_report for reporting error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei f3f8c45972 usb-hub: convert init to realize
In this way, all the implementations now use
error_setg instead of error_report for reporting error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 2e6a0dd1ac libusb: using error_report instead of fprintf
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei 2aa76dc18c libusb: convert init to realize
In this way, all the implementations now use
error_setg instead of error_report for reporting error.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:07 +02:00
Gonglei d73ad35990 usb-net: convert init to realize
meanwhile, qerror_report_err() is a transitional interface to
help with converting existing HMP commands to QMP. It should
not be used elsewhere.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:06 +02:00
Gonglei 7d553f27fc usb-bus: convert USBDeviceClass init to realize
Add "realize/unrealize" in USBDeviceClass, which has errp
as a parameter. So all the implementations now use
error_setg instead of error_report for reporting error.

Note: this patch still keep "init" in USBDeviceClass, and
call kclass->init in usb_device_realize(), avoid breaking
git bisect. After realize all usb devices, will be removed.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:06 +02:00
Alexey Kardashevskiy dc1f598845 ohci: Convert fprint/DPRINTF/print to traces
This converts many kinds of debug prints to traces.

This implements packets logging to avoid unnecessary calculations if
usb_ohci_td_pkt_short/usb_ohci_td_pkt_long is not enabled.

This makes OHCI errors (such as "DMA error") invisible by default.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 12:51:06 +02:00
Peter Maydell 17336812c7 trivial patches for 2014-09-22
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJUH9lbAAoJEL7lnXSkw9fb8TYH/iXU1Sbt74zkZX6g9G8TvfEj
 OY+T9F6IOcdHFNBayEN2X8xNMr//XT4hLlI/Mz+DzWDK4w84Jprny+YgrQHWs6fa
 yvPuv2FcOSv+Ws/n4e8GWSq89LcsAygIZAUAWwzb49cNRbfSsMDN7yJNUGud6OWx
 SVsos4keZP/FNMXq2mBnY7zibTfS4ECzYVyzQjrmlMYwao7v1DE11OTkNTgTp9zW
 89tJRuFMd8g8kf1viQdbjvsza2eTqaQOBn8+YnwIUQ2JKHKlfh5FHmc4wot+a2ax
 cGLMLChuggWL28cm+yjSHC9tIDjCrUmRZu2FP2KvoHkCtQuYpQoxgXdIx10AMDs=
 =5jOt
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-09-22' into staging

trivial patches for 2014-09-22

# gpg: Signature made Mon 22 Sep 2014 09:10:03 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# 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: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-09-22:
  arch_init: Setting QEMU_ARCH enum straight
  pc: Add missing 'static' attribute
  block: allow creation of fixed vhdx images
  vl: Print maxmem in hex format for error message
  configure: trivial fixes
  xen-hvm.c: Always return -1 when failure occurs in xen_hvm_init()
  rdma: Fix incorrect description in comments
  Fix typos and misspellings in comments
  qemu-char: Permit only a single "stdio" character device

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-09-23 11:00:08 +01:00
Gonglei f0bc7fe3b7 usb-storage: fix possible memory leak and missing error message
When scsi_bus_legacy_add_drive() return NULL, meanwhile err will
be not NULL, which will casue memory leak and missing error message.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-09-23 11:41:45 +02:00
Nikunj A Dadhania 75bd0c7253 vfio: make rom read endian sensitive
All memory regions used by VFIO are LITTLE_ENDIAN and they
already take care of endiannes when accessing real device BARs
except ROM - it was broken on BE hosts.

This fixes endiannes for ROM BARs the same way as it is done
for other BARs.

This has been tested on PPC64 BE/LE host/guest in all possible
combinations including TCG.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[aik: added commit log]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-09-22 15:27:43 -06:00
Alexey Kardashevskiy 6758008e2c Revert "vfio: Make BARs native endian"
This reverts commit c40708176a.

The resulting code wrongly assumed target and host endianness are
the same which is not always the case for PPC64.

[aw: or potentially any host supporting VFIO and TCG]

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-09-22 15:26:36 -06:00
Fam Zheng 52b53c04fa block: Always compile virtio-blk dataplane
Dataplane doesn't depend on linux-aio any more, so we don't need the
compiling condition now.

Configure options are kept but just print a message.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1410329871-28885-4-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-22 11:39:51 +01:00
Fam Zheng 032f8b8158 vring: Better error handling if num is too large
To be more consistent inside this function.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1410329871-28885-3-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-22 11:39:49 +01:00
Fam Zheng d9612b43dd virtio: Import virtio_vring.h
This header has no further dependencies. It only has some stable data
types and primitive functions, so we can copy it to include/hw/virtio in
order to allow vring code (and its user virtio-blk dataplane) to be
built unconditionally, even for cross compiling.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1410329871-28885-2-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-22 11:39:49 +01:00
Chrysostomos Nanakos 2f78e491d7 async: aio_context_new(): Handle event_notifier_init failure
On a system with a low limit of open files the initialization
of the event notifier could fail and QEMU exits without printing any
error information to the user.

The problem can be easily reproduced by enforcing a low limit of open
files and start QEMU with enough I/O threads to hit this limit.

The same problem raises, without the creation of I/O threads, while
QEMU initializes the main event loop by enforcing an even lower limit of
open files.

This commit adds an error message on failure:

 # qemu [...] -object iothread,id=iothread0 -object iothread,id=iothread1
 qemu: Failed to initialize event notifier: Too many open files in system

Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-22 11:39:48 +01:00
Jeff Cody e91a8b2fef block: vhdx - fix reading beyond pointer during image creation
In vhdx_create_metadata(), we allocate 40 bytes to entry_buffer for
the various metadata table entries.  However, we write out 64kB from
that buffer into the new file.  Only write out the correct 40 bytes.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-22 11:39:46 +01:00
Stefan Hajnoczi 550830f935 block: delete cow block driver
This patch removes support for the cow file format.

Normally we do not break backwards compatibility but in this case there
is no impact and it is the most logical option.  Extraordinary claims
require extraordinary evidence so I will show why removing the cow block
driver is the right thing to do.

The cow file format is the disk image format for Usermode Linux, a way
of running a Linux system in userspace.  The performance of UML was
never great and it was hacky, but it enjoyed some popularity before
hardware virtualization support became mainstream.

QEMU's block/cow.c is supposed to read this image file format.
Unfortunately the file format was underspecified:

1. Earlier Linux versions used the MAXPATHLEN constant for the backing
   filename field.  The value of MAXPATHLEN can change, so Linux
   switched to a 4096 literal but QEMU has a 1024 literal.

2. Padding was not used on the header struct (both in the Linux kernel
   and in QEMU) so the struct layout varied across architectures.  In
   particular, i386 and x86_64 were different due to int64_t alignment
   differences.  Linux now uses __attribute__((packed)), QEMU does not.

Therefore:

1. QEMU cow images do not conform to the Linux cow image file format.

2. cow images cannot be shared between different host architectures.

This means QEMU cow images are useless and QEMU has not had bug reports
from users actually hitting these issues.

Let's get rid of this thing, it serves no purpose and no one will be
affected.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1410877464-20481-1-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-22 11:39:45 +01:00