Commit graph

26524 commits

Author SHA1 Message Date
KONRAD Frederic 6eac8aec02 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>
2013-04-24 11:50:19 -05:00
KONRAD Frederic af1a8ad646 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>
2013-04-24 11:50:19 -05:00
Gerd Hoffmann 5a37532d08 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>
2013-04-24 11:50:18 -05:00
Gerd Hoffmann 72711efb58 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>
2013-04-24 11:50:18 -05:00
Hu Tao a3ac6b53d4 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>
2013-04-24 11:50:18 -05:00
Alon Levy 57f97834ef 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>
2013-04-24 11:48:06 +03:00
Alon Levy 58aeda15ab 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>
2013-04-24 11:48:04 +03:00
Alon Levy 0b6a16c1a4 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>
2013-04-24 11:48:03 +03:00
Alon Levy 7a68589624 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>
2013-04-24 11:48:02 +03:00
Alon Levy 2f8f916b6d 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>
2013-04-24 11:48:00 +03:00
Alon Levy d7d218ef02 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>
2013-04-24 11:47:59 +03:00
Alon Levy 4942d6c394 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>
2013-04-24 11:47:58 +03:00
Alon Levy b16352acf3 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>
2013-04-24 11:47:57 +03:00
Alon Levy 0e61400c19 ccid-card-passthru: add atr check
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:47:55 +03:00
Alon Levy a26dfd95d3 libcacard: change default ATR
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:47:54 +03:00
Alon Levy 693e47738d dev-smartcard-reader: reuse usb.h definitions
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:47:53 +03:00
Alon Levy c5cd7c8756 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>
2013-04-24 11:47:52 +03:00
Alon Levy 47bf53af75 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>
2013-04-24 11:47:50 +03:00
Alon Levy 7e1ac5abe3 dev-smartcard-reader: nicer debug messages
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:47:49 +03:00
Alon Levy 4543d43c61 dev-smartcard-reader: white space fixes
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-04-24 11:47:48 +03:00
Marc-André Lureau ad2181f2b6 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>
2013-04-24 11:47:47 +03:00
Marc-André Lureau 667e0b4b68 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>
2013-04-24 11:47:45 +03:00
Marc-André Lureau c9495ee9eb 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>
2013-04-24 11:47:44 +03:00
Marc-André Lureau 930c8ad472 libcacard: vscclient to use QemuThread for portability
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:42 +03:00
Marc-André Lureau a50b831ae1 libcacard: split vscclient main() from socket reading
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
2013-04-24 11:47:41 +03:00
Marc-André Lureau 5354e4d242 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>
2013-04-24 11:47:40 +03:00
Marc-André Lureau 37746c5eac 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>
2013-04-24 11:47:38 +03:00
Marc-André Lureau d3bf825e59 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>
2013-04-24 11:47:37 +03:00
Marc-André Lureau e2d9c5e769 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>
2013-04-24 11:47:36 +03:00
Jim Meyering da000a4867 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>
2013-04-24 11:47:35 +03:00
Jim Meyering d18c711746 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>
2013-04-24 11:47:34 +03:00
Marc-André Lureau d0ebd78890 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>
2013-04-24 11:47:32 +03:00
Marc-André Lureau e2fd2115ce 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>
2013-04-24 11:47:31 +03:00
Stefan Berger bb71623811 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>
2013-04-23 10:40:40 -05:00
KONRAD Frederic 13daf6cad0 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>
2013-04-23 10:37:49 -05:00
KONRAD Frederic e8111e5055 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>
2013-04-23 10:37:49 -05:00
KONRAD Frederic 234a336f9e 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>
2013-04-23 10:37:49 -05:00
KONRAD Frederic e7303c4303 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>
2013-04-23 10:37:49 -05:00
Ozan Çağlayan 93b971c4ff 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>
2013-04-23 10:37:38 -05:00
Ozan Çağlayan 571253d410 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>
2013-04-23 10:37:32 -05:00
Anthony Liguori 2cfd5cc06a 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>
2013-04-23 10:33:45 -05:00
Gerd Hoffmann 3f5cc97e2b 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>
2013-04-23 08:43:10 +02:00
Gerd Hoffmann 3b7e759a41 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>
2013-04-23 08:43:10 +02:00
Hans de Goede e449f26bed 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>
2013-04-23 08:43:10 +02:00
Gerd Hoffmann 7d04c2b755 xhci: remove XHCIRing->base (unused)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-23 08:43:10 +02:00
Kevin Wolf 456736710d 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>
2013-04-22 11:31:41 -05:00
Stefan Berger 8e36d6ca34 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>
2013-04-22 09:30:13 -05:00
Peter Maydell 56863d4f19 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>
2013-04-22 09:11:50 -05:00
Satoru Moriya 888a6bc63c 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>
2013-04-22 08:52:23 -05:00
Paolo Bonzini 2b316774f6 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>
2013-04-22 08:52:21 -05:00