]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
14 years agovirtio-9p: Create a syntactic shortcut for the file-system pass-thru
Gautham R Shenoy [Thu, 29 Apr 2010 12:15:03 +0000 (17:45 +0530)]
virtio-9p: Create a syntactic shortcut for the file-system pass-thru

Currently the commandline to create a virtual-filesystem pass-through between
the guest and the host is as follows:
#qemu -fsdev fstype,id=ID,path=path/to/share \
      -device virtio-9p-pci,fsdev=ID,mount_tag=tag \

This patch provides a syntactic short-cut to achieve the same as follows:
#qemu -virtfs fstype,path=path/to/share,mount_tag=tag

This will be internally expanded as:
#qemu -fsdev fstype,id=tag,path=path/to/share, \
      -device virtio-9p-pci,fsdev=tag,mount_tag=tag \

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TFLUSH support
Anthony Liguori [Thu, 29 Apr 2010 12:15:02 +0000 (17:45 +0530)]
virtio-9p: Add P9_TFLUSH support

Don't do anything special for flush.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TREMOVE support.
Anthony Liguori [Thu, 29 Apr 2010 12:15:01 +0000 (17:45 +0530)]
virtio-9p: Add P9_TREMOVE support.

Implement P9_TREMOVE support.
This gets file deletion to work.

[mohan@in.ibm.com: Fix truncate to use the relative path]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TWSTAT support
Anthony Liguori [Thu, 29 Apr 2010 12:15:00 +0000 (17:45 +0530)]
virtio-9p: Add P9_TWSTAT support

Implement P9_TWSTAT support.
This gets file and directory creation to work.

[jvrao@linux.vnet.ibm.com: strdup to qemu_strdup conversion]
[aneesh.kumar@linux.vnet.ibm.com: v9fs_fix_path]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TCREATE support
Anthony Liguori [Thu, 29 Apr 2010 12:14:59 +0000 (17:44 +0530)]
virtio-9p: Add P9_TCREATE support

Implement P9_TCREATE support.
[jvrao@linux.vnet.ibm.com: strdup to qemu_strdup conversion]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TWRITE support
Anthony Liguori [Thu, 29 Apr 2010 12:14:58 +0000 (17:44 +0530)]
virtio-9p: Add P9_TWRITE support

Implement P9_TWRITE support.
This gets write to file to work

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TCLUNK support
Anthony Liguori [Thu, 29 Apr 2010 12:14:57 +0000 (17:44 +0530)]
virtio-9p: Add P9_TCLUNK support

Implement P9_TCLUNK support.
This patch gets `ls -al` to work.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TREAD support
Anthony Liguori [Thu, 29 Apr 2010 12:14:56 +0000 (17:44 +0530)]
virtio-9p: Add P9_TREAD support

Implement P9_TREAD support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TOPEN support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:55 +0000 (17:44 +0530)]
virtio-9p: Add P9_TOPEN support.

Implement P9_TOPEN support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TWALK support
Anthony Liguori [Thu, 29 Apr 2010 12:14:54 +0000 (17:44 +0530)]
virtio-9p: Add P9_TWALK support

Implement P9_TWALK support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TSTAT support
Anthony Liguori [Thu, 29 Apr 2010 12:14:53 +0000 (17:44 +0530)]
virtio-9p: Add P9_TSTAT support

Implement P9_TSTAT support. This get the mount to work on the guest.

[kiran@linux.vnet.ibm.com: malloc to qemu_malloc conversion]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TATTACH support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:52 +0000 (17:44 +0530)]
virtio-9p: Add P9_TATTACH support.

Implement P9_TATTACH support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TVERSION support
Anthony Liguori [Thu, 29 Apr 2010 12:14:51 +0000 (17:44 +0530)]
virtio-9p: Add P9_TVERSION support

Implement P9_TVERSION support.

[sripathik@in.ibm.com: Handle unknown 9P versions as per the standards]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add sg helper functions
Anthony Liguori [Thu, 29 Apr 2010 12:14:50 +0000 (17:44 +0530)]
virtio-9p: Add sg helper functions

Add scatter-gather helper functions.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add stat and mode related helper functions.
Anthony Liguori [Thu, 29 Apr 2010 12:14:49 +0000 (17:44 +0530)]
virtio-9p: Add stat and mode related helper functions.

Add helpers to obtain file stat and mode details.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add fid and qid management support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:48 +0000 (17:44 +0530)]
virtio-9p: Add fid and qid management support.

Helper APIs for FID and QID management.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add minimal set of FileOperations
Anthony Liguori [Thu, 29 Apr 2010 12:14:47 +0000 (17:44 +0530)]
virtio-9p: Add minimal set of FileOperations

Add minimal set of FileOperations and the corresponding implementations for
local fstype. These will be required for the FID management patches later on.

[aneesh.kumar@linux.vnet.ibm.com: rpath fix ]
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add string manipulation support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:46 +0000 (17:44 +0530)]
virtio-9p: Add string manipulation support.

Add helpers to do string manipulation.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: pdu processing support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:45 +0000 (17:44 +0530)]
virtio-9p: pdu processing support.

Add helpers to process the PDUs.

[kiran@linux.vnet.ibm.com: malloc to qemu_malloc coversion]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add a virtio 9p device to qemu
Anthony Liguori [Thu, 29 Apr 2010 12:14:44 +0000 (17:44 +0530)]
virtio-9p: Add a virtio 9p device to qemu

This patch doesn't implement the 9p protocol handling
code. It adds a simple device which dump the protocol data.

[jvrao@linux.vnet.ibm.com: Little-Endian to host format conversion]
[aneesh.kumar@linux.vnet.ibm.com: Multiple-mounts support]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Create a commandline option -fsdev
Gautham R Shenoy [Thu, 29 Apr 2010 12:14:43 +0000 (17:44 +0530)]
virtio-9p: Create a commandline option -fsdev

This patch creates a new command line option named -fsdev to hold any file
system specific information.

The option will currently hold the following attributes:
-fsdev fstype id=id,path=path_to_share
where
fstype: Type of the file system.
id:     Identifier used to refer to this fsdev
path:   The path on the host that is identified by this fsdev.

[aneesh.kumar@linux.vnet.ibm.com: Abstraction using FsContext]
Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Fix check for 'assert'; prevent NULL derefs
Amit Shah [Fri, 30 Apr 2010 11:13:55 +0000 (16:43 +0530)]
virtio-serial: Fix check for 'assert'; prevent NULL derefs

In the flush_queued_data() function, we expect port to be valid. Assert
only for port and not port || discard.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix the RARP protocol ID
Stefan Berger [Sat, 24 Apr 2010 12:54:07 +0000 (08:54 -0400)]
Fix the RARP protocol ID

The packet(s) sent out after migration are supposed to be RAPR type of
packets. If they are supposed to go anywhere useful, the RAPR ethernet
identifier needs to be fix.

Also see http://www.iana.org/assignments/ethernet-numbers for 0x8035 for
RARP.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix tiny leak in qemu_opts_parse
Jan Kiszka [Thu, 29 Apr 2010 16:24:43 +0000 (18:24 +0200)]
Fix tiny leak in qemu_opts_parse

qemu_opts_create duplicates the id we pass in case it shall be stored in
the opts. So we do not need to dup it in qemu_opts_parse, leaking a few
bytes this way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Properly initialize controller state on reset
Jan Kiszka [Fri, 30 Apr 2010 12:06:13 +0000 (14:06 +0200)]
lsi: Properly initialize controller state on reset

The LSI controller was lacking a system reset handler. Simply invoke the
existing soft reset handler in this case. This also allows to drop its
explicit invocation during init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Purge request queue on soft reset
Jan Kiszka [Fri, 30 Apr 2010 12:06:12 +0000 (14:06 +0200)]
lsi: Purge request queue on soft reset

Avoid keeping zombie requests across controller reset by purging the
queue and also dropping the currently active request.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix boot once option
Alex Williamson [Fri, 30 Apr 2010 21:21:11 +0000 (15:21 -0600)]
Fix boot once option

The boot once options seems to have gotten broken since it originally
went in.  We need to wait until the second time restore_boot_devices()
gets called before restoring the standard boot order and removing itself
from the reset list.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
--
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: split encoding in specific files
Corentin Chary [Mon, 3 May 2010 12:31:34 +0000 (14:31 +0200)]
vnc: split encoding in specific files

This will allow to implement new encodings (tight, zrle, ..)
in a cleaner way. This may hurt performances, because some
functions like vnc_convert_pixel are not static anymore, but
should not be a problem with gcc 4.5 and the new -flto.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: Fix compile error on x86_64 with -D_VNC_DEBUG=1
Corentin Chary [Mon, 3 May 2010 12:31:18 +0000 (14:31 +0200)]
vnc: Fix compile error on x86_64 with -D_VNC_DEBUG=1

cc1: warnings being treated as errors
vnc-auth-sasl.c: In function ‘vnc_client_write_sasl’:
vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’
vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’
make: *** [vnc-auth-sasl.o] Error 1

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'kwolf/for-anthony' into HEAD
Anthony Liguori [Mon, 3 May 2010 12:31:51 +0000 (07:31 -0500)]
Merge remote branch 'kwolf/for-anthony' into HEAD

14 years agoMerge remote branch 'qemu-kvm/uq/master' into HEAD
Anthony Liguori [Mon, 3 May 2010 12:31:37 +0000 (07:31 -0500)]
Merge remote branch 'qemu-kvm/uq/master' into HEAD

14 years agoblock: Release allocated options after bdrv_open
Jan Kiszka [Thu, 29 Apr 2010 16:24:50 +0000 (18:24 +0200)]
block: Release allocated options after bdrv_open

They aren't used afterwards nor supposed to be stored by a bdrv_create
handler.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-img rebase: Fix output image corruption
Kevin Wolf [Thu, 29 Apr 2010 12:47:48 +0000 (14:47 +0200)]
qemu-img rebase: Fix output image corruption

qemu-img rebase must always give clusters in the COW file priority over those
in the backing file. As it failed to use number of non-allocated clusters but
assumed the maximum, it was possible that allocated clusters were taken from
the backing file instead, leading to a corrupted output image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Add wr_highest_sector blockstat
Kevin Wolf [Wed, 28 Apr 2010 12:34:01 +0000 (14:34 +0200)]
block: Add wr_highest_sector blockstat

This adds the wr_highest_sector blockstat which implements what is generally
known as the high watermark. It is the highest offset of a sector written to
the respective BlockDriverState since it has been opened.

The query-blockstat QMP command is extended to add this value to the result,
and also to add the statistics of the underlying protocol in a new "parent"
field. Note that to get the "high watermark" of a qcow2 image, you need to look
into the wr_highest_sector field of the parent (which can be a file, a
host_device, ...). The wr_highest_sector of the qcow2 BlockDriverState itself
is the highest offset on the _virtual_ disk that the guest has written to.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Implement bdrv_truncate() for growing images
Stefan Hajnoczi [Wed, 28 Apr 2010 10:36:11 +0000 (11:36 +0100)]
qcow2: Implement bdrv_truncate() for growing images

This patch adds the ability to grow qcow2 images in-place using
bdrv_truncate().  This enables qemu-img resize command support for
qcow2.

Snapshots are not supported and bdrv_truncate() will return -ENOTSUP.
The notion of resizing an image with snapshots could lead to confusion:
users may expect snapshots to remain unchanged, but this is not possible
with the current qcow2 on-disk format where the header.size field is
global instead of per-snapshot.  Others may expect snapshots to change
size along with the current image data.  I think it is safest to not
support snapshots and perhaps add behavior later if there is a
consensus.

Backing images continue to work.  If the image is now larger than its
backing image, zeroes are read when accessing beyond the end of the
backing image.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Remove abort on free_clusters failure
Kevin Wolf [Wed, 21 Apr 2010 09:37:52 +0000 (11:37 +0200)]
qcow2: Remove abort on free_clusters failure

While it's true that during regular operation free_clusters failure would be a
bug, an I/O error can always happen. There's no need to kill the VM, the worst
thing that can happen (and it will) is that we leak some clusters.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-img: Add 'resize' command to grow/shrink disk images
Stefan Hajnoczi [Sat, 24 Apr 2010 08:12:12 +0000 (09:12 +0100)]
qemu-img: Add 'resize' command to grow/shrink disk images

This patch adds a 'resize' command to grow/shrink disk images.  This
allows changing the size of disk images without copying to a new image
file.  Currently only raw files support resize.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Cache total_sectors to reduce bdrv_getlength calls
Stefan Hajnoczi [Mon, 19 Apr 2010 15:56:41 +0000 (16:56 +0100)]
block: Cache total_sectors to reduce bdrv_getlength calls

The BlockDriver bdrv_getlength function is called from the I/O code path
when checking that the request falls within the device.  Unfortunately
this involves an lseek system call in the raw protocol; every read or
write request will incur this lseek cost.

Jan Kiszka <jan.kiszka@siemens.com> identified this issue and its
latency overhead.  This patch caches device length in the existing
total_sectors variable so lseek calls can be avoided for fixed size
devices.

Growable devices fall back to the full bdrv_getlength code path because
I have not added logic to detect extending the size of the device in a
write.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoraw-posix: Use pread/pwrite instead of lseek+read/write
Stefan Hajnoczi [Mon, 19 Apr 2010 12:34:11 +0000 (13:34 +0100)]
raw-posix: Use pread/pwrite instead of lseek+read/write

This patch combines the lseek+read/write calls to use pread/pwrite
instead.  This will result in fewer system calls and is already used by
AIO.

Thanks to Jan Kiszka <jan.kiszka@siemens.com> for identifying excessive
lseek and Christoph Hellwig <hch@lst.de> for confirming that this
approach should work.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Avoid shadowing variable in alloc_clusters_noref()
Stefan Hajnoczi [Sat, 17 Apr 2010 09:49:07 +0000 (10:49 +0100)]
qcow2: Avoid shadowing variable in alloc_clusters_noref()

The i loop iterator is shadowed by the next free cluster index.  Both
using the variable name 'i' makes the code harder to read.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Set backing_hd to NULL after deleting it
Stefan Hajnoczi [Sat, 17 Apr 2010 09:49:06 +0000 (10:49 +0100)]
block: Set backing_hd to NULL after deleting it

It is safer to set backing_hd to NULL after deleting it so that any use
after deletion is obvious during development.  Happy segfaulting!

This patch should be applied after Kevin Wolf's "vmdk: Convert to
bdrv_open" so that vmdk does not segfault on close.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovmdk: Convert to bdrv_open
Kevin Wolf [Fri, 16 Apr 2010 19:27:51 +0000 (21:27 +0200)]
vmdk: Convert to bdrv_open

It's a format driver, so implement bdrv_open instead of bdrv_file_open.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovmdk: Clean up backing file handling
Kevin Wolf [Fri, 16 Apr 2010 19:07:19 +0000 (21:07 +0200)]
vmdk: Clean up backing file handling

VMDK is doing interesting things when it needs to open a backing file. This
patch changes that part to look more like in other drivers. The nice side
effect is that the file name isn't needed any more in the open function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovmdk: Fix COW
Kevin Wolf [Fri, 16 Apr 2010 17:28:14 +0000 (19:28 +0200)]
vmdk: Fix COW

When trying to do COW, VMDK wrote the data back to the backing file. This
problem was revealed by the patch that made backing files read-only. This patch
does not only fix the problem, but also simplifies the VMDK code a bit.

This fixes the backing file qemu-iotests cases for VMDK.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: bdrv_has_zero_init
Kevin Wolf [Wed, 14 Apr 2010 15:30:35 +0000 (17:30 +0200)]
block: bdrv_has_zero_init

This fixes the problem that qemu-img's use of no_zero_init only considered the
no_zero_init flag of the format driver, but not of the underlying protocols.

Between the raw/file split and this fix, converting to host devices is broken.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Open the underlying image file in generic code
Kevin Wolf [Wed, 14 Apr 2010 12:17:38 +0000 (14:17 +0200)]
block: Open the underlying image file in generic code

Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which
need to access the filename to open their file/device/connection/... a new
callback bdrv_file_open is introduced which doesn't get an underlying file
opened.

For now, also some of the more obscure formats use bdrv_file_open because they
open() the file themselves instead of using the block.c functions. They need to
be fixed in later patches.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Avoid forward declaration of bdrv_open_common
Kevin Wolf [Wed, 14 Apr 2010 13:24:50 +0000 (15:24 +0200)]
block: Avoid forward declaration of bdrv_open_common

Move bdrv_open_common so it's defined before its callers and remove the forward
declaration.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Split bdrv_open
Kevin Wolf [Mon, 12 Apr 2010 14:37:13 +0000 (16:37 +0200)]
block: Split bdrv_open

bdrv_open contains quite some code that is only useful for opening images (as
opposed to opening files by a protocol), for example snapshots.

This patch splits the code so that we have bdrv_open_file() for files (uses
protocols), bdrv_open() for images (uses format drivers) and bdrv_open_common()
for the code common for opening both images and files.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: separate raw images from the file protocol
Christoph Hellwig [Wed, 7 Apr 2010 20:30:24 +0000 (22:30 +0200)]
block: separate raw images from the file protocol

We're running into various problems because the "raw" file access, which
is used internally by the various image formats is entangled with the
"raw" image format, which maps the VM view 1:1 to a file system.

This patch renames the raw file backends to the file protocol which
is treated like other protocols (e.g. nbd and http) and adds a new
"raw" image format which is just a wrapper around calls to the underlying
protocol.

The patch is surprisingly simple, besides changing the probing logical
in block.c to only look for image formats when using bdrv_open and
renaming of the old raw protocols to file there's almost nothing in there.

For creating images, a new bdrv_create_file is introduced which guesses the
protocol to use. This allows using qemu-img create -f raw (or just using the
default) for both files and host devices. Converting the other format drivers
to use this function to create their images is left for later patches.

The only issues still open are in the handling of the host devices.
Firstly in current qemu we can specifiy the host* format names
on various command line acceping images, but the new code can't
do that without adding some translation.  Second the layering breaks
the no_zero_init flag in the BlockDriver used by qemu-img.  I'm not
happy how this is done per-driver instead of per-state so I'll
prepare a separate patch to clean this up.

There's some more cleanup opportunity after this patch, e.g. using
separate lists and registration functions for image formats vs
protocols and maybe even host drivers, but this can be done at a
later stage.

Also there's a check for protocol in bdrv_open for the BDRV_O_SNAPSHOT
case that I don't quite understand, but which I fear won't work as
expected - possibly even before this patch.

Note that this patch requires various recent block patches from Kevin
and me, which should all be in his block queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoFix missing '|' in '|=', spotted by clang analyzer
Blue Swirl [Sun, 2 May 2010 18:38:10 +0000 (18:38 +0000)]
Fix missing '|' in '|=', spotted by clang analyzer

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agofix old typos in help header
Thomas Monjalon [Wed, 28 Apr 2010 12:42:01 +0000 (14:42 +0200)]
fix old typos in help header

1) Qemu is not only a PC emulator.
2) "image image" has already been changed to "disk image" in qemu-doc.texi

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoClean up definition of MAX_OPC_PARAM
Stuart Brady [Tue, 27 Apr 2010 21:23:35 +0000 (22:23 +0100)]
Clean up definition of MAX_OPC_PARAM

MAX_OPC_PARAM is intended to refer to the maximum number of entries used
in gen_opparam_buf[] for any single helper call.  It is currently defined
as 10, but for 32-bit archs, the correct value (with a maximum for four
helper arguments) is 14, and for 64-bit archs, only 9 entries are needed.

tcg_gen_callN() fills four entries with the function address, flags,
number of args, etc. and on 32-bit archs uses a further two entries per
argument (with a maximum of four helper arguments), plus two more for the
return value.  On 64-bit archs, only half as many entries are used for the
args and the return value.

In reality, TBs tend not to consist purely of helper calls exceeding the
stated 10 gen_opparam_buf[] entries, so this would never actually be a
problem on 32-bit archs, but the definition is still rather confusing.

Signed-off-by: Stuart Brady <sdb@zubnet.me.uk>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agocmd646: fix abort due to changed opaque pointer for ioport read
Igor V. Kovalenko [Thu, 22 Apr 2010 21:54:50 +0000 (01:54 +0400)]
cmd646: fix abort due to changed opaque pointer for ioport read

We cannot install different opaque pointer for read and write
of the same i/o address.

- handle zero address in bmdma_writeb_common and install
  the same opaque pointer for both read and write access.

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agocmd646: pass pci_dev as it needs it
Igor V. Kovalenko [Thu, 22 Apr 2010 21:54:45 +0000 (01:54 +0400)]
cmd646: pass pci_dev as it needs it

Instead of doing tricks to get the pci_dev, just pass it in the 1st
place.  Patch is a bit longer that reverting the pci_dev field, but it
states more clearly (IMHO) what we are doing.

It also fixes the bm test, now that you told me that ->unit is not
always valid.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agokvm: port qemu-kvm's bitmap scanning
Marcelo Tosatti [Fri, 23 Apr 2010 17:04:14 +0000 (14:04 -0300)]
kvm: port qemu-kvm's bitmap scanning

Which is significantly faster.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agointroduce leul_to_cpu
Marcelo Tosatti [Fri, 23 Apr 2010 17:04:13 +0000 (14:04 -0300)]
introduce leul_to_cpu

To be used by next patch.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agovga: fix typo in length passed to kvm_log_stop
Marcelo Tosatti [Fri, 23 Apr 2010 17:04:11 +0000 (14:04 -0300)]
vga: fix typo in length passed to kvm_log_stop

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agovirtio-serial: Implement flow control for individual ports
Amit Shah [Tue, 27 Apr 2010 12:34:11 +0000 (18:04 +0530)]
virtio-serial: Implement flow control for individual ports

Individual ports can now signal to the virtio-serial core to stop
sending data if the ports cannot immediately handle new data.  When a
port later unthrottles, any data queued up in the virtqueue are sent to
the port.

Disable throttling once a port is closed (and we discard all the
unconsumed buffers in the vq).

The guest kernel can reclaim the buffers when it receives the port close
event or when a port is being removed. Ensure we free up the buffers
before we send out any events to the guest.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Discard data that guest sends us when ports aren't connected
Amit Shah [Tue, 27 Apr 2010 12:34:10 +0000 (18:04 +0530)]
virtio-serial: Discard data that guest sends us when ports aren't connected

Before the earlier patch, we relied on incorrect virtio api usage to
signal to the guest that a particular buffer wasn't consumed by the
host.

After fixing that, we now just discard the data the guest sends us while
a host port is disconnected or doesn't have a handler registered for
consuming data.

This commit really doesn't change anything from the current behaviour,
just makes the code slightly better by spinning off data handling to
ports in another function.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Apps should consume all data that guest sends out / Fix virtio api...
Amit Shah [Tue, 27 Apr 2010 12:34:09 +0000 (18:04 +0530)]
virtio-serial: Apps should consume all data that guest sends out / Fix virtio api abuse

We cannot indicate to the guest how much data was consumed by an app for
out_bufs.  So we just have to assume the apps will consume all the data
that are handed over to them.

Fix the virtio api abuse in control_out() and handle_output().

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Handle scatter/gather input from the guest
Amit Shah [Tue, 27 Apr 2010 12:34:08 +0000 (18:04 +0530)]
virtio-serial: Handle scatter/gather input from the guest

Current guests don't send more than one iov but it can change later.
Ensure we handle that case.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Handle scatter-gather buffers for control messages
Amit Shah [Tue, 27 Apr 2010 12:34:07 +0000 (18:04 +0530)]
virtio-serial: Handle scatter-gather buffers for control messages

Current control messages are small enough to not be split into multiple
buffers but we could run into such a situation in the future or a
malicious guest could cause such a situation.

So handle the entire iov request for control messages.

Also ensure the size of the control request is >= what we expect
otherwise we risk accessing memory that we don't own.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Avi Kivity <avi@redhat.com>
Reported-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoiov: Add iov_to_buf and iov_size helpers
Amit Shah [Tue, 27 Apr 2010 12:34:06 +0000 (18:04 +0530)]
iov: Add iov_to_buf and iov_size helpers

iov_to_buf() puts the buffer contents in the iov in a linearized buffer.

iov_size() gets the length of the contents in the iov.

The iov_to_buf() function is the memcpy_to_iovec() function that was
used in virtio-ballon.c.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoiov: Introduce a new file for helpers around iovs, add iov_from_buf()
Amit Shah [Tue, 27 Apr 2010 12:34:05 +0000 (18:04 +0530)]
iov: Introduce a new file for helpers around iovs, add iov_from_buf()

The virtio-net code uses iov_fill() which fills an iov from a linear
buffer. The virtio-serial-bus code does something similar in an
open-coded function.

Create a new iov.c file that has iov_from_buf().

Convert virtio-net and virtio-serial-bus over to use this functionality.
virtio-net used ints to hold sizes, the new function is going to use
size_t types.

Later commits will add the opposite functionality -- going from an iov
to a linear buffer.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Send out guest data to ports only if port is opened
Amit Shah [Tue, 27 Apr 2010 12:34:04 +0000 (18:04 +0530)]
virtio-serial: Send out guest data to ports only if port is opened

Data should be written only when ports are open.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Propagate errors in initialising ports / devices in guest
Amit Shah [Tue, 27 Apr 2010 12:34:03 +0000 (18:04 +0530)]
virtio-serial: Propagate errors in initialising ports / devices in guest

If adding of ports or devices in the guest fails we can send out a QMP
event so that management software can deal with it.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Update copyright year to 2010
Amit Shah [Tue, 27 Apr 2010 12:34:02 +0000 (18:04 +0530)]
virtio-serial: Update copyright year to 2010

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Remove redundant check for 0-sized write request
Amit Shah [Tue, 27 Apr 2010 12:34:01 +0000 (18:04 +0530)]
virtio-serial: Remove redundant check for 0-sized write request

The check for a 0-sized write request to a guest port is not necessary;
the while loop below won't be executed in this case and all will be
fine.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: whitespace: match surrounding code
Amit Shah [Tue, 27 Apr 2010 12:34:00 +0000 (18:04 +0530)]
virtio-serial: whitespace: match surrounding code

The virtio-serial code doesn't mix declarations and definitions, so
separate them out on different lines.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Use control messages to notify guest of new ports
Amit Shah [Tue, 27 Apr 2010 12:33:59 +0000 (18:03 +0530)]
virtio-serial: Use control messages to notify guest of new ports

Allow the port 'id's to be set by a user on the command line. This is
needed by management apps that will want a stable port numbering scheme
for hot-plug/unplug and migration.

Since the port numbers are shared with the guest (to identify ports in
control messages), we just send a control message to the guest
indicating addition of new ports (hot-plug) or notifying the guest of
the available ports when the guest sends us a DEVICE_READY control
message.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: save/load: Send target host connection status if different
Amit Shah [Tue, 27 Apr 2010 12:33:58 +0000 (18:03 +0530)]
virtio-serial: save/load: Send target host connection status if different

If the host connection to a port is closed on the destination machine
after migration, whereas the connection was open on the source, the
guest has to be informed of that.

Similar for a host connection open on the destination.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: save/load: Ensure we have hot-plugged ports instantiated
Amit Shah [Tue, 27 Apr 2010 12:33:57 +0000 (18:03 +0530)]
virtio-serial: save/load: Ensure we have hot-plugged ports instantiated

If some ports that were hot-plugged on the source are not available on
the destination, fail migration instead of trying to deref a NULL
pointer.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: save/load: Ensure nr_ports on src and dest are same.
Amit Shah [Tue, 27 Apr 2010 12:33:56 +0000 (18:03 +0530)]
virtio-serial: save/load: Ensure nr_ports on src and dest are same.

The number of ports on the source as well as the destination machines
should match. If they don't, it means some ports that got hotplugged on
the source aren't instantiated on the destination. Or that ports that
were hot-unplugged on the source are created on the destination.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: save/load: Ensure target has enough ports
Amit Shah [Tue, 27 Apr 2010 12:33:55 +0000 (18:03 +0530)]
virtio-serial: save/load: Ensure target has enough ports

The target could be started with max_nr_ports for a virtio-serial device
lesser than what was available on the source machine. Fail the migration
in such a case.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomicroblaze: fix custom fprintf
Thomas Monjalon [Tue, 27 Apr 2010 13:27:09 +0000 (15:27 +0200)]
microblaze: fix custom fprintf

Using GCC-4.2.4-1ubuntu4, there is a warning:
microblaze-dis.c:792: warning: unused variable 'fprintf'

Indeed, fprintf() is shadowed by a custom redefinition but is not used because
of FORTIFY_SOURCE option which replace calls to fprintf() by fprintf_chk().
So, fprintf refers to the libc implementation instead of the qemu one.
It's a bug.

It is fixed by renaming the variable to something different of "fprintf".
It prevents from hazardous shadowing.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoImplement cpu_get_real_ticks for Alpha.
Richard Henderson [Mon, 12 Apr 2010 23:19:26 +0000 (16:19 -0700)]
Implement cpu_get_real_ticks for Alpha.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement RPCC.
Richard Henderson [Mon, 12 Apr 2010 23:18:43 +0000 (16:18 -0700)]
target-alpha: Implement RPCC.

A minimal implementation that more or less corresponds to the
user-level version used by target-i386.  More hoops will want
to be jumped through when alpha gets system-level emulation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix load-locked/store-conditional.
Richard Henderson [Wed, 7 Apr 2010 22:42:26 +0000 (15:42 -0700)]
target-alpha: Fix load-locked/store-conditional.

Use an exception plus start_exclusive to implement the compare-and-swap.
This follows the example set by the MIPS and PPC ports.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Indicate NORETURN status when raising exception.
Richard Henderson [Wed, 7 Apr 2010 20:32:50 +0000 (13:32 -0700)]
target-alpha: Indicate NORETURN status when raising exception.

When (indirectly) calling raise_exception, don't emit cleanup
code at the end of the TB, as it is unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Enable NPTL.
Richard Henderson [Mon, 12 Apr 2010 23:17:22 +0000 (16:17 -0700)]
target-alpha: Enable NPTL.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Update commentary for opcode 0x1A.
Richard Henderson [Mon, 29 Mar 2010 17:48:14 +0000 (10:48 -0700)]
target-alpha: Update commentary for opcode 0x1A.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Emit goto_tb opcodes.
Richard Henderson [Tue, 16 Mar 2010 22:10:49 +0000 (15:10 -0700)]
target-alpha: Emit goto_tb opcodes.

Use an ExitStatus enumeration instead of magic numbers as the return
value from translate_one.  Emit goto_tb opcodes when ending a TB via
a direct branch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement cvtlq inline.
Richard Henderson [Wed, 7 Apr 2010 17:17:24 +0000 (10:17 -0700)]
target-alpha: Implement cvtlq inline.

It's a simple shift and mask sequence.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement rs/rc properly.
Richard Henderson [Mon, 12 Apr 2010 23:14:54 +0000 (16:14 -0700)]
target-alpha: Implement rs/rc properly.

This is a per-cpu flag; there's no need for a spinlock of any kind.

We were also failing to manipulate the flag with $31 as a target reg
and failing to clear the flag on execution of a return-from-interrupt
instruction.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement cpys{, n, e} inline.
Richard Henderson [Mon, 12 Apr 2010 23:12:20 +0000 (16:12 -0700)]
target-alpha: Implement cpys{, n, e} inline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoMerge remote branch 'qmp/for-anthony' into staging
Anthony Liguori [Mon, 26 Apr 2010 20:10:14 +0000 (15:10 -0500)]
Merge remote branch 'qmp/for-anthony' into staging

14 years agostash away SCM_RIGHTS fd until a getfd command arrives
Paolo Bonzini [Fri, 16 Apr 2010 15:25:23 +0000 (17:25 +0200)]
stash away SCM_RIGHTS fd until a getfd command arrives

If there is already a fd in s->msgfd before recvmsg it is
closed by parts that this patch does not touch.  So, only
one descriptor can be "leaked" by attaching it to a command
other than getfd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agochardev: Document mux option
Jan Kiszka [Tue, 6 Apr 2010 14:55:54 +0000 (16:55 +0200)]
chardev: Document mux option

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Reorder intialization to drop initial mux focus
Jan Kiszka [Tue, 6 Apr 2010 14:55:53 +0000 (16:55 +0200)]
monitor: Reorder intialization to drop initial mux focus

So far a multiplexed monitor started disabled. Restore this property for
the new way of configuring by moving the monitor initialization before
all devices (the last one to attach to a char-mux will gain the focus).

Once we have a real use case for that, we may also consider assigning
the initial focus explicitly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Cleanup ID assignment for compat switch
Jan Kiszka [Tue, 6 Apr 2010 14:55:52 +0000 (16:55 +0200)]
monitor: Cleanup ID assignment for compat switch

Canonicalize the ID assignment when creating monitor devices via the
legacy switch and use less easily colliding names.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoMonitor: Return before exiting with 'quit'
Luiz Capitulino [Tue, 6 Apr 2010 21:55:54 +0000 (18:55 -0300)]
Monitor: Return before exiting with 'quit'

The 'quit' Monitor command (implemented by do_quit()) calls
exit() directly, this is problematic under QMP because QEMU
exits before having a chance to send the ok response.

Clients don't know if QEMU exited because of a problem or
because the 'quit' command has been executed.

This commit fixes that by moving the exit() call to the main
loop, so that do_quit() requests the system to quit, instead
of calling exit() directly.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agotcg-hppa: Remove automatically implemented opcodes.
Richard Henderson [Sat, 10 Apr 2010 20:22:28 +0000 (22:22 +0200)]
tcg-hppa: Remove automatically implemented opcodes.

Remove neg, ext8u, ext16u, as requested.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Fix branch offset during retranslation.
Richard Henderson [Fri, 9 Apr 2010 19:49:00 +0000 (21:49 +0200)]
tcg-hppa: Fix branch offset during retranslation.

Branch offsets should only be overwritten during relocation,
to support partial retranslation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Schedule the address masking after the TLB load.
Richard Henderson [Fri, 9 Apr 2010 17:49:10 +0000 (10:49 -0700)]
tcg-hppa: Schedule the address masking after the TLB load.

Issue the tlb load as early as possible and perform the address
masking while the load is completing.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Fix softmmu loads and stores.
Richard Henderson [Fri, 9 Apr 2010 17:48:02 +0000 (10:48 -0700)]
tcg-hppa: Fix softmmu loads and stores.

Along the tlb hit path, we were modifying the variables holding the input
register numbers, which lead to incorrect expansion of the tlb miss path.
Fix this by extracting the tlb hit path to separate functions with their
own local variables.  This also makes the difference between softmmu and
user-only easier to read.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Fix GUEST_BASE initialization in prologue.
Richard Henderson [Fri, 9 Apr 2010 17:46:40 +0000 (10:46 -0700)]
tcg-hppa: Fix GUEST_BASE initialization in prologue.

Load from the guest_base variable rather than embed a constant.
Always reserve TCG_GUEST_BASE_REG if guest base support enabled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Constrain immediate inputs to and_i32, or_i32, andc_i32.
Richard Henderson [Fri, 9 Apr 2010 17:45:49 +0000 (10:45 -0700)]
tcg-hppa: Constrain immediate inputs to and_i32, or_i32, andc_i32.

Define "M" constraint for and_mask_p and "O" constraint for or_mask_p.
Assume that inputs are correct in tcg_out_ori and tcg_out_andi.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: Fix sparc32plus stat64 syscalls.
Richard Henderson [Mon, 26 Apr 2010 17:27:22 +0000 (10:27 -0700)]
linux-user: Fix sparc32plus stat64 syscalls.

Check TARGET_ABI_BITS, not TARGET_LONG_BITS, when deciding
whether or not the guest needs special 64-bit stat translation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-sparc: Fix -singlestep.
Richard Henderson [Mon, 26 Apr 2010 17:17:24 +0000 (10:17 -0700)]
target-sparc: Fix -singlestep.

Single-stepping was not properly updating npc, resulting in some
instructions being executed twice.  In addition, we were emitting
dead code at the end of the TB.

Fix both by teaching gen_goto_tb to avoid goto_tb for single-step
and removing the special-case code in gen_intermediate_code_internal.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agokvm_init_vcpu requires global lock held
Marcelo Tosatti [Tue, 23 Mar 2010 16:37:13 +0000 (13:37 -0300)]
kvm_init_vcpu requires global lock held

Since it accesses data protected by the lock.

Signed-off-by: Avi Kivity <avi@redhat.com>