sdk/emulator/qemu.git
11 years agoMerge remote-tracking branch 'alon/libcacard_ccid.1' into staging
Anthony Liguori [Wed, 24 Apr 2013 18:23:26 +0000 (13:23 -0500)]
Merge remote-tracking branch 'alon/libcacard_ccid.1' into staging

# By Alon Levy (15) and others
# Via Alon Levy
* alon/libcacard_ccid.1: (28 commits)
  libcacard/cac: change big switch functions to single return point
  dev-smartcard-reader: empty implementation for Mechanical (fail correctly)
  libcacard: move atr setting from macro to function
  libcacard/vreader: add debugging messages for apdu
  dev-smartcard-reader: copy atr protocol to ccid parameters
  dev-smartcard-reader: change default protocol to T=0
  dev-smartcard-reader: define structs for CCID_Parameter internals
  ccid-card-passthru, dev-smartcard-reader: add debug environment variables
  ccid-card-passthru: add atr check
  libcacard: change default ATR
  dev-smartcard-reader: reuse usb.h definitions
  dev-smartcard-reader: support windows guest
  dev-smartcard-reader: remove aborts (never triggered, but just in case)
  dev-smartcard-reader: nicer debug messages
  dev-smartcard-reader: white space fixes
  libcacard: remove default libcoolkey loading
  libcacard: remove sql: prefix
  libcacard: teach vscclient to use GMainLoop for portability
  libcacard: vscclient to use QemuThread for portability
  libcacard: split vscclient main() from socket reading
  ...

Message-id: 921423767.1475937.1366790789930.JavaMail.root@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agobuild: include config-{, all-}devices.mak after defining CONFIG_SOFTMMU and CONFIG_US...
Paolo Bonzini [Tue, 16 Apr 2013 08:50:38 +0000 (10:50 +0200)]
build: include config-{, all-}devices.mak after defining CONFIG_SOFTMMU and CONFIG_USER_ONLY

Moving the inclusions closer to Makefile, and before rules.mak, makes
Makefile and Makefile.target more consistent with each other.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1366102238-12374-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: drop unused function prototypes.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:23 +0000 (10:21 +0200)]
virtio: drop unused function prototypes.

This removes the unused prototypes in virtio.h.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: cleanup: init and exit function.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:22 +0000 (10:21 +0200)]
virtio: cleanup: init and exit function.

This clean the init and the exit functions and rename virtio_common_cleanup
to virtio_cleanup.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: remove virtiobindings.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:21 +0000 (10:21 +0200)]
virtio: remove virtiobindings.

This remove virtio-bindings, and use class instead.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: remove the function pointer.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:20 +0000 (10:21 +0200)]
virtio: remove the function pointer.

This remove the function pointer in VirtIODevice, and use only
VirtioDeviceClass function pointer.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-pci: cleanup.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:19 +0000 (10:21 +0200)]
virtio-pci: cleanup.

This remove the init, exit functions as they are no longer used.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-bus: make virtio_x_bus_new static.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:18 +0000 (10:21 +0200)]
virtio-bus: make virtio_x_bus_new static.

virtio_x_bus_new are only used in file scope.
So this make them static.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-bus: add new functions.
KONRAD Frederic [Wed, 24 Apr 2013 08:21:17 +0000 (10:21 +0200)]
virtio-bus: add new functions.

This add two functions:
   * virtio_bus_set_vdev_config.
   * virtio_bus_set_vdev_feature.

Needed by virtio-ccw.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366791683-5350-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: cleanup: use QOM casts.
KONRAD Frederic [Wed, 24 Apr 2013 08:08:01 +0000 (10:08 +0200)]
virtio-rng: cleanup: use QOM casts.

As the virtio-rng-pci, virtio-rng-s390 and virtio-rng-ccw are
switched to the new API, we can use QOM casts.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-9-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: cleanup: remove qdev field.
KONRAD Frederic [Wed, 24 Apr 2013 08:08:00 +0000 (10:08 +0200)]
virtio-rng: cleanup: remove qdev field.

The qdev field is no longer needed, just drop it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: cleanup: init and exit functions.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:59 +0000 (10:07 +0200)]
virtio-rng: cleanup: init and exit functions.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-ccw: switch to the new API.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:58 +0000 (10:07 +0200)]
virtio-rng-ccw: switch to the new API.

Here the virtio-rng-ccw is modified for the new API. The device
virtio-rng-pci extends virtio-pci. It creates and connects a virtio-rng-device
during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-s390: switch to the new API.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:57 +0000 (10:07 +0200)]
virtio-rng-s390: switch to the new API.

Here the virtio-rng-s390 is modified for the new API. The device
virtio-rng-s390 extends virtio-s390-device as before. It creates and
connects a virtio-rng during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng-pci: switch to the new API.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:56 +0000 (10:07 +0200)]
virtio-rng-pci: switch to the new API.

Here the virtio-rng-pci is modified for the new API. The device
virtio-rng-pci extends virtio-pci. It creates and connects a virtio-rng-device
during the init. The properties are not changed.

The virtio_pci_reset function, is removed as no longer used.
The virtio_pci_rst function, is renamed virtio_pci_reset.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: add virtio-rng device.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:55 +0000 (10:07 +0200)]
virtio-rng: add virtio-rng device.

Create virtio-rng-device which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-rng: don't use pointer for configuration.
KONRAD Frederic [Wed, 24 Apr 2013 08:07:54 +0000 (10:07 +0200)]
virtio-rng: don't use pointer for configuration.

The configuration field must not be a pointer as it will be used for
virtio-rng properties. So *conf is replaced by conf.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1366790881-3026-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoinput: introduce keyboard handler list
Gerd Hoffmann [Wed, 24 Apr 2013 10:08:38 +0000 (12:08 +0200)]
input: introduce keyboard handler list

Add a linked list of keyboard handlers.  Added handlers will go
to the head of the list.  Removed handlers will be zapped from
the list.  The head of the list will be used for events.

This fixes the keyboard-dead-after-usb-kbd-unplug issue, key events
will be re-routed to the ps/2 kbd instead of being discarded.

[ v2: fix cut+paste bug found my Markus ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1366798118-3248-3-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoinput: make QEMUPutLEDEntry + QEMUPutMouseEntry private
Gerd Hoffmann [Wed, 24 Apr 2013 10:08:37 +0000 (12:08 +0200)]
input: make QEMUPutLEDEntry + QEMUPutMouseEntry private

There is no need for anybody outside ui/input.c to access the
struct elements.  Move the definitions, leaving only the typedefs
in the header files.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1366798118-3248-2-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoich9: kill cmos_s3
Hu Tao [Wed, 24 Apr 2013 10:37:22 +0000 (18:37 +0800)]
ich9: kill cmos_s3

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366799842-18550-1-git-send-email-hutao@cn.fujitsu.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agolibcacard/cac: change big switch functions to single return point
Alon Levy [Mon, 4 Mar 2013 19:43:36 +0000 (21:43 +0200)]
libcacard/cac: change big switch functions to single return point

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: empty implementation for Mechanical (fail correctly)
Alon Levy [Tue, 5 Mar 2013 15:31:10 +0000 (17:31 +0200)]
dev-smartcard-reader: empty implementation for Mechanical (fail correctly)

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard: move atr setting from macro to function
Alon Levy [Tue, 5 Mar 2013 14:27:43 +0000 (16:27 +0200)]
libcacard: move atr setting from macro to function

Only because qemu's checkpatch complains about it.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard/vreader: add debugging messages for apdu
Alon Levy [Tue, 5 Mar 2013 13:32:19 +0000 (15:32 +0200)]
libcacard/vreader: add debugging messages for apdu

Using g_debug with log domain libcacard

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: copy atr protocol to ccid parameters
Alon Levy [Mon, 4 Mar 2013 16:58:29 +0000 (18:58 +0200)]
dev-smartcard-reader: copy atr protocol to ccid parameters

Adds todos.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: change default protocol to T=0
Alon Levy [Wed, 27 Mar 2013 08:14:15 +0000 (10:14 +0200)]
dev-smartcard-reader: change default protocol to T=0

We don't support T=1 so we shouldn't advertise it by default.

Two independent changes:
* Default ATR
 sets T=0. This gets overwritten by the client provided ATR later.
* Class descriptor
 changes dwAdvertise dwProtocols.PPPP to 0x1 and dwProtocols.RRRR=0 per spec.

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: define structs for CCID_Parameter internals
Alon Levy [Mon, 4 Mar 2013 16:57:45 +0000 (18:57 +0200)]
dev-smartcard-reader: define structs for CCID_Parameter internals

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agoccid-card-passthru, dev-smartcard-reader: add debug environment variables
Alon Levy [Mon, 4 Mar 2013 16:41:28 +0000 (18:41 +0200)]
ccid-card-passthru, dev-smartcard-reader: add debug environment variables

Introduces a new utility function: parse_debug_env to avoid code
duplication.

This overrides whatever debug value is set on the corresponding devices
from the command line, and is meant to ease the usage with any
management stack. For libvirt you can set environment variables by
extending the dom namespace, i.e:

<domain type='kvm' id='3' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <qemu:commandline>
    <qemu:env name='QEMU_CCID_PASSTHRU_DEBUG' value='4'/>
    <qemu:env name='QEMU_CCID_DEBUG' value='4'/>
  </qemu:commandline>
</domain>

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agoccid-card-passthru: add atr check
Alon Levy [Mon, 4 Mar 2013 16:39:09 +0000 (18:39 +0200)]
ccid-card-passthru: add atr check

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard: change default ATR
Alon Levy [Tue, 5 Mar 2013 13:35:24 +0000 (15:35 +0200)]
libcacard: change default ATR

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: reuse usb.h definitions
Alon Levy [Tue, 5 Mar 2013 13:31:26 +0000 (15:31 +0200)]
dev-smartcard-reader: reuse usb.h definitions

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: support windows guest
Alon Levy [Mon, 4 Mar 2013 19:40:53 +0000 (21:40 +0200)]
dev-smartcard-reader: support windows guest

By not advertising USB wakeup support (which we don't).

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: remove aborts (never triggered, but just in case)
Alon Levy [Mon, 4 Mar 2013 16:55:07 +0000 (18:55 +0200)]
dev-smartcard-reader: remove aborts (never triggered, but just in case)

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: nicer debug messages
Alon Levy [Mon, 4 Mar 2013 16:50:33 +0000 (18:50 +0200)]
dev-smartcard-reader: nicer debug messages

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agodev-smartcard-reader: white space fixes
Alon Levy [Mon, 4 Mar 2013 16:45:49 +0000 (18:45 +0200)]
dev-smartcard-reader: white space fixes

Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agolibcacard: remove default libcoolkey loading
Marc-André Lureau [Wed, 20 Mar 2013 13:07:49 +0000 (14:07 +0100)]
libcacard: remove default libcoolkey loading

Use only the modules defined in the NSS database.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: remove sql: prefix
Marc-André Lureau [Wed, 20 Mar 2013 13:07:48 +0000 (14:07 +0100)]
libcacard: remove sql: prefix

For some reason, with sql:/ prefix, the PKCS11 modules are not loaded.

This patch goes on top of Alon smartcard series.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: teach vscclient to use GMainLoop for portability
Marc-André Lureau [Mon, 25 Feb 2013 22:31:16 +0000 (23:31 +0100)]
libcacard: teach vscclient to use GMainLoop for portability

This version handles non-blocking sending and receiving from the
socket.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: vscclient to use QemuThread for portability
Marc-André Lureau [Mon, 25 Feb 2013 22:31:15 +0000 (23:31 +0100)]
libcacard: vscclient to use QemuThread for portability

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: split vscclient main() from socket reading
Marc-André Lureau [Mon, 25 Feb 2013 22:31:14 +0000 (23:31 +0100)]
libcacard: split vscclient main() from socket reading

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: fix mingw64 cross-compilation
Marc-André Lureau [Mon, 25 Feb 2013 22:31:13 +0000 (23:31 +0100)]
libcacard: fix mingw64 cross-compilation

Compile and link with version.lo

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agobuild-sys: must link with -fstack-protector
Marc-André Lureau [Mon, 25 Feb 2013 22:31:12 +0000 (23:31 +0100)]
build-sys: must link with -fstack-protector

It is needed to give that flag to the linker as well, but latest
libtool 2.4.2 still swallows that argument, so let's pass it with
libtool -Wc argument.

qemu-1.4.0/stubs/arch-query-cpu-def.c:6: undefined reference to `__stack_chk_guard'

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agoutil: move socket_init() to osdep.c
Marc-André Lureau [Mon, 25 Feb 2013 22:31:11 +0000 (23:31 +0100)]
util: move socket_init() to osdep.c

vscclient needs to call socket_init() for portability.
Moving to osdep.c since it has no internal dependency.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: use system config directory for nss db on win32
Marc-André Lureau [Wed, 27 Feb 2013 20:08:06 +0000 (21:08 +0100)]
libcacard: use system config directory for nss db on win32

It's a bit nicer to look for default database under
CSIDL_COMMON_APPDATA\pki\nss rather that /etc/pki/nss.

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agoccid: declare DEFAULT_ATR table to be "static const"
Jim Meyering [Mon, 21 May 2012 19:51:33 +0000 (21:51 +0200)]
ccid: declare DEFAULT_ATR table to be "static const"

Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agoccid: make backend_enum_table "static const" and adjust users
Jim Meyering [Mon, 21 May 2012 19:56:20 +0000 (21:56 +0200)]
ccid: make backend_enum_table "static const" and adjust users

Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
11 years agoccid-card-emul: do not crash if backend is not provided
Marc-André Lureau [Wed, 21 Nov 2012 13:16:08 +0000 (14:16 +0100)]
ccid-card-emul: do not crash if backend is not provided

Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:164
164               movdqu        (%rsi), %xmm2
(gdb) bt
    at /home/elmarco/320g/src/qemu/hw/ccid-card-emulated.c:477
    at /home/elmarco/320g/src/qemu/hw/ccid-card-emulated.c:503

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agolibcacard: correct T0 historical bytes size
Marc-André Lureau [Sun, 2 Dec 2012 21:00:55 +0000 (22:00 +0100)]
libcacard: correct T0 historical bytes size

The VCARD_ATR_PREFIX macro adds a prefix of 6 characters only.

pcsc_scan was complaining before the patch:

+ Historical bytes: 56 43 41 52 44 5F 4E 53 53
 ERROR! ATR is truncated: 2 byte(s) is/are missing

Signed-off-by: Marc-André Lureau <mlureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
11 years agoMove TPM passthrough specific command line options to backend structure
Stefan Berger [Mon, 22 Apr 2013 14:41:39 +0000 (10:41 -0400)]
Move TPM passthrough specific command line options to backend structure

Move the TPM passthrough specific command line options to the passthrough
backend implementation and attach them to the backend's interface structure.

Add code to tpm.c for validating the TPM command line options.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Corey Bryan <coreyb@linux.vnet.ibm.com>
Message-id: 1366641699-21420-1-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-9p: cleanup: QOM casts.
KONRAD Frederic [Tue, 23 Apr 2013 09:08:43 +0000 (11:08 +0200)]
virtio-9p: cleanup: QOM casts.

As the virtio-9p-pci is switched to the new API, we can use QOM casts.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366708123-19626-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-9p: cleanup: init function.
KONRAD Frederic [Tue, 23 Apr 2013 09:08:42 +0000 (11:08 +0200)]
virtio-9p: cleanup: init function.

This remove old init function as it is no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366708123-19626-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-9p-pci: switch to the new API.
KONRAD Frederic [Tue, 23 Apr 2013 09:08:41 +0000 (11:08 +0200)]
virtio-9p-pci: switch to the new API.

Here the virtio-9p-pci is modified for the new API. The device
virtio-9p-pci extends virtio-pci. It creates and connects a
virtio-9p-device during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366708123-19626-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-9p: add the virtio-9p device.
KONRAD Frederic [Tue, 23 Apr 2013 09:08:40 +0000 (11:08 +0200)]
virtio-9p: add the virtio-9p device.

Create virtio-9p-device which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1366708123-19626-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoui/gtk: Add Turkish translations
Ozan Çağlayan [Tue, 23 Apr 2013 10:04:16 +0000 (13:04 +0300)]
ui/gtk: Add Turkish translations

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Message-id: 1366711456-1935-1-git-send-email-ozancag@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoui/gtk: Use gtk_widget_get_window() to support both gtk2 and gtk3
Ozan Çağlayan [Tue, 23 Apr 2013 10:03:22 +0000 (13:03 +0300)]
ui/gtk: Use gtk_widget_get_window() to support both gtk2 and gtk3

This fixes build with gtk+-3.0.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Message-id: 1366711402-1750-1-git-send-email-ozancag@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.81' into staging
Anthony Liguori [Tue, 23 Apr 2013 15:33:45 +0000 (10:33 -0500)]
Merge remote-tracking branch 'kraxel/usb.81' into staging

# By Gerd Hoffmann (3) and Hans de Goede (1)
# Via Gerd Hoffmann
* kraxel/usb.81:
  usb-host: raise libusbx minimum version to 1.0.13
  usb: better speed mismatch error reporting
  ehci_free_packet: Discard finished packets when the queue is halted
  xhci: remove XHCIRing->base (unused)

Message-id: 1366705929-11251-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agousb-host: raise libusbx minimum version to 1.0.13
Gerd Hoffmann [Thu, 18 Apr 2013 10:16:44 +0000 (12:16 +0200)]
usb-host: raise libusbx minimum version to 1.0.13

Allows to remove one FIXME.  Makes LIBUSB_LOG_LEVEL_WARNING build errors
go away.  And starting with that version libusb has a LIBUSBX_API_VERSION
define which allows to easily #ifdef version dependencies should that
need arrive in the future.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: better speed mismatch error reporting
Gerd Hoffmann [Thu, 18 Apr 2013 09:57:21 +0000 (11:57 +0200)]
usb: better speed mismatch error reporting

Report the supported speeds for device and port in the error message.
Also add the speeds to the tracepoint.  And while being at it drop
the redundant error message in usb_desc_attach, usb_device_attach will
report the error anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoehci_free_packet: Discard finished packets when the queue is halted
Hans de Goede [Tue, 9 Apr 2013 08:24:22 +0000 (10:24 +0200)]
ehci_free_packet: Discard finished packets when the queue is halted

With pipelining it is possible to encounter a finished packet when cleaning
the queue due to a halt. This happens when a non stall error happens while
talking to a real device. In this case the queue on the usb-host side will
continue processing packets, and we can have completed packets waiting in
the queue after an error condition packet causing a halt.

There are 2 reasons to discard the completed packets at this point, rather
then trying to writing them back to the guest:

1) The guest expect to be able to cancel and/or change packets after the
packet with the error without doing an unlink, so writing them back may
confuse the guest.

2) Since the queue does not advance when halted, the writing back of these
packets will fail anyways since p->qtdaddr != q->qtdaddr, so the
ehci_verify_qtd call in ehci_writeback_async_complete_packet will fail.

Note that 2) means that then only functional change this patch introduces
is the printing of a warning when this scenario happens.

Note that discarding these packets means that the guest driver and the device
will get out of sync! This is unfortunate, but should not be a problem since
with a non stall error (iow an io-error) the 2 are out of sync already anyways.
Still this patch adds a warning to signal this happening.

Note that sofar this has only been seen with a DVB-T receiver, which gives
of a MPEG-2 stream, which allows for recovering from lost packets, see:
https://bugzilla.redhat.com/show_bug.cgi?id=890320

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: remove XHCIRing->base (unused)
Gerd Hoffmann [Fri, 5 Apr 2013 11:03:08 +0000 (13:03 +0200)]
xhci: remove XHCIRing->base (unused)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoblock: Fix build with tracing enabled
Kevin Wolf [Mon, 22 Apr 2013 15:48:40 +0000 (17:48 +0200)]
block: Fix build with tracing enabled

filename was still uninitialised when it's used as a parameter to a
tracing function, so let's move the initialisation. Also, commit c2ad1b0c
forgot to add a NULL check, which this patch adds while we're at it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Message-id: 1366645720-11384-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotpm: Simplify creation of cancel path
Stefan Berger [Tue, 16 Apr 2013 21:08:36 +0000 (17:08 -0400)]
tpm: Simplify creation of cancel path

Simplify the creation of the cancel path given the TPM's device path.
Given the path /dev/tpm0 build the path /sys/class/misc/tpm0/device/cancel.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1366146516-23814-1-git-send-email-stefanb@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqtest: Handle addresses and values for {in, out}[bwl] as unsigned
Peter Maydell [Sun, 21 Apr 2013 13:30:03 +0000 (14:30 +0100)]
qtest: Handle addresses and values for {in, out}[bwl] as unsigned

Handle the addresses and values for {in,out}[bwl] as unsigned (ie
with strtoul), as per the protocol specification comment. This fixes
a test failure in test_i440fx_defaults on 32-bit hosts where the test
tries to write 0x80000000 and qtest was instead writing 0x7fffffff.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1366551003-16649-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoAdd option to mlock qemu and guest memory
Satoru Moriya [Fri, 19 Apr 2013 14:42:06 +0000 (16:42 +0200)]
Add option to mlock qemu and guest memory

In certain scenario, latency induced by paging is significant and
memory locking is needed. Also, in the scenario with untrusted
guests, latency improvement due to mlock is desired.

This patch introduces a following new option to mlock guest and
qemu memory:

-realtime mlock=on|off

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366382526-26146-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: do not operate on sources from finalize callbacks
Paolo Bonzini [Fri, 19 Apr 2013 15:32:09 +0000 (17:32 +0200)]
qemu-char: do not operate on sources from finalize callbacks

Due to a glib bug, the finalize callback is called with the GMainContext
lock held.  Thus, any operation on the context from the callback will
cause recursive locking and a deadlock.  This happens, for example,
when a client disconnects from a socket chardev.

The fix for this is somewhat ugly, because we need to forego polymorphism
and implement our own function to destroy IOWatchPoll sources.  The
right thing to do here would be child sources, but we support older
glib versions that do not have them.  Not coincidentially, glib developers
found and fixed the deadlock as part of implementing child sources.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Message-id: 1366385529-10329-5-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: correct return value from chr_read functions
Paolo Bonzini [Fri, 19 Apr 2013 15:32:08 +0000 (17:32 +0200)]
qemu-char: correct return value from chr_read functions

Even if a CharDriverState's source is blocked by the front-end,
it must not be dropped. The IOWatchPoll that wraps it will take
care of adding and removing it to the main loop.  Only remove
the source when the channel is closed; and in that case, make sure
that the wrapping IOWatchPoll is removed too.

These should just be theoretical bugs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366385529-10329-4-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: simplify pty polling
Paolo Bonzini [Fri, 19 Apr 2013 15:32:07 +0000 (17:32 +0200)]
qemu-char: simplify pty polling

There is no need to use a timer and pty_chr_read to detect a connected
pty.  It is simpler to just call g_poll periodically and check for POLLHUP.
It is done once per second, and only if the pty is disconnected, so it
is cheap enough.

Tested with "-monitor pty" and "-serial mon:pty", both of which work
correctly and do not freeze QEMU.  (How to test ptys?  "socat -,raw,echo=0
/dev/pts/4,raw").

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366385529-10329-3-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: use consistent idiom for removing sources
Paolo Bonzini [Fri, 19 Apr 2013 15:32:06 +0000 (17:32 +0200)]
qemu-char: use consistent idiom for removing sources

Always check that the source is active, and zero the tag afterwards.

The occurrence in pty_chr_state will trigger with the next patch, the
others are just theoretical.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366385529-10329-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotranslate-all: fix compiler warning and linked error
Alexey Kardashevskiy [Mon, 22 Apr 2013 07:42:50 +0000 (17:42 +1000)]
translate-all: fix compiler warning and linked error

The code did use profile_getclock() but did not include
include/qemu/timer.h where this function is defined. The patch fixes this.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-id: 1366616571-4321-1-git-send-email-aik@ozlabs.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 22 Apr 2013 13:08:22 +0000 (08:08 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Kevin Wolf (16) and Stefan Hajnoczi (4)
# Via Kevin Wolf
* kwolf/for-anthony:
  qemu-iotests: add 053 unaligned compressed image size test
  block: Allow overriding backing.file.filename
  block: Remove filename parameter from .bdrv_file_open()
  vvfat: Use bdrv_open options instead of filename
  sheepdog: Use bdrv_open options instead of filename
  rbd: Use bdrv_open options instead of filename
  iscsi: Use bdrv_open options instead of filename
  gluster: Use bdrv_open options instead of filename
  curl: Use bdrv_open options instead of filename
  blkverify: Use bdrv_open options instead of filename
  blkdebug: Use bdrv_open options instead of filename
  raw-win32: Use bdrv_open options instead of filename
  raw-posix: Use bdrv_open options instead of filename
  block: Enable filename option
  block: Add driver-specific options for backing files
  block: Fail gracefully when using a format driver on protocol level
  qemu-iotests: Fix _filter_qemu
  qemu-img: do not zero-pad the compressed write buffer
  qcow: allow sub-cluster compressed write to last cluster
  qcow2: allow sub-cluster compressed write to last cluster

Message-id: 1366630294-18984-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Mon, 22 Apr 2013 13:05:14 +0000 (08:05 -0500)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

# By Stefan Hajnoczi
# Via Paolo Bonzini
* bonzini/nbd-next:
  nbd: set TCP_NODELAY
  nbd: use TCP_CORK in nbd_co_send_request()
  nbd: unlock mutex in nbd_co_send_request() error path

Message-id: 1366381830-11267-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 22 Apr 2013 13:05:05 +0000 (08:05 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Paolo Bonzini (5) and others
# Via Paolo Bonzini
* bonzini/scsi-next:
  vhost-scsi-s390: new device supporting the tcm_vhost Linux kernel module
  vhost-scsi-ccw: new device supporting the tcm_vhost Linux kernel module
  vhost-scsi-pci: new device supporting the tcm_vhost Linux kernel module
  vhost-scsi: new device supporting the tcm_vhost Linux kernel module
  virtio: simplify Makefile conditionals
  virtio-scsi: create VirtIOSCSICommon
  vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping
  scsi: VMWare PVSCSI paravirtual device implementation
  scsi: avoid assertion failure on VERIFY command

Message-id: 1366381460-6041-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Mon, 22 Apr 2013 13:04:21 +0000 (08:04 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Amos Kong (1) and Luiz Capitulino (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  virtio-balloon: fix integer overflow in BALLOON_CHANGE QMP event
  monitor: fix the wrong order of releasing keys

Message-id: 1366375833-995-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-iotests: add 053 unaligned compressed image size test
Stefan Hajnoczi [Tue, 16 Apr 2013 09:14:23 +0000 (11:14 +0200)]
qemu-iotests: add 053 unaligned compressed image size test

Test that qemu-img convert -c works when input image length is not a
multiple of the cluster size.

Previously an error message would be produced:

  qemu-img: error while compressing sector 0: Input/output error

Now that qcow2 and qcow handle this case the test passes successfully.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Allow overriding backing.file.filename
Kevin Wolf [Fri, 12 Apr 2013 18:27:07 +0000 (20:27 +0200)]
block: Allow overriding backing.file.filename

If a filename is passed in the driver-specific options from the command
line, the backing file path from the image is ignored now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Remove filename parameter from .bdrv_file_open()
Kevin Wolf [Fri, 12 Apr 2013 18:02:37 +0000 (20:02 +0200)]
block: Remove filename parameter from .bdrv_file_open()

It is unused now in all block drivers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agovvfat: Use bdrv_open options instead of filename
Kevin Wolf [Fri, 12 Apr 2013 17:42:04 +0000 (19:42 +0200)]
vvfat: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agosheepdog: Use bdrv_open options instead of filename
Kevin Wolf [Fri, 12 Apr 2013 16:10:49 +0000 (18:10 +0200)]
sheepdog: Use bdrv_open options instead of filename

This is only to convert the internal interface that is used for passing
the "filename" to be parsed, but converting to actual fine grained
options is left for another day, as it doesn't look trivial.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agorbd: Use bdrv_open options instead of filename
Kevin Wolf [Fri, 12 Apr 2013 16:05:35 +0000 (18:05 +0200)]
rbd: Use bdrv_open options instead of filename

This is only to convert the internal interface that is used for passing
the "filename" to be parsed, but converting to actual fine grained
options is left for another day, as it doesn't look trivial.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoiscsi: Use bdrv_open options instead of filename
Kevin Wolf [Fri, 12 Apr 2013 15:59:59 +0000 (17:59 +0200)]
iscsi: Use bdrv_open options instead of filename

This is only to convert the internal interface that is used for passing
the "filename" to be parsed, but converting to actual fine grained
options is left for another day, as it doesn't look trivial.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agogluster: Use bdrv_open options instead of filename
Kevin Wolf [Fri, 12 Apr 2013 15:50:16 +0000 (17:50 +0200)]
gluster: Use bdrv_open options instead of filename

This is only to convert the internal interface that is used for passing
the "filename" to be parsed, but converting to actual fine grained
options is left for another day, as it doesn't look trivial.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agocurl: Use bdrv_open options instead of filename
Kevin Wolf [Wed, 10 Apr 2013 13:31:33 +0000 (15:31 +0200)]
curl: Use bdrv_open options instead of filename

As a bonus, going through the QemuOpts QEMU_OPT_SIZE parser for the
readahead option gives us proper error reporting that the previous use
of atoi() lacked.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblkverify: Use bdrv_open options instead of filename
Kevin Wolf [Wed, 10 Apr 2013 12:40:28 +0000 (14:40 +0200)]
blkverify: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblkdebug: Use bdrv_open options instead of filename
Kevin Wolf [Wed, 10 Apr 2013 11:37:33 +0000 (13:37 +0200)]
blkdebug: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoraw-win32: Use bdrv_open options instead of filename
Kevin Wolf [Wed, 10 Apr 2013 09:34:56 +0000 (11:34 +0200)]
raw-win32: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoraw-posix: Use bdrv_open options instead of filename
Kevin Wolf [Tue, 2 Apr 2013 08:47:40 +0000 (10:47 +0200)]
raw-posix: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Enable filename option
Kevin Wolf [Tue, 9 Apr 2013 12:34:19 +0000 (14:34 +0200)]
block: Enable filename option

This allows using the file.filename option instead of the string that
comes from -drive file=... and is passed around as a separate parameter.
The goal is to get rid of this parameter and use the options QDict more
consistently.

With this option you can access not only the top-level image, but
specify a filename for the backing file (currently only if no backing
file exists, but we'll allow overriding it later)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Add driver-specific options for backing files
Kevin Wolf [Thu, 28 Mar 2013 14:29:24 +0000 (15:29 +0100)]
block: Add driver-specific options for backing files

Options starting in "backing." are passed to the backing file now. If
you don't need to specify the filename for the backing file, you can add
it on the command line instead of in the image file:

$ qemu-nbd -t /tmp/test.img
$ qemu-img create -f qcow2 empty.qcow2 1G
$ qemu-system-x86_64 -drive file=empty.qcow2,backing.file.driver=nbd,\
    backing.file.host=localhost

Note that this doesn't override the backing filename from the image. If
the image has one, this will fail because NBD doesn't want the options
and a filename at the same time.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Fail gracefully when using a format driver on protocol level
Kevin Wolf [Tue, 9 Apr 2013 11:19:18 +0000 (13:19 +0200)]
block: Fail gracefully when using a format driver on protocol level

Specifying the wrong driver could fail an assertion:

$ qemu-system-x86_64 -drive file.driver=qcow2,file=x
qemu-system-x86_64: block.c:721: bdrv_open_common: Assertion `file !=
((void *)0)' failed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Fix _filter_qemu
Kevin Wolf [Tue, 16 Apr 2013 09:22:36 +0000 (11:22 +0200)]
qemu-iotests: Fix _filter_qemu

$QEMU_PROG happens to be 'qemu' in my setup, so this sed command
replaces a bit too much. Restrict it to the start of the line and to
when it's followed by a colon, i.e. the form used by error messages.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: do not zero-pad the compressed write buffer
Stefan Hajnoczi [Mon, 15 Apr 2013 15:17:33 +0000 (17:17 +0200)]
qemu-img: do not zero-pad the compressed write buffer

bdrv_write_compressed() does not allow requests that span the end of the
device.  Therefore it is useless to zero-pad the last cluster and
thereby exceed the end of the device.

Let image formats handle zero-padding the final compressed cluster, if
necessary.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow: allow sub-cluster compressed write to last cluster
Stefan Hajnoczi [Mon, 15 Apr 2013 15:17:32 +0000 (17:17 +0200)]
qcow: allow sub-cluster compressed write to last cluster

Compression in qcow requires image length to be a multiple of the
cluster size.  Lift this requirement by zero-padding the final cluster
when necessary.  The virtual disk size is still not cluster-aligned, so
the guest cannot access the zero sectors.

Note that this is almost identical to the qcow2 version of this code.
qcow2's compression code is drawn from qcow.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: allow sub-cluster compressed write to last cluster
Stefan Hajnoczi [Mon, 15 Apr 2013 15:17:31 +0000 (17:17 +0200)]
qcow2: allow sub-cluster compressed write to last cluster

Compression in qcow2 requires image length to be a multiple of the
cluster size.  Lift this requirement by zero-padding the final cluster
when necessary.  The virtual disk size is still not cluster-aligned, so
the guest cannot access the zero sectors.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoui/cocoa.m: Fix recent compile breakage
Peter Maydell [Wed, 17 Apr 2013 09:16:35 +0000 (09:16 +0000)]
ui/cocoa.m: Fix recent compile breakage

Fix failures to compile introduced by recent console commits
1dbfa0050381c0d5a6) which removed is_graphic_console() and
vga_hw_update() without updating the cocoa UI backend to match.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoi386 ROR r8/r16 instruction fix
Pavel Dovgaluk [Mon, 15 Apr 2013 06:59:15 +0000 (10:59 +0400)]
i386 ROR r8/r16 instruction fix

Fixed EFLAGS corruption by ROR r8/r16 instruction located at the end of the TB.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoqdev: Drop taddr properties
Peter Maydell [Sat, 20 Apr 2013 13:48:28 +0000 (14:48 +0100)]
qdev: Drop taddr properties

Drop all the infrastructure for taddr properties (ie ones which
are 'hwaddr' sized). These are now unused, and any further desired
use would be rather questionable since device properties shouldn't
generally depend on a type that is conceptually variable based on
the target CPU. 32 or 64 bit integer properties should be used instead
as appropriate for the specific device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agohw/sm501: Use correct setter for sysbus-ohci dma-address property
Peter Maydell [Sat, 20 Apr 2013 13:48:27 +0000 (14:48 +0100)]
hw/sm501: Use correct setter for sysbus-ohci dma-address property

The sysbus-ohci dma-address property is declared as a HEX64
property, not a TADDR, so use the correct setter for it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 20 Apr 2013 11:39:08 +0000 (11:39 +0000)]
Merge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  hw/versatile_pci: Drop unnecessary vpb_pci_config_addr()
  versatile_pci: Expose PCI memory space to system
  arm/realview: Fix mapping of PCI regions
  versatile_pci: Implement the PCI controller's control registers
  versatile_pci: Implement the correct PCI IRQ mapping
  versatile_pci: Put the host bridge PCI device at slot 29
  versatile_pci: Use separate PCI I/O space rather than system I/O space
  versatile_pci: Change to subclassing TYPE_PCI_HOST_BRIDGE
  versatile_pci: Update to realize and instance init functions
  versatile_pci: Expose PCI I/O region on Versatile PB
  versatile_pci: Fix hardcoded tabs

11 years agoMerge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 20 Apr 2013 11:38:48 +0000 (11:38 +0000)]
Merge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Correctly restore FPSCR
  target-arm: Add some missing CPU state fields to VMState
  target-arm: port ARM CPU save/load to use VMState
  target-arm: Reinsert missing return statement in ARM mode SRS decode

11 years agoMerge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio...
Blue Swirl [Sat, 20 Apr 2013 11:38:29 +0000 (11:38 +0000)]
Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu

* 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu:
  linux-user: fix setgroups/getgroups for non-UID16 archs
  linux-user: fix undefined shift in copy_to_user_fdset
  linux-user: change do_semop to return target errno when unsuccessful