Commit Graph

7596 Commits

Author SHA1 Message Date
Jan Kiszka dff840348e kvm: Restrict configure check to Linux
There is no point in trying to find KVM on anything else than Linux, at
least for the moment.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:37 -05:00
Jan Kiszka 4ab312f793 mux-term: Fix timestamp association
So far a new timestamp was generated *after* a full line had been
printed. Fix this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:37 -05:00
Jan Kiszka 2d22959d61 mux-term: Localize timestamps
As we can have multiple multiplexed terminals, timestamp control and
tracking should better take place per MuxDriver.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:37 -05:00
Luiz Capitulino 759754f01f readline: Remove unneeded qemu_mallocz() check
qemu_mallocz() already checks for NULL returns, readline_init() doesn't
have to do it again.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:37 -05:00
Kevin Wolf 9923e05e1a update_refcount: Write complete sectors
When updating the refcount blocks in update_refcount(), write complete sectors
instead of updating single entries.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:37 -05:00
Kevin Wolf 4c1612d954 alloc_cluster_link_l2: Write complete sectors
When updating the L2 tables in alloc_cluster_link_l2(), write complete
sectors instead of updating single entries.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Kevin Wolf 6583e3c7e8 l2_allocate: Write complete sectors
When modifying the L1 table, l2_allocate() needs to write complete sectors
instead of single entries. The L1 table is already in memory, reading it from
disk in the block layer to align the request is wasted performance.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Kevin Wolf ed6ccf0f51 qcow2: Rename global functions
The qcow2 source is now split into several more manageable files. During the
conversion quite some functions that were static before needed to be changed to
be global to make the source compile again.

We were lucky enough not to get name conflicts with these additional global
names, but they are not nice. This patch adds a qcow2_ prefix to all of the
global functions in qcow2.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Kevin Wolf c142442b06 qcow2: Split out snapshot functions
qcow2-snapshot.c contains the code related to snapshotting.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Kevin Wolf 45aba42fba qcow2: Split out guest cluster functions
qcow2-cluster.c contains all functions related to the management of guest
clusters, i.e. what the guest sees on its virtual disk. This code is about
mapping these guest clusters to host clusters in the image file using the
two-level lookup tables.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Kevin Wolf f7d0fe0239 qcow2: Split out refcount handling
qcow2-refcount.c contains all functions which are related to cluster
allocation and management in the image file. A large part of this is the
reference counting of these clusters.

Also a header file qcow2.h is introduced which will contain the interface of
the split qcow2 modules.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Kevin Wolf 9ccb258e28 qcow2: Change default cluster size to 64k
Larger cluster sizes mean less metadata. This has been discussion a few times,
let's do it now. This turns 64k clusters on by default for new images.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Gerd Hoffmann 198a0039c5 vnc: rework VncState release workflow.
Split socket closing and releasing of VncState into two steps.  First
close the socket and set the variable to -1 to indicate shutdown in
progress.  Do the actual release in a few places where we can be sure it
doesn't cause trouble in form of use-after-free.  Add some checks for a
valid socket handle to make sure we don't try to use the closed socket.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:36 -05:00
Avi Kivity 11a1feb655 raw-posix: Remove O_RDWR when attempting to open a file read-only
When we open a file, we first attempt to open it read-write, then fall back
to read-only.  Unfortunately we reuse the flags from the previous attempt,
so both attempts try to open the file with write permissions, and fail.

Fix by clearing the O_RDWR flag from the previous attempt.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:35 -05:00
Avi Kivity 736d0c25ed raw-posix: open flags use BDRV_ namespace, not posix namespace
The flags argument to raw_common_open() contain bits defined by the BDRV_O_*
namespace, not the posix O_* namespace.

Adjust to use the correct constants.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:35 -05:00
Markus Armbruster d3fa1e0f36 qdev: Fix regression in "pci_add ... storage if=virtio, ..."
qemu_pci_hot_add_storage() runs qdev_init() twice.  Broken in commit
07e3af9a "Virtio-blk qdev conversion".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:35 -05:00
Anthony Liguori 537fe2d63f Make sure to use SDL_CFLAGS everywhere we include SDL headers
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16 15:18:34 -05:00
Laurent Vivier 3f9ac9b39b linux-user: remove duplicate tswap32() from do_getsockopt()
This issue has been detected with tests/linux-tests.c:

linux-test.c:330: getsockopt

327     len = sizeof(val);
328     chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len));
329     if (val != SOCK_STREAM)
330         error("getsockopt");

In linux-user/syscall.c:do_getsockopt(), we have:
...
        val = tswap32(val);
...
            if (put_user_u32(val, optval_addr))
...

whereas "put_user_u32" calls in the end "__put_user" which uses "tswap32".

So the "val = tswap32(val);" is useless and wrong.

This patch removes it.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:58:45 +03:00
Eduardo Habkost d5b3a9b6a9 linux-user/syscall.c: define _ATFILE_SOURCE
Needed to make sure the xxxat() functions are available.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:58:45 +03:00
Nathan Froyd df377d0354 linux-user: initialize mmap_mutex properly
We initialize mmap_mutex in any child threads/processes, but we need to
correctly statically initialize it for the original process.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:58:45 +03:00
Arnaud Patard (Rtp) 5f10681186 RFC: fix fcntl support in linux-user - new try
Hi,

This is a new try to fix the fcntl support in linux-user. I tried to
adress all comments but as the previous version is several weeks old,
it's possible that I've missed some.

This patch doesn't handle linux specific fcntl flags. My plan is to get
this version of the patch reviewed/fixed and then, add them if wanted.

Thanks,
Arnaud

Signed-off-by: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:58:45 +03:00
vibisreenivasan 3ce34dfb42 linux-user: add tee, splice and vmsplice
Add support for tee, splice and vmsplice.

Originally from: vibi sreenivasan <vibi_sreenivasan@cms.com>

Riku: squashed patches together, added a test to configure
and removed compliler warning by picking up correct type for
splice param

Signed-off-by: vibisreenivasan <vibi_sreenivasan@cms.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:58:07 +03:00
Riku Voipio 099d6b0fe9 linux-user: implement pipe2 [v3]
implement pipe2 syscall.

[v2] fix do_pipe on mips and sh4
[v3] use pipe2 to ensure atomicity, but only when it is available.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Riku Voipio 4b627a236a linux-user: update syscall list
In preparation for supporting pipe2()

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Riku Voipio c4d2302e7a add futex wake op
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Martin Mohring a29ccd6382 linux-user: support private futexes
Implemented the same way as in the kernel.

From: Martin Mohring <martin.mohring@opensuse.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Martin Mohring 350d1779f8 linux-user: include linux/fs.h
defines FIGETBSZ FIBMAP, allowing the respective ioctl's to
be implemented.

From: Martin Mohring <martin.mohring@opensuse.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Lionel Landwerlin 6e3cb58fa2 linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt
linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Lionel Landwerlin b975b83bec linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockopt
linux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockopt

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:29 +03:00
Arnaud Patard 6f932f9172 Return EOPNOTSUPP instead of ENOSYS for *xattr* syscalls
In current code, we're sending ENOSYS to target when a syscall for the
xattrs is done. This makes applications like ls complain loudly about
that and breaks scripts parsing the output. Moreover, iirc, implemented
features of filesystems are are sending EOPNOTSUPP (I've not checked so
I may be a little bit wrong on that...).
So, I'm proposing to return -EOPNOTSUPP and make ls happy

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Arnaud Patard 44607123c4 Fix struct termios host - target translation
When converting the termios structure between host and target in
target_to_host_termios and host_to_target_termios, the c_cc[] array is
never initialised.
Calling memset() before using it allows to run successfully "stty echo /
stty -echo" on arm-linux-user target (host being x86 and mips).

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Riku Voipio ebc996f3b1 linux-user: fix utimensat
The glibc function for utimensat glibc returns -EINVAL when the path is null
which is a different behaviour with the syscall.

path can be null because internally the glibc is using utimensat with
path null when implmenting futimens. If path is null, call futimes
instead.

don't try to copy timespec from user if is NULL.

Add configure check for older systems

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Mika Westerberg 74d753ac86 linux-user: strace now handles guest strings correctly [v2]
- to not to break strace with GUEST_BASE is set:
- Strace now can load and print guest strings correctly.
- Added printing support for commonly used flags in some syscalls
  (e.g open, creat, mmap etc.)

v2:
- fix strace.c build on etch
- add futex print to strace

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Mika Westerberg 9edc5d7966 linux-user: added x86 and x86_64 support for ELF coredump
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Mika Westerberg edf8e2af14 linux-user: implemented ELF coredump support for ARM target
When target process is killed with signal (such signal that
should dump core) a coredump file is created.  This file is
similar than coredump generated by Linux (there are few exceptions
though).

Riku Voipio: added support for rlimit

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Riku Voipio 88a8c98455 Implement shm* syscalls and fix 64/32bit errors
No regressions were observed on either 64bit or 32bit
IA hosts.

Patch based on original patches by:
  Kirill A. Shutemov <kirill@shutemov.name>
  - Implement shm* syscalls
  - Fix and cleanup IPCOP_shm* ipc calls handling

Depends on "export mmap_find_vma for shmat" patch.

Various whitespace uglifications applied to minimize
patch size.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Riku Voipio 9ad197d95c export mmap_find_vma for shmat
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2009-06-16 16:56:28 +03:00
Anthony Liguori 72716184aa Incorporate changes from v2 of Gleb's RTC reset patch
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-15 14:35:14 -05:00
Edgar E. Iglesias ba494313d3 etrax: Don't pass CPUState to peripherals.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-06-15 21:00:50 +02:00
Anthony Liguori e510e05b5d Merge commit 'block/master' into staging
* commit 'block/master':
  raw-posix: cleanup ioctl methods
  block: add bdrv_probe_device method
  raw-posix: split hdev drivers
  raw-posix: add a raw_open_common helper
  raw-posix: always store open flags
  fix qemu_aio_flush

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-15 12:53:56 -05:00
Anthony Liguori f5de141b34 Fix warning in qemu-nbd.c
qemu-nbd.c:349: error: ignoring return value of 'daemon', declared with attribute warn_unused_result

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-15 12:51:37 -05:00
Christoph Hellwig 63ec93db21 raw-posix: cleanup ioctl methods
Rename raw_ioctl and raw_aio_ioctl to hdev_ioctl and hdev_aio_ioctl as they
are only used for the host device.  Also only add them to the method table
for the cases where we need them (generic hdev if linux and linux CDROM)
instead of declaring stubs and always add them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15 14:04:34 +02:00
Christoph Hellwig 508c7cb3fa block: add bdrv_probe_device method
Add a bdrv_probe_device method to all BlockDriver instances implementing
host devices to move matching of host device types into the actual drivers.
For now we keep exacly the old matching behaviour based on the devices names,
although we really should have better detetion methods based on device
information in the future.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15 14:04:22 +02:00
Christoph Hellwig f3a5d3f8a1 raw-posix: split hdev drivers
Instead of declaring one BlockDriver for all host devices declared one
for each type:  a generic one for normal disk devices, a Linux floppy
driver and a CDROM driver for Linux and FreeBSD.  This gets rid of a lot
of messy ifdefs and switching based on the type in the various removal
device methods.

block.c grows a new method to find the correct host device driver based
on OS-sepcific criteria, which will later into the actual drivers in a
later patch in this series.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15 13:55:19 +02:00
Christoph Hellwig 90babde0ca raw-posix: add a raw_open_common helper
raw_open and hdev_open contain the same basic logic.  Add a new
raw_open_common helper containing the guts of the open routine
and call it from raw_open and hdev_open.

We use the new open_flags field in BDRVRawState to allow passing
additional open flags to raw_open_common from both.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15 13:53:38 +02:00
Christoph Hellwig 0e1d8f4c54 raw-posix: always store open flags
Both the Linux floppy and the FreeBSD CDROM host device need to store
the open flags so that they can re-open the device later.  Store the
open flags unconditionally to remove the ifdef mess and simply the
calling conventions for the later patches in the series.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-06-15 13:53:26 +02:00
Andrea Arcangeli 986c28d655 fix qemu_aio_flush
qemu_aio_wait by invoking the bh or one of the aio completion
callbacks, could end up submitting new pending aio, breaking the
invariant that qemu_aio_flush returns only when no pending aio is
outstanding (possibly a problem for migration as such).

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Kevin Wolf <kwolf@redhat.com>
2009-06-15 13:52:27 +02:00
Gleb Natapov eeb7c03c0f Add rtc reset function.
On reset:
Periodic Interrupt Enable (PIE) bit is cleared to zero
Alarm Interrupt Enable (AIE) bit is cleared to zero
Update ended Interrupt Flag (UF) bit is cleared to zero
Interrupt Request status Flag (IRQF) bit is cleared to zero
Periodic Interrupt Flag (PF) bit is cleared to zero
Alarm Interrupt Flag (AF) bit is cleared to zero
Square Wave output Enable (SQWE) zero

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-14 21:50:09 -05:00
Uri Lublin e19252d32c migrate_fd_close: delete associated io-handler before closing the fd
It may happen that the io-handler is still registered. That causes
select() to return with EBADF, not calling handlers for other fds.

The io-handler would be registered when (on the source) the whole state
was written but not yet flushed. For example when using QEMUFileBuffered,
(tcp-migration) there may be data left in a buffer waiting to be transferred.
In such a case buffered_close() calls buffered_flush() which calls
migrate_fd_put_buffer, which may, upon EAGAIN, register migrate_fd_put_notify
as a handler.

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13 19:19:25 -05:00
Uri Lublin 8a67ec4d84 exec-migration: handle EINTR in popen_get_buffer()
Sometimes, upon interrupt, fread returns with no data, and
the (incoming exec) migration fails.

Fix by retrying on such a case.

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-13 19:19:25 -05:00