]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agotarget-arm: sort TCG cpreg list by KVM-style 64 bit ID number
Alvise Rigo [Fri, 11 Oct 2013 17:38:44 +0000 (19:38 +0200)]
target-arm: sort TCG cpreg list by KVM-style 64 bit ID number

Both KVM and TCG populate the cpreg_list with 64 bit register IDs,
but in the TCG side the cpreg_list is sorted using the 32 bit ID
version while in the kvm side the 64 bit ID version is used.  This
patch makes the sorting of the cpreg_list consistent between KVM and
TCG.

Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com>
Message-id: 1381513125-26802-1-git-send-email-a.rigo@virtualopensystems.com
[PMM: fixed indent, coding style and commit message formatting]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Add CP15 VBAR support
Nathan Rossi [Fri, 25 Oct 2013 14:44:38 +0000 (15:44 +0100)]
target-arm: Add CP15 VBAR support

Added Vector Base Address remapping on ARM v7.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[PMM: removed spurious mask of value with 1<<31]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/arm: Tidy up conditional calls to arm_load_kernel
Peter Maydell [Fri, 25 Oct 2013 14:44:38 +0000 (15:44 +0100)]
hw/arm: Tidy up conditional calls to arm_load_kernel

Now that arm_load_kernel doesn't insist on a kernel filename
being present, we can remove some unnecessary conditionals
in board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1379980897-21277-3-git-send-email-peter.maydell@linaro.org

10 years agohw/arm/boot: Make user not specifying a kernel not an error
Peter Maydell [Fri, 25 Oct 2013 14:44:38 +0000 (15:44 +0100)]
hw/arm/boot: Make user not specifying a kernel not an error

Typically ARM boards will have some kind of flash which might contain
a boot ROM; it's therefore a valid use case to provide only an
image for the boot ROM and not require QEMU's internal boot loader
at all. Remove the fatal error if -kernel isn't specified.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1379980897-21277-2-git-send-email-peter.maydell@linaro.org

10 years agoqapi: Add optional field 'compressed' to ImageInfo
Fam Zheng [Fri, 18 Oct 2013 03:12:44 +0000 (11:12 +0800)]
qapi: Add optional field 'compressed' to ImageInfo

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: prefill some data to test image
Fam Zheng [Wed, 30 Oct 2013 09:42:28 +0000 (17:42 +0800)]
qemu-iotests: prefill some data to test image

Case 030 occasionally fails because of block job compltes too fast to be
captured by script, and 'unexpected qmp event' of job completion causes
the test failure.

Simply fill in some data to the test image to make this false alarm less
likely to happen.

(For other benefits to prefill data to test image, see also commit
ab68cdfaa).

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: check simultaneous create in resend_aioreq
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:18 +0000 (16:01 +0900)]
sheepdog: check simultaneous create in resend_aioreq

After reconnection happens, all the inflight requests are moved to the
failed request list.  As a result, sd_co_rw_vector() can send another
create request before resend_aioreq() resends a create request from
the failed list.

This patch adds a helper function check_simultaneous_create() and
checks simultaneous create requests more strictly in resend_aioreq().

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: cancel aio requests if possible
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:17 +0000 (16:01 +0900)]
sheepdog: cancel aio requests if possible

This patch tries to cancel aio requests in pending queue and failed
queue.  When the sheepdog driver cannot cancel the requests, it waits
for them to be completed.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: make add_aio_request and send_aioreq void functions
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:16 +0000 (16:01 +0900)]
sheepdog: make add_aio_request and send_aioreq void functions

These functions no longer return errors.  We can make them void
functions and simplify the codes.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: try to reconnect to sheepdog after network error
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:15 +0000 (16:01 +0900)]
sheepdog: try to reconnect to sheepdog after network error

This introduces a failed request queue and links all the inflight
requests to the list after network error happens.  After QEMU
reconnects to the sheepdog server successfully, the sheepdog block
driver will retry all the requests in the failed queue.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocoroutine: add co_aio_sleep_ns() to allow sleep in block drivers
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:14 +0000 (16:01 +0900)]
coroutine: add co_aio_sleep_ns() to allow sleep in block drivers

This helper function behaves similarly to co_sleep_ns(), but the
sleeping coroutine will be resumed when using qemu_aio_wait().

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: reload inode outside of resend_aioreq
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:13 +0000 (16:01 +0900)]
sheepdog: reload inode outside of resend_aioreq

This prepares for using resend_aioreq() after reconnecting to the
sheepdog server.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: handle vdi objects in resend_aio_req
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:12 +0000 (16:01 +0900)]
sheepdog: handle vdi objects in resend_aio_req

The current resend_aio_req() doesn't work when the request is against
vdi objects.  This fixes the problem.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: check return values of qemu_co_recv/send correctly
MORITA Kazutaka [Thu, 24 Oct 2013 07:01:11 +0000 (16:01 +0900)]
sheepdog: check return values of qemu_co_recv/send correctly

If qemu_co_recv/send doesn't return the specified length, it means
that an error happened.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Test case for backing file deletion
Max Reitz [Tue, 29 Oct 2013 18:18:54 +0000 (19:18 +0100)]
qemu-iotests: Test case for backing file deletion

Add a test case for trying to open an image file where it is impossible
to open its backing file (in this case, because it was deleted). When
doing this, qemu (or qemu-io in this case) should not crash but rather
print an appropriate error message.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: drop duplicated "create_image"
Fam Zheng [Wed, 30 Oct 2013 09:23:54 +0000 (17:23 +0800)]
qemu-iotests: drop duplicated "create_image"

There's a same common function in iotests.py

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Fix 051 reference output
Kevin Wolf [Tue, 29 Oct 2013 16:05:35 +0000 (17:05 +0100)]
qemu-iotests: Fix 051 reference output

Commit 684b254 forgot to update it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Avoid unecessary drv->bdrv_getlength() calls
Kevin Wolf [Tue, 29 Oct 2013 11:18:58 +0000 (12:18 +0100)]
block: Avoid unecessary drv->bdrv_getlength() calls

The block layer generally keeps the size of an image cached in
bs->total_sectors so that it doesn't have to perform expensive
operations to get the size whenever it needs it.

This doesn't work however when using a backend that can change its size
without qemu being aware of it, i.e. passthrough of removable media like
CD-ROMs or floppy disks. For this reason, the caching is disabled when a
removable device is used.

It is obvious that checking whether the _guest_ device has removable
media isn't the right thing to do when we want to know whether the size
of the host backend can change. To make things worse, non-top-level
BlockDriverStates never have any device attached, which makes qemu
assume they are removable, so drv->bdrv_getlength() is always called on
the protocol layer. In the case of raw-posix, this causes unnecessary
lseek() system calls, which turned out to be rather expensive.

This patch completely changes the logic and disables bs->total_sectors
caching only for certain block driver types, for which a size change is
expected: host_cdrom and host_floppy on POSIX, host_device on win32; also
the raw format in case it sits on top of one of these protocols, but in
the common case the nested bdrv_getlength() call on the protocol driver
will use the cache again and avoid an expensive drv->bdrv_getlength()
call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoblock: Disable BDRV_O_COPY_ON_READ for the backing file
Thibaut LAURENT [Fri, 25 Oct 2013 00:15:07 +0000 (02:15 +0200)]
block: Disable BDRV_O_COPY_ON_READ for the backing file

Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c,
bdrv_open_common will throw an error when trying to open a file
read-only with the BDRV_O_COPY_ON_READ flag set.
Although BDRV_O_RDWR is unset for the backing files,
BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested
for the drive. Let's unset this flag too before opening the backing
file, or bdrv_open_common will fail.

Signed-off-by: Thibaut LAURENT <thibaut.laurent@gmail.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoahci: fix win7 hang on boot
Alexander Graf [Mon, 28 Oct 2013 19:01:51 +0000 (21:01 +0200)]
ahci: fix win7 hang on boot

When AHCI executes an asynchronous IDE command, it checked DRDY without
checking either DRQ or BSY.  This sometimes caused interrupt to be sent
before command is actually completed.

This resulted in a race condition: if guest then managed to access the
device before command has completed, it would hang waiting for an
interrupt.
This was observed with windows 7 guests.

To fix, check for DRQ or BSY in additiona to DRDY, if set,
the command is asynchronous so delay the interrupt until
asynchronous done callback is invoked.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: pass copy_policy in the request
Liu Yuan [Wed, 23 Oct 2013 08:51:52 +0000 (16:51 +0800)]
sheepdog: pass copy_policy in the request

Currently copy_policy isn't used. Recent sheepdog supports erasure coding, which
make use of copy_policy internally, but require client explicitly passing
copy_policy from base inode to newly creately inode for snapshot related
operations.

If connected sheep daemon doesn't utilize copy_policy, passing it to sheep
daemon is just one extra null effect operation. So no compatibility problem.

With this patch, sheepdog can provide erasure coded volume for QEMU VM.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: explicitly set copies as type uint8_t
Liu Yuan [Wed, 23 Oct 2013 08:51:51 +0000 (16:51 +0800)]
sheepdog: explicitly set copies as type uint8_t

'copies' is actually uint8_t since day one, but request headers and some helper
functions parameterize it as uint32_t for unknown reasons and effectively
reserve 24 bytes for possible future use. This patch explicitly set the correct
for copies and reserve the left bytes.

This is a preparation patch that allow passing copy_policy in request header.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Don't copy backing file name on error
Max Reitz [Sat, 26 Oct 2013 13:44:43 +0000 (15:44 +0200)]
block: Don't copy backing file name on error

bdrv_open_backing_file() tries to copy the backing file name using
pstrcpy directly after calling bdrv_open() to open the backing file
without checking whether that was actually successful. If it was not,
ps->backing_hd->file will probably be NULL and qemu will crash.

Fix this by moving pstrcpy after checking whether bdrv_open() succeeded.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Amos Kong <kongjianjun@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agotests: Multiboot mmap test case
Kevin Wolf [Thu, 27 Jun 2013 11:50:05 +0000 (13:50 +0200)]
tests: Multiboot mmap test case

This adds a test case for Multiboot memory map in the tests/multiboot
directory, where future i386 test kernels can be dropped. Because this
requires an x86 build host and an installed 32 bit libgcc, the test is
not part of a regular 'make check'.

The reference output for the test is verified against test runs of the
same multiboot kernel booted by some GRUB 0.97.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoide-test: Check what happens with bus mastering disabled
Kevin Wolf [Mon, 22 Jul 2013 12:26:25 +0000 (14:26 +0200)]
ide-test: Check what happens with bus mastering disabled

The main goal is that qemu doesn't crash.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoexec: Fix bounce buffer allocation in address_space_map()
Kevin Wolf [Mon, 22 Jul 2013 12:30:23 +0000 (14:30 +0200)]
exec: Fix bounce buffer allocation in address_space_map()

This fixes a regression introduced by commit e3127ae0c, which kept the
allocation size of the bounce buffer limited to one page in order to
avoid unbounded allocations (as explained in the commit message of
6d16c2f88), but broke the reporting of the shortened bounce buffer to
the caller. The caller therefore assumes that the full requested size
was provided and causes memory corruption when writing beyond the end of
the actually allocated buffer.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Flush image after creation
Max Reitz [Thu, 24 Oct 2013 18:35:06 +0000 (20:35 +0200)]
qcow2: Flush image after creation

Opening the qcow2 image with BDRV_O_NO_FLUSH prevents any flushes during
the image creation. This means that the image has not yet been flushed
to disk when qemu-img create exits. This flush is delayed until the next
operation on the image involving opening it without BDRV_O_NO_FLUSH and
closing (or directly flushing) it. For large images and/or images with a
small cluster size and preallocated metadata, this flush may take a
significant amount of time and may occur unexpectedly.

Reopening the image without BDRV_O_NO_FLUSH right before the end of
qcow2_create2() results in hoisting the potentially costly flush into
the image creation, which is expected to take some time (whereas
successive image operations may be not).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoaudio/mixeng_template.h: fix inline declaration
Alex Bligh [Tue, 22 Oct 2013 09:26:28 +0000 (10:26 +0100)]
audio/mixeng_template.h: fix inline declaration

Fix error: ‘inline’ is not at beginning of declaration
[-Werror=old-style-declaration]

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: Spelling and grammar fixes in comments
Stefan Weil [Fri, 11 Oct 2013 19:34:33 +0000 (21:34 +0200)]
misc: Spelling and grammar fixes in comments

* it's -> its
* grammar fix in ui/vnc-enc-zywrle.h

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Don Koch <dkoch@verizon.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agodocs/ccid.txt: fix the typo
WengFan [Fri, 25 Oct 2013 15:18:22 +0000 (11:18 -0400)]
docs/ccid.txt: fix the typo

Signed-off-by: WengFan <wengfan-fnst@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqapi: fix documentation example
Eric Blake [Sat, 19 Oct 2013 16:52:33 +0000 (17:52 +0100)]
qapi: fix documentation example

The QMP wire format uses "", not '', around strings.

* docs/qapi-code-gen.txt: Fix typo.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years ago.gitignore: ignore qmp-commands.txt
Fam Zheng [Tue, 15 Oct 2013 02:58:39 +0000 (10:58 +0800)]
.gitignore: ignore qmp-commands.txt

This file is moved out from QMP/ to BUILD dir, change the ignore file
too.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomisc: New spelling fixes in comments
Stefan Weil [Thu, 10 Oct 2013 18:53:40 +0000 (20:53 +0200)]
misc: New spelling fixes in comments

compatiblity -> compatibility
continously -> continuously
existance -> existence
usefull -> useful
shoudl -> should

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: create fsdev/ directory
Michael Tokarev [Mon, 21 Oct 2013 08:33:58 +0000 (12:33 +0400)]
configure: create fsdev/ directory

In some cases when building with parallelism (make -jN),
build fails because the directory where output files are
supposed to be does not exist.  In particular, when make
decides to build virtfs-proxy-helper.1 before other files
in fsdev/, build will fail with the following error:

perl -Ww -- BUILDDIR/scripts/texi2pod.pl BUILDDIR/fsdev/virtfs-proxy-helper.texi fsdev/virtfs-proxy-helper.pod && pod2man --utf8 --section=1 --center=" " --release=" " fsdev/virtfs-proxy-helper.pod > fsdev/virtfs-proxy-helper.1
opening "fsdev/virtfs-proxy-helper.pod": No such file or directory

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agospapr: Use DeviceClass::fw_name for device tree CPU node
Andreas Färber [Tue, 15 Oct 2013 16:33:37 +0000 (18:33 +0200)]
spapr: Use DeviceClass::fw_name for device tree CPU node

Instead of relying on cpu_model, obtain the device tree node label
per CPU. Use DeviceClass::fw_name as source.

Whenever DeviceClass::fw_name is unknown, default to "PowerPC,UNKNOWN".

As a consequence, spapr_fixup_cpu_dt() can operate on each CPU's fw_name,
obsoleting sPAPREnvironment::cpu_model, and spapr_create_fdt_skel() can
drop its cpu_model argument.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Fill in OpenFirmware names for some PowerPCCPU families
Andreas Färber [Tue, 15 Oct 2013 16:33:36 +0000 (18:33 +0200)]
target-ppc: Fill in OpenFirmware names for some PowerPCCPU families

Set the expected values for POWER7, POWER7+, POWER8 and POWER5+.
Note that POWER5+ and POWER7+ are intentionally lacking the '+', so the
lack of a POWER7P family constitutes no problem.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: dump-guest-memory support
Aneesh Kumar K.V [Tue, 1 Oct 2013 16:19:33 +0000 (21:49 +0530)]
target-ppc: dump-guest-memory support

This patch add support for dumping guest memory using dump-guest-memory
monitor command.

Before patch:

(qemu) dump-guest-memory testcrash
this feature or command is not currently supported
(qemu)

After patch:

(qemu) dump-guest-memory testcrash
(qemu)

crash was able to read the file

crash> bt
PID: 0      TASK: c000000000c0d0d0  CPU: 0   COMMAND: "swapper/0"

 R0:  0000000028000084    R1:  c000000000cafa50    R2:  c000000000cb05b0
 R3:  0000000000000000    R4:  c000000000bc4cb0    R5:  0000000000000000
 R6:  001efe93b8000000    R7:  0000000000000000    R8:  0000000000000000
 R9:  b000000000001032    R10: 0000000000000001    R11: 0001eb2117e00d55
....
...

NOTE: Currently crash tools doesn't look at ELF notes in the dump on ppc64.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agodump-guest-memory: Check for the correct return value
Aneesh Kumar K.V [Tue, 1 Oct 2013 16:19:32 +0000 (21:49 +0530)]
dump-guest-memory: Check for the correct return value

We should check for error with s->note_size

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Use #define for max slb entries
Aneesh Kumar K.V [Tue, 1 Oct 2013 16:19:31 +0000 (21:49 +0530)]
target-ppc: Use #define for max slb entries

Instead of opencoding 64 use MAX_SLB_ENTRIES. We don't update the kernel
header here.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Check for error on address translation in memsave command
Aneesh Kumar K.V [Tue, 1 Oct 2013 16:19:30 +0000 (21:49 +0530)]
target-ppc: Check for error on address translation in memsave command

When we translate the virtual address to physical check for error.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Update slb array with correct index values.
Aneesh Kumar K.V [Tue, 1 Oct 2013 16:19:28 +0000 (21:49 +0530)]
target-ppc: Update slb array with correct index values.

Without this, a value of rb=0 and rs=0 results in replacing the 0th
index. This can be observed when using gdb remote debugging support.

(gdb) x/10i do_fork
   0xc000000000085330 <do_fork>:        Cannot access memory at address 0xc000000000085330
(gdb)

This is because when we do the slb sync via kvm_cpu_synchronize_state,
we overwrite the slb entry (0th entry) for 0xc000000000085330

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr-pci: enable irqfd for INTx
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:48 +0000 (16:18 +1000)]
spapr-pci: enable irqfd for INTx

This enables IRQFD for LSI (level triggered INTx interrupts) by adding
a spapr_route_intx_pin_to_irq() callback to the sPAPR PCI host bus. This
callback is called to know the global interrupt number to link resampling fd
with IRQFD's fd in KVM.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics-kvm: enable irqfd for MSI
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:47 +0000 (16:18 +1000)]
xics-kvm: enable irqfd for MSI

This enables IRQFD support for sPAPR. The feature decreases the latency
of interrupt handling.

To enable IRQFD for MSI, this sets kvm_gsi_direct_mapping to true which
enables direct MSI mapping.

To enable IRQFD for LSI (level triggered INTx interrupts), a PCI host bus
callback is required. The patch for that is coming next.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: Implement H_XIRR_X
Benjamin Herrenschmidt [Thu, 26 Sep 2013 06:18:46 +0000 (16:18 +1000)]
xics: Implement H_XIRR_X

This implements H_XIRR_X hypercall in addition to H_XIRR as
it is mandatory for PAPR+ and there is no way for the guest to
detect whether it is supported or not so just add it.

As the Partition Adjunct Option is not supported at the moment,
the CPPR parameter of the hypercall is ignored.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: Implement H_IPOLL
Benjamin Herrenschmidt [Thu, 26 Sep 2013 06:18:45 +0000 (16:18 +1000)]
xics: Implement H_IPOLL

This adds support for the H_IPOLL hypercall which the guest
uses to poll for a pending interrupt. This hypercall is
mandatory for PAPR+ and there is no way for the guest to
detect whether it is supported or not so just add it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics-kvm: Support for in-kernel XICS interrupt controller
David Gibson [Thu, 26 Sep 2013 06:18:44 +0000 (16:18 +1000)]
xics-kvm: Support for in-kernel XICS interrupt controller

Recent (host) kernels support emulating the PAPR defined "XICS" interrupt
controller system within KVM.  This patch allows qemu to initialize and
configure the in-kernel XICS, and keep its state in sync with qemu's XICS
state as necessary.

This should give considerable performance improvements.  e.g. on a simple
IPI ping-pong test between hardware threads, using qemu XICS gives us
around 5,000 irqs/second, whereas the in-kernel XICS gives us around
70,000 irqs/s on the same hardware configuration.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[Mike Qiu <qiudayu@linux.vnet.ibm.com>: fixed mistype which caused ics_set_kvm_state() to fail]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: add cpu_setup callback
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:43 +0000 (16:18 +1000)]
xics: add cpu_setup callback

This adds a cpu_setup callback to the XICS device class (as XICS-KVM
will do it different), xics_cpu_setup() will call it if it is set.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: split to xics and xics-common
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:42 +0000 (16:18 +1000)]
xics: split to xics and xics-common

The upcoming XICS-KVM support will use bits of emulated XICS code.
So this introduces new level of hierarchy - "xics-common" class. Both
emulated XICS and XICS-KVM will inherit from it and override class
callbacks when required.

The new "xics-common" class implements:
1. replaces static "nr_irqs" and "nr_servers" properties with
the dynamic ones and adds callbacks to be executed when properties
are set.
2. xics_cpu_setup() callback renamed to xics_common_cpu_setup() as
it is a common part for both XICS'es
3. xics_reset() renamed to xics_common_reset() for the same reason.

The emulated XICS changes:
1. the part of xics_realize() which creates ICPs is moved to
the "nr_servers" property callback as realize() is too late to
create/initialize devices and instance_init() is too early to create
devices as the number of child devices comes via the "nr_servers"
property.
2. added ics_initfn() which does a little part of what xics_realize() did.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: add missing const specifiers to TypeInfo
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:41 +0000 (16:18 +1000)]
xics: add missing const specifiers to TypeInfo

This adds missing const specifiers to ICS and ICP TypeInfo's.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: convert init() to realize()
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:40 +0000 (16:18 +1000)]
xics: convert init() to realize()

This fixes XICS according new QOM rules.

This converts ICS's init() callbacks to realize().

This converts legacy qdev_init_nofail() to property_set(realized).

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: add pre_save/post_load dispatchers
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:39 +0000 (16:18 +1000)]
xics: add pre_save/post_load dispatchers

The upcoming support of in-kernel XICS will redefine migration callbacks
for both ICS and ICP so classes and callback pointers are added.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: replace fprintf with error_report
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:38 +0000 (16:18 +1000)]
xics: replace fprintf with error_report

This replaces old-style fprintf with new style error_report.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr: move cpu_setup after kvmppc_set_papr
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:37 +0000 (16:18 +1000)]
spapr: move cpu_setup after kvmppc_set_papr

This moves the xics_cpu_setup() call after kvmppc_set_papr()
in order to get VCPUs initialized as this is required by upcoming
XICS-KVM.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: move reset and cpu_setup
Alexey Kardashevskiy [Thu, 26 Sep 2013 06:18:36 +0000 (16:18 +1000)]
xics: move reset and cpu_setup

This simple change makes following patches nicer.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN
David Gibson [Thu, 26 Sep 2013 06:18:35 +0000 (16:18 +1000)]
target-ppc: Add helper for KVM_PPC_RTAS_DEFINE_TOKEN

Recent PowerKVM allows the kernel to intercept some RTAS calls from the
guest directly.  This is used to implement the more efficient in-kernel
XICS for example.  qemu is still responsible for assigning the RTAS token
numbers however, and needs to tell the kernel which RTAS function name is
assigned to a given token value.  This patch adds a convenience wrapper for
the KVM_PPC_RTAS_DEFINE_TOKEN ioctl() which is used for this purpose.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr-rtas: fix h_rtas parameters reading
Alexey Kardashevskiy [Fri, 27 Sep 2013 08:10:18 +0000 (18:10 +1000)]
spapr-rtas: fix h_rtas parameters reading

On the real hardware, RTAS is called in real mode and therefore
top 4 bits of the address passed in the call are ignored.
So does the patch.

This converts h_rtas() to use existing rtas_ld() handlers.

This fixed rtas_ld()/rtas_st() to ignore top 4 bits.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr: Add ibm, purr property on power7 and newer
Alexey Kardashevskiy [Fri, 27 Sep 2013 08:11:51 +0000 (18:11 +1000)]
spapr: Add ibm, purr property on power7 and newer

PAPR+ says that no "ibm,purr" tells the guest that H_PURR is not
supported. However some guests still try calling H_PURR on POWER7 unless
the property is present and equal to 0. This adds the property for CPUs
supporting the PURR special register.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr: increase temporary fdt buffer size
Alexey Kardashevskiy [Tue, 24 Sep 2013 05:59:55 +0000 (15:59 +1000)]
spapr: increase temporary fdt buffer size

At the moment the size of the buffer is set to 64K which is
enough for approximately 150 VCPUs which is not the limit.

This increases the buffer up to 256K which allows having
a tree for approximately 600 VCPUs which is way beyond the real
number we need.

As only the real size of the tree is copied to the guest, there
will be no impact on existing configurations.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoPPC: Fix L2CR write accesses
Alexander Graf [Wed, 25 Sep 2013 13:41:12 +0000 (15:41 +0200)]
PPC: Fix L2CR write accesses

Commit 2345f1c01 was supposed to render L2CR writes into noops. Instead,
it made them illegal instruction traps which apparently didn't confuse
XNU, but can easily confuse other OSs.

Fix it up by actually doing nothing when we write to L2CR.

Reported-by: Julio Guerra <guerr@julio.in>
Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Julio Guerra <guerr@julio.in>
10 years agotarget-ppc: Little Endian Correction to Load/Store Vector Element
Tom Musta [Wed, 25 Sep 2013 07:42:46 +0000 (17:42 +1000)]
target-ppc: Little Endian Correction to Load/Store Vector Element

The Load Vector Element (lve*x) and Store Vector Element (stve*x)
instructions not only byte-swap in Little Endian mode, they also
invert the element that is accessed. For example, the RTL for
lvehx contains this:

     eb <-- EA[60:63]
     if Big-Endian byte ordering then
         VRT[8*eb:8*eb+15] <-- MEM(EA,2)
     else
         VRT[112-(8*eb):127-(8*eb)] <-- MEM(EA,2)

This patch adds the element inversion, as described in the last line
of the RTL.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Reviewed-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoppc: Add CFAR, DAR and DSISR to the dictionary of printable registers
Tom Musta [Wed, 25 Sep 2013 07:41:13 +0000 (17:41 +1000)]
ppc: Add CFAR, DAR and DSISR to the dictionary of printable registers

The CFAR, DAR and DSISR registers are currently missing from the
dictionary of registers that may be printed in the QEMU console.
These are interesting registers when debugging.  With this patch,
the following commands work properly:

     (qemu) print $cfar
     (qemu) print $dar
     (qemu) print $dsisr

Signed-off-by: Tom Musta <tommusta@gmail.com>
Reviewed-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agopseries: Fix loading of little endian kernels
Benjamin Herrenschmidt [Wed, 25 Sep 2013 07:40:15 +0000 (17:40 +1000)]
pseries: Fix loading of little endian kernels

Try loading the kernel as little endian if it fails big endian.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agopseries: Update SLOF firmware image
Alexey Kardashevskiy [Tue, 27 Aug 2013 03:42:47 +0000 (13:42 +1000)]
pseries: Update SLOF firmware image

This has reworked USB OHCI and adds support of USB EHCI,
VIRTIO-SCSI and various fixes (IBM VSCSI, VGA and more).

The full list of fixes is:
*  usb-ohci: Convert td-phys every time to td-virt
*  usb-storage: Fix cbwflags field
*  Add -fno-strict-aliasing in global CFLAGS
*  usb: fix various issues found with js2x
*  Move hex64-{decode,encode}-unit to node.fs
*  usb: Use separate in-memory endian swap
*  usb-ohci: collect TDs from done list
*  js2x: more fixes
*  js2x: Fix build of takeover image
*  js2x: use new usb stack
*  usb-ohci: Use proper memory barriers always
*  usb: Fix a couple of warnings
*  Fix $cat-instance-unit
*  Cache phandle of /chosen
*  Use root.fs on qemu as well
*  usb-ehci: Add ehci handshake
*  usb: add mb for write accessors
*  usb-ohci: add missing memory barriers
*  usb-ohci: suspend the controller in exit code path
*  usb-ohci: Add a reset when closing the OHCI
*  usb: Use proper accessors for MMIO and separate in-memory endian swap
*  Use a global definition of sync() and mb()
*  net-snk: Remove exception handling
*  usb: unmap buffers
*  slof: call quiesce on closing of stdin
*  usb-kbd: accept "s" to drop to OF prompt
*  USB storage driver
*  usb-ohci: add Bulk transfer support
*  usb-ehci: Add bulk support
*  usb-core: add usb bulk support
*  USB generic hub device driver
*  usb-ehci: setup new device
*  usb-ehci: Check ehci ports
*  usb-ehci: initialize controller
*  USB keyboard driver
*  usb-core: setup new device
*  usb-core: create dev pool allocation
*  usb-ohci: implement ohci send control
*  usb-core: usb send control
*  usb-core: implement usb_{get,put}_pipe routines
*  usb-ohci: allocate pipe pool
*  usb-ohci: reset, init and check-ports
*  Add standard header stdbool.h
*  usb-slof: forth support routines for C
*  usb-ehci: Add USB EHCI skeleton
*  usb-core: Add register accessor functions
*  Use __builtin_bswap routines for endianness swapping
*  usb-core: hcd registration and query routines
*  usb-core: adding generic dev-hci.fs
*  usb-core: registration and makefiles
*  Add new USB code
*  Remove old usb code
*  vga: fix hcall-invert-screen and hcall-blink-screen
*  Enumerate disk/cdrom aliases for multiple disks or cdroms
*  scsi: unify scsi probing code
*  vscsi: generalizing probe code
*  virtio-scsi: iterate through targets
*  scsi: unify and use make-disk-alias
*  nvram: remove unnecessary prints
*  Add hack to client interface finddevice of "/memory"
*  scsi: Fix cdrom boot crash when no medium present
*  Look for /memory@0, not just /memory
*  Fix instance>qname crashing when displaying instance arguments
*  Fix js2x build
*  scsi-disk: Bound check read-blocks
*  Fix off by one error in scsi-disk get-capacity
*  scsi: fix report-luns handling
*  SLOF: virtio-scsi block driver code
*  scsi: Move bits of vio-vscsi.fs to a common helpers file
*  scsi: Move scsi-disk.fs to a generic place
*  SLOF: virtio-scsi helper routines
*  SLOF: virtio-scsi - add pci device file
*  iso9660: Don't constantly reallocate the read buffer
*  vscsi: Sanitize interface between scsi-disk.fs and vio-vscsi.fs
*  vio-vscsi: Rework vio-vscsi support
*  virtio: Add a virtio-set-qaddr helper
*  disk-label: Allocate 4096 bytes for 4k block devices
*  disk-label: Increase the max size of the PReP boot partition
*  Make load-base a real environment variable
*  vio-vscsi: Switch to using a wildcard "disk" node and make scsi-disk generic
*  Fix disk-label package to use proper instance path
*  Increase size of catpad
*  Fix instance>path to contain unit address for wildcard nodes
*  Fix handling of wildcard nodes in open-dev
*  vio-vscsi: Get CRQ on open and release on close

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoqemu-iotests: Test for loading VM state from qcow2
Max Reitz [Thu, 24 Oct 2013 18:24:43 +0000 (20:24 +0200)]
qemu-iotests: Test for loading VM state from qcow2

Add a test for saving a VM state from a qcow2 image and loading it back
(with having restarted qemu in between); this should work without any
problems.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agohw/microblaze: Add support for loading initrd images
Edgar E. Iglesias [Sun, 5 May 2013 09:06:37 +0000 (11:06 +0200)]
hw/microblaze: Add support for loading initrd images

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agohw/microblaze: Indentation cleanups
Edgar E. Iglesias [Sun, 5 May 2013 08:52:41 +0000 (10:52 +0200)]
hw/microblaze: Indentation cleanups

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: At swx, check that the reserved word is unmodified
Edgar E. Iglesias [Wed, 23 Oct 2013 14:54:31 +0000 (16:54 +0200)]
microblaze: At swx, check that the reserved word is unmodified

This improves the reservation check for system emulation, making
it possible to catch stores that modify reserved word.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Turn res_addr into a tcg global
Edgar E. Iglesias [Wed, 23 Oct 2013 14:44:08 +0000 (16:44 +0200)]
microblaze: Turn res_addr into a tcg global

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Move the saving of the reservation addr into gen_load
Edgar E. Iglesias [Wed, 23 Oct 2013 11:58:08 +0000 (13:58 +0200)]
microblaze: Move the saving of the reservation addr into gen_load

No functional change.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Improve src
Edgar E. Iglesias [Thu, 24 Oct 2013 17:18:28 +0000 (19:18 +0200)]
microblaze: Improve src

Microblaze carry is mirrored in MSR[31], pick it directly from
there. Also, no need to mask cpu_R[dc->ra] when calling
write_carry.

15% improvement in linux-user src loops.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Improve srl
Edgar E. Iglesias [Thu, 24 Oct 2013 17:03:44 +0000 (19:03 +0200)]
microblaze: Improve srl

write_carry only looks at bit zero, no need to mask out the others.

Meassured a 12% speed improvement in linux-user srl loops.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Simplify andn by using tcg_gen_andc
Edgar E. Iglesias [Thu, 24 Oct 2013 16:49:46 +0000 (18:49 +0200)]
microblaze: Simplify andn by using tcg_gen_andc

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Make write_carryi input a boolean
Edgar E. Iglesias [Thu, 24 Oct 2013 10:49:05 +0000 (12:49 +0200)]
microblaze: Make write_carryi input a boolean

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze: Clarify expected input of write_carry
Edgar E. Iglesias [Thu, 24 Oct 2013 20:31:22 +0000 (22:31 +0200)]
microblaze: Clarify expected input of write_carry

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agoblock/vpc: check that the image has not been truncated
Peter Lieven [Thu, 24 Oct 2013 07:16:03 +0000 (09:16 +0200)]
block/vpc: check that the image has not been truncated

this adds a check that a dynamic VHD file has not been
accidently truncated (e.g. during transfer or upload).

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-img: add special exit code if bdrv_check is not supported
Peter Lieven [Thu, 24 Oct 2013 06:53:34 +0000 (08:53 +0200)]
qemu-img: add special exit code if bdrv_check is not supported

currently it is not possible to distinguish by exitcode if there
has been an error or if bdrv_check is not supported by the image
format. Change the exitcode from 1 to 63 for the latter case.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Unset zero_beyond_eof in save_vmstate
Max Reitz [Sun, 20 Oct 2013 19:52:35 +0000 (21:52 +0200)]
qcow2: Unset zero_beyond_eof in save_vmstate

Saving the VM state is done using bdrv_pwrite. This function may perform
a read-modify-write, which in this case results in data being read from
beyond the end of the virtual disk. Since we are actually trying to
access an area which is not a part of the virtual disk, zero_beyond_eof
has to be set to false before performing the partial write, otherwise
the VM state may become corrupted.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqcow2: Restore total_sectors value in save_vmstate
Max Reitz [Sun, 20 Oct 2013 18:28:20 +0000 (20:28 +0200)]
qcow2: Restore total_sectors value in save_vmstate

Since df2a6f29a5, bdrv_co_do_writev increases the total_sectors value of
a growable block devices on writes after the current end. This leads to
the virtual disk apparently growing in qcow2_save_vmstate, which in turn
affects the disk size captured by the internal snapshot taken directly
afterwards through e.g. the HMP savevm command. Such a "grown" snapshot
cannot be loaded after reopening the qcow2 image, since its disk size
differs from the actual virtual disk size (writing a VM state does not
actually increase the virtual disk size).

Fix this by restoring total_sectors at the end of qcow2_save_vmstate.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoaudio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second
Hans de Goede [Wed, 9 Oct 2013 19:33:44 +0000 (21:33 +0200)]
audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second

Now that we no longer have MIN_REARM_TIMER_NS a bug in the audio subsys has
clearly shown it self by trying to make a timer fire every nano second.

Note we have a similar problem in 1.6, 1.5 and older but there
MIN_REARM_TIMER_NS limits the wakeups caused by audio being active to
4000 times / second. This still causes a host cpu load of 50 % for simply
playing audio, where as with this patch git master is at 13%, so we should
backport this to 1.5 and 1.6 too.

Note this will not apply to 1.5 and 1.6 as is.

Cc: qemu-stable@nongnu.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-hcd-xhci: Update endpoint context dequeue pointer for streams too
Hans de Goede [Tue, 8 Oct 2013 19:58:12 +0000 (21:58 +0200)]
usb-hcd-xhci: Update endpoint context dequeue pointer for streams too

With streams the endpoint context dequeue pointer should point to the
dequeue value for the currently active stream.

At least Linux guests expect it to point to value set by an set_ep_dequeue
upon completion of the set_ep_dequeue (before kicking the ep).

Otherwise the Linux kernel will complain (and things won't work):

xhci_hcd 0000:00:05.0: Mismatch between completed Set TR Deq Ptr command & xHCI internal state.
xhci_hcd 0000:00:05.0: ep deq seg = ffff8800366f0880, deq ptr = ffff8800366ec010

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stop
Hans de Goede [Tue, 8 Oct 2013 19:58:11 +0000 (21:58 +0200)]
usb-hcd-xhci: Report completion of active transfer with CC_STOPPED on ep stop

As we should per the XHCI spec "4.6.9 Stop Endpoint".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-hcd-xhci: Remove unused cancelled member from XHCITransfer
Hans de Goede [Tue, 8 Oct 2013 19:58:10 +0000 (21:58 +0200)]
usb-hcd-xhci: Remove unused cancelled member from XHCITransfer

Since qemu's USB model is geared towards emulated devices cancellation
is instanteneous, so no need to wait for cancellation to complete, as
such there is no wait for cancellation code, and the cancelled bool
as well as the bogus comment about it can be removed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContext
Hans de Goede [Tue, 8 Oct 2013 19:58:09 +0000 (21:58 +0200)]
usb-hcd-xhci: Remove unused sstreamsm member from XHCIStreamContext

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-host-libusb: Detach kernel drivers earlier
Hans de Goede [Tue, 8 Oct 2013 19:58:08 +0000 (21:58 +0200)]
usb-host-libusb: Detach kernel drivers earlier

If we detach the kernel drivers on the first set_config, then they will
be still attached when the device gets its initial reset. Causing the drivers
to re-initialize the device after the reset, dirtying the device state.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-host-libusb: Configuration 0 may be a valid configuration
Hans de Goede [Tue, 8 Oct 2013 19:58:07 +0000 (21:58 +0200)]
usb-host-libusb: Configuration 0 may be a valid configuration

Quoting from: linux/Documentation/ABI/stable/sysfs-bus-usb:

Note that some devices, in violation of the USB spec, have a
configuration with a value equal to 0. Writing 0 to
bConfigurationValue for these devices will install that
configuration, rather then unconfigure the device.

So don't compare the configuration value against 0 to check for unconfigured
devices, instead check for a LIBUSB_ERROR_NOT_FOUND return from
libusb_get_active_config_descriptor().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-host-libusb: Fix reset handling
Hans de Goede [Tue, 8 Oct 2013 19:58:06 +0000 (21:58 +0200)]
usb-host-libusb: Fix reset handling

The guest will issue an initial device reset when the device is attached, but
since the current usb-host-libusb code only actually does the reset when
udev->configuration != 0, and on attach the device is not yet configured,
the reset gets ignored. This means that the device gets passed to the guest
in an unknown state, which is not good.

The udev->configuration check is there because of the release / claim
interfaces done around the libusb_device_reset call, but these are not
necessary. If interfaces are claimed when libusb_device_reset gets called
libusb will release + reclaim them itself.

The usb_host_ep_update call also is not necessary. If the reset succeeds the
original config and interface alt settings will be restored.

Last if the reset fails, that means the device has either disconnected or
morphed into an another device and has been completely re-enumerated,
so it is treated by the host as a new device and our handle is invalid,
so on reset failure we need to call usb_host_nodev().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoqapi: fix documentation example
Eric Blake [Sat, 19 Oct 2013 16:52:33 +0000 (17:52 +0100)]
qapi: fix documentation example

The QMP wire format uses "", not '', around strings.

* docs/qapi-code-gen.txt: Fix typo.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agomonitor: eliminate monitor_event_state_lock
Paolo Bonzini [Wed, 16 Oct 2013 17:17:08 +0000 (19:17 +0200)]
monitor: eliminate monitor_event_state_lock

This lock does not protect anything that the BQL does not already
protect.  Furthermore, with -nodefaults and no monitor, the mutex
is not initialized but monitor_protocol_event_queue is called
anyway, which causes a crash under mingw (and only works by luck.
under Linux or other POSIX OSes).

Reported-by: Orx Goshen <orx.goshen@intel.com>
Cc: Daniel Berrange <berrange@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:03:24 +0000 (10:03 -0700)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

# By Paolo Bonzini (2) and Jan Kiszka (1)
# Via Gleb Natapov
* qemu-kvm/uq/master:
  kvmvapic: Prevent reading beyond the end of guest RAM
  x86: cpuid: reconstruct leaf 0Dh data
  x86: fix migration from pre-version 12

Message-id: 1382108641-4862-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:02:48 +0000 (10:02 -0700)]
Merge remote-tracking branch 'stefanha/net' into staging

# By Amos Kong
# Via Stefan Hajnoczi
* stefanha/net:
  net/rtl8139: update network information when macaddr is changed in guest
  net/e1000: update network information when macaddr is changed in guest
  net: update nic info during device reset

Message-id: 1382103314-21608-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:02:14 +0000 (10:02 -0700)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Fam Zheng (3) and others
# Via Stefan Hajnoczi
* stefanha/block:
  vmdk: fix VMFS extent parsing
  vmdk: Only read cid from image file when opening
  virtio: Remove unneeded memcpy
  block/raw-win32: Always use -errno in hdev_open
  blockdev: fix cdrom read_only flag
  sd: Avoid access to NULL BlockDriverState
  hmp: drop bogus "[not inserted]"

Message-id: 1382105915-27735-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:49 +0000 (10:01 -0700)]
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging

# By Paolo Bonzini (10) and others
# Via Paolo Bonzini
* bonzini/iommu-for-anthony:
  exec: remove qemu_safe_ram_ptr
  icount: make it thread-safe
  icount: document (future) locking rules for icount
  icount: prepare the code for future races in calling qemu_clock_warp
  icount: reorganize icount_warp_rt
  icount: use cpu_get_icount() directly
  timer: add timer_mod_anticipate and timer_mod_anticipate_ns
  timer: extract timer_mod_ns_locked and timerlist_rearm
  timer: make qemu_clock_enable sync between disable and timer's cb
  qemu-thread: add QemuEvent
  timer: protect timers_state's clock with seqlock
  seqlock: introduce read-write seqlock
  vga: Mark relevant portio lists regions as coalesced MMIO flushing
  cirrus: Mark vga io region as coalesced MMIO flushing
  portio: Allow to mark portio lists as coalesced MMIO flushing
  compatfd: switch to QemuThread
  memory: fix 128 arithmetic in info mtree

Message-id: 1382024935-28297-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'bonzini/configure' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:37 +0000 (10:01 -0700)]
Merge remote-tracking branch 'bonzini/configure' into staging

# By Peter Maydell (3) and Ákos Kovács (2)
# Via Paolo Bonzini
* bonzini/configure:
  ui/Makefile.objs: delete unnecessary cocoa.o dependency
  default-configs/: CONFIG_GDBSTUB_XML removed
  Makefile.target: CONFIG_NO_* variables removed
  rules.mak: New string testing functions
  rules.mak: New logical functions for handling y/n values

10 years agoMerge remote-tracking branch 'spice/spice.v75' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:21 +0000 (10:01 -0700)]
Merge remote-tracking branch 'spice/spice.v75' into staging

# By Gerd Hoffmann (2) and others
# Via Gerd Hoffmann
* spice/spice.v75:
  spice: fix multihead support
  spice-display: add display channel id to the debug messages.
  Fix VNC SASL authentication when using a QXL device
  spice: replace use of deprecated API

Message-id: 1382006760-19388-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'filippov/tags/20131015-xtensa' into staging
Anthony Liguori [Fri, 18 Oct 2013 17:01:08 +0000 (10:01 -0700)]
Merge remote-tracking branch 'filippov/tags/20131015-xtensa' into staging

xtensa queue 2013-10-15

# gpg: Signature made Tue 15 Oct 2013 06:27:41 AM PDT using RSA key ID F83FA044
# gpg: Can't check signature: public key not found

# By Max Filippov
# Via Max Filippov
* filippov/tags/20131015-xtensa:
  target-xtensa: add in_asm logging

Message-id: 1381844297-1728-1-git-send-email-jcmvbkbc@gmail.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agovmdk: fix VMFS extent parsing
Fam Zheng [Fri, 18 Oct 2013 07:07:33 +0000 (15:07 +0800)]
vmdk: fix VMFS extent parsing

The VMFS extent line in description file doesn't have start offset as
FLAT lines does, and it should be defaulted to 0. The flat_offset
variable is initialized to -1, so we need to set it in this case.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovmdk: Only read cid from image file when opening
Fam Zheng [Fri, 18 Oct 2013 05:17:19 +0000 (13:17 +0800)]
vmdk: Only read cid from image file when opening

Previously cid of parent is parsed from image file for every IO request.
We already have L1/L2 cache and don't have assumption that parent image
can be updated behind us, so remove this to get more efficiency.

The parent CID is checked only for once after opening.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agonet/rtl8139: update network information when macaddr is changed in guest
Amos Kong [Thu, 17 Oct 2013 07:02:50 +0000 (15:02 +0800)]
net/rtl8139: update network information when macaddr is changed in guest

rtl8139 has same problem as e1000, nic info isn't updated when macaddr
is changed in guest.

This patch updates the nic info when the last bit of macaddr is written.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agonet/e1000: update network information when macaddr is changed in guest
Amos Kong [Thu, 17 Oct 2013 07:02:49 +0000 (15:02 +0800)]
net/e1000: update network information when macaddr is changed in guest

If we change macaddr in guest by 'ifconfig eth0 hw ether 12:12:12:34:35:36',
the mac register of e1000 is already updated, but we don't update
network information in qemu. Therefor, the information in monitor
is wrong.

This patch updates nic info when the second part of macaddr is written.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agonet: update nic info during device reset
Amos Kong [Thu, 17 Oct 2013 08:38:34 +0000 (16:38 +0800)]
net: update nic info during device reset

macaddr is reset during device reset, but nic info
isn't updated, this problem exists in e1000 & rtl8139

Signed-off-by: Amos Kong <akong@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>