Commit Graph

16230 Commits

Author SHA1 Message Date
Gerd Hoffmann f40d550816 vns/tls: don't use depricated gnutls functions
Avoid using deprecated gnutls functions with recent gnutls versions.
Fixes build failure on Fedora 16.  Keep the old way for compatibility
with old installations such as RHEL-5 (gnutls 1.4.x).

Based on a patch from Raghavendra D Prabhu <raghu.prabhu13@gmail.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:17 -05:00
Gerd Hoffmann fa4e49c0c0 Use hex instead of binary.
Older gcc versions don't understand 0b<bits>,
use hex representation instead.

Fixes build failure on RHEL-5.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Gerd Hoffmann ad8b818686 Don't use g_thread_get_initialized.
Initialize glib threads unconditionally in main() instead
of using g_thread_get_initialized in the 9p code.

Fixes a build failure on RHEL-5, which ships glib 2.12.
g_thread_get_initialized was added in 2.20.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Avi Kivity 36b586284e qemu_vmalloc: align properly for transparent hugepages and KVM
To make good use of transparent hugepages, KVM requires that guest-physical
and host-virtual addresses share the low 21 bits (as opposed to just the low
12 bits normally required).

Adjust qemu_vmalloc() to honor that requirement.  Ignore it for small regions
to avoid fragmentation.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Devin J. Pohly df00bed0fa curses: fix garbling when chtype != long
Qemu currently assumes that chtype is typedef'd to unsigned long, but
this is not necessarily the case (ncurses, for instance, can configure
this at build-time).  This patch uses the predefined chtype if qemu is
configured for curses support and falls back to unsigned long otherwise.

Fixes bug 568614.

Signed-off-by: Devin J. Pohly <djpohly+launchpad@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Amit Shah 3b86b13ab0 virtio-balloon: Disassociate from the balloon handlers on unplug
Adding a 2nd balloon device after unplugging the first one doesn't work.
Also, the 'info balloon' command should indicate an error mentioning no
balloon device is registered after unplug.

Reproduction steps given by Shaolong Hu:

(qemu) info balloon
Device 'balloon' has not been activated by the guest
(qemu) device_add virtio-balloon-pci,id=balloon1
(qemu) info balloon
balloon: actual=4096
(qemu) balloon 2048
(qemu) info balloon
balloon: actual=2048
(qemu) device_del balloon1
(qemu) info balloon
balloon: actual=4096
(qemu) balloon 2048
(qemu) info balloon
balloon: actual=4096
(qemu) device_del balloon1
Device 'balloon1' not found
(qemu) device_add virtio-balloon-pci,id=balloon1
Another balloon device already registered
Device 'virtio-balloon-pci' could not be initialized
(qemu) device_add virtio-balloon-pci,id=balloon2
Another balloon device already registered
Device 'virtio-balloon-pci' could not be initialized

Reported-by: Shaolong Hu <shu@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Amit Shah 8a7d552cb3 balloon: Disassociate handlers from balloon device on unplug
When a balloon device gets unplugged, allow the balloon handlers to be
freed.

Reported-by: Shaolong Hu <shu@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Thomas Huth e89720b116 tcg/ppc64: Fix zero extension code generation bug for ppc64 host
The ppc64 code generation backend uses an rldicr (Rotate Left Double
Immediate and Clear Right) instruction to implement zero extension of
a 32 bit quantity to a 64 bit quantity (INDEX_op_ext32u_i64).  However
this is wrong - this instruction clears specified low bits of the
value, instead of high bits as we require for a zero extension.  It
should instead use an rldicl (Rotate Left Double Immediate and Clear
Left) instruction.

Presumably amongst other things, this causes the SLOF firmware image
used with -M pseries to not boot on a ppc64 host.

It appears this bug was exposed by commit
0bf1dbdcc9 (tcg/ppc64: fix 16/32 mixup)
which enabled the use of the op_ext32u_i64 operation on the ppc64
backend.

Signed-off-by: Thomas Huth <thuth@de.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: malc <av1474@comtv.ru>
2011-09-09 19:07:06 +04:00
Anthony Liguori 07ff2c4475 Merge remote-tracking branch 'origin/master' into staging 2011-09-08 09:25:36 -05:00
Richard Henderson 8278604134 target-i386: Compute all flag data inside %cl != 0 test.
The (x << (cl - 1)) quantity is only used if CL != 0.  Move the
computation of that quantity nearer its use.

This avoids the creation of undefined TCG operations when the
constant propagation optimization proves that CL == 0, and thus
CL-1 is outside the range [0-wordsize).

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
2011-09-08 18:10:16 +04:00
Anthony Liguori 573da34a41 Merge remote-tracking branch 'spice/spice.v42' into staging 2011-09-08 09:07:57 -05:00
Anthony Liguori 13baae8aff Merge remote-tracking branch 'qmp/queue/qmp' into staging 2011-09-08 09:07:13 -05:00
Anthony Liguori 220724ca4a Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-09-08 09:05:14 -05:00
Anthony Liguori d8ac46d950 Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging 2011-09-08 09:03:57 -05:00
Anthony Liguori 9d0baba110 Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-09-08 08:59:32 -05:00
Anthony Liguori a60fce0bcc Merge remote-tracking branch 'kraxel/usb.26' into staging 2011-09-08 08:57:33 -05:00
Anthony Liguori 63236c15e9 Merge remote-tracking branch 'aneesh/for-upstream-3' into staging 2011-09-08 08:52:59 -05:00
Anthony Liguori c82dc29a91 iohandlers: fix issue with qemu_set_fd_handler()
As spotted by Aneesh, some users pass a NULL opaque so we need to be more
aggressive in checking whether a user means to unregister.

Also fix a double free caused by tag not being reset to zero after delete.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-08 08:06:08 -05:00
Juha Riihimäki 5b1cdb4ead usb-musb: Add reset function
Add a separate reset function musb_reset() to the usb-musb interface,
so that users who implement a reset function can also reset usb-musb.
Use this in tusb6010.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by:  Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Peter Maydell 406c20754a usb-musb: Take a DeviceState* in init function
Initialise usb-musb by passing it a DeviceState* and the offset of the
IRQs in its gpio array, rather than a plain pointer to an irq array.
This is simpler for callers and also allows us to pass in a valid parent
to usb_bus_new(), so the USB bus actually appears in the qdev tree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Peter Maydell 9147b75288 usb: Remove leading underscores from __musb_irq_max
Identifiers with double leading underscore are reserved, so rename
__musb_irq_max so we don't encroach on reserved namespace.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Gerd Hoffmann d679157868 usb-host: tag as unmigratable
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Gerd Hoffmann 891fb2cd45 usb: claim port at device initialization time.
This patch makes qemu assign a port when creating the device, not when
attaching it.  For most usb devices this isn't a noticable difference
because they are in attached state all the time.

The change affects usb-host devices which live in detached state while
the real device is unplugged from the host.  They have a fixed port
assigned all the time now instead of getting grabbing one on attach and
releasing it at detach, i.e. they stop floating around at the usb bus.

The change also allows to simplify usb-hub.  It doesn't need the
handle_attach() callback any more to configure the downstream ports.
This can be done at device initialitation time now.  The changed
initialization order (first grab upstream port, then register downstream
ports) also fixes some icky corner cases.  For example it is not possible
any more to plug the hub into one of its own downstream ports.

The usb host adapters must care too.  USBPort->dev being non-NULL
doesn't imply any more the device is in attached state.  The host
adapters must additionally check the USBPort->dev->attached flag.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 7755260f01 usb-ccid: remote wakeup support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 97237e0a5a usb-ccid: switch to USBDesc*
Switch the smard card emulation to use the USBDesc*
structs for the usb descriptors.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 4d8debba76 usb: fix use after free
The ->complete() callback might have released the USBPacket (uhci
actually does), so we must not touch it after the callback returns.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 0c402e5abb usb-host: parse port in /proc/bus/usb/devices scan
Unfortunaly this is limited to root ports.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:16 +02:00
Gerd Hoffmann ba9acab9bf usb-host: constify port
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:16 +02:00
Gerd Hoffmann 2fe80192ba usb-ehci: handle siTDs
This patch adds code to do minimal siTD handling, which is basically
just following the next pointer.  This is good enougth to handle the
inactive siTDs used by FreeBSD.  Active siTDs are skipped too as we
don't have split transfer support in qemu, additionally a warning is
printed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:16 +02:00
Gerd Hoffmann c0e5750bc3 usb-host: endpoint table fixup
USB Devices can have up to 15 IN and 15 OUT endpoints, not 15 endpoints
total.  Move from one array to two arrays (one IN, one OUT) to maintain
the endpoint state.
2011-09-07 09:58:16 +02:00
Gerd Hoffmann 9516bb4772 usb-host: claim port
When configured to pass through a specific host port (using hostbus and
hostport properties), try to claim the port if supported by the kernel.
That will avoid any kernel drivers binding to devices plugged into that
port.  It will not stop any userspace apps (such as usb_modeswitch)
access the device via usbfs though.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:12 +02:00
Gerd Hoffmann eb7700bb99 usb-host: fix configuration tracking.
It is perfectly fine to leave the usb device in unconfigured state
(USBHostDevice->configuration == 0).  Just do that and wait for the
guest to explicitly set a configuration.  This is closer to what real
hardware does and it also simplifies the device initialization.  There
is no need to figure how the device is configured on the host.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:50:49 +02:00
Gerd Hoffmann 3ee886c5ba usb-host: limit open retries
Limit the number of times qemu tries to open host devices to three.
Reset error counter when the device goes away, after un-plugging and
re-plugging the device qemu will try again three times.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:50:49 +02:00
Gerd Hoffmann 9b87e19bc7 usb-host: fix halted endpoints
Two fixes for the price of one ;)

First, reinitialize the endpoint table after device reset.
This is needed anyway as the reset might have switched interfaces.
It also clears the endpoint halted state.

Second the CLEAR_HALT ioctl wants a unsigned int passed in as
argument, not uint8_t.

This gets my usb sd card reader (sandisk micromate) going.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:50:49 +02:00
Gerd Hoffmann 40197c359b usb-host: reapurb error report fix
Don't report errors on devices which are in disconnected
and closing state.
2011-09-07 09:50:49 +02:00
Gerd Hoffmann e6a2f50042 usb-host: start tracing support
Add a bunch of trace points to usb-linux.c  Drop a bunch of DPRINTK's in
favor of the trace points.  Also cleanup error reporting a bit while being
at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:50:39 +02:00
Gerd Hoffmann 22b626e28e spice: workaround a spice server bug.
spice server might call the channel_event callback from spice server
thread context.  Detect that and aquire iothread lock if needed,
2011-09-07 09:20:09 +02:00
Yonit Halperin 7e79cf4083 spice: set qxl->ssd.running=true before telling spice to start, RHBZ #733993
If qxl->ssd.running=true is set after telling spice to start, the spice server
thread can call qxl_send_events while qxl->ssd.running is still false. This leads to
assert(d->ssd.running).

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Yonit Halperin 40010aea63 qxl: s/qxl_set_irq/qxl_update_irq/
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Yonit Halperin efbf2950f5 qxl: send interrupt after migration in case ram->int_pending != 0, RHBZ #732949
if qxl_send_events was called from spice server context, and then
migration had completed before a call to pipe_read, the target
guest qxl driver didn't get the interrupt. In addition,
qxl_send_events ignored further interrupts of the same kind, since
ram->int_pending was set. As a result, the guest driver was stacked
or very slow (when the waiting for the interrupt was with timeout).

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Peter Maydell a680f7e7cb hw/qxl: Fix format string errors
Fix format string errors causing compile failure on 32 bit hosts
when spice is enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Peter Maydell 7b6c73690e spice-qemu-char.c: Use correct printf format char for ssize_t
Use the correct printf format string character (%z) for ssize_t.
This fixes a compile failure on 32 bit Linux with spice enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Paolo Bonzini cfc606da0d scsi: improve MODE SENSE emulation
- do not return extra pages when requesting all pages (PAGE CODE = 0x3f)

- return correct sense code for PC = 3 (saved parameters not supported)

- do not return geometry pages for CD devices

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 15:45:20 +02:00
Paolo Bonzini eae31cb998 scsi: fill in additional sense length correctly
Even though we do not use them, we should include the last three
bytes of sense data in the additional sense length.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 15:28:37 +02:00
Jan Kiszka 69faeee12a Fix qjson test of solidus encoding
"\/" is supposed to be decoded as "/", but there is no need to encode
"/" via escape. Fix the existing test and add a second one expressing
this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-06 10:15:39 -03:00
Luiz Capitulino 70371cfbf1 configure: Copy test data to build directory
The QDict unit-tests (check-qdict) will fail when ran on a different
build directory. That's, it only works when ran on the source dir.

This happens because its data file (qdict-test-data.txt) is not
copied to the build dir. Fix it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-06 10:15:39 -03:00
Paolo Bonzini f651526271 scsi: refine constants for READ CAPACITY 16
Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish
from the 12-byte CDB variant, and add a constant for the subcommand.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 15:14:41 +02:00
Paolo Bonzini 8e321cc622 scsi: fix accounting of writes
Writes go through scsi_write_complete at least twice, the first time
to get some data without having actually written anything.  Because
of this, the first time scsi_write_complete is called it will call
bdrv_acct_done and account a read incorrectly.  Fix this by looking
at the aiocb.  I am doing the same in scsi_read_complete for symmetry,
but it is only needed in the (bogus) case of bdrv_aio_readv returning
NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 13:15:25 +02:00
Paolo Bonzini 0a4ac106f7 scsi: execute SYNCHRONIZE_CACHE asynchronously
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 13:02:16 +02:00
Fam Zheng bb45ded931 VMDK: bugfix, opening vSphere 4 exported image
The vSphere 4 exported image is streamOptimized extent, which is not
quite correctly handled. Ignore rdgOffset when RGD flag bit not set.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 12:33:29 +02:00