qemu
14 years agoRevived GUEST_BASE support for usermode emulation targets [v5] guest-base
Mika Westerberg [Sun, 29 Mar 2009 18:46:34 +0000 (21:46 +0300)]
Revived GUEST_BASE support for usermode emulation targets [v5]

- Now GUEST_BASE is dynamic and can be set from command line.
- Qemu checks /proc/sys/vm/mmap_min_addr and sets GUEST_BASE
  if needed.
- Code generation supports GUEST_BASE for i386 and x86_64 hosts.

[v3]: implemented GUEST_BASE with offset mods

Using malc's advice, instead of a mov or lea, just adjust
the offset parameter of tcg_out_modrm_offset(). - Riku

[v5]: set a GUEST_BASE_MAX instead of supporting moving
to arbitary ranges

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>

14 years agolinux-user: remove duplicate tswap32() from do_getsockopt()
Laurent Vivier [Mon, 1 Jun 2009 21:57:48 +0000 (23:57 +0200)]
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>

14 years agolinux-user/syscall.c: define _ATFILE_SOURCE
Eduardo Habkost [Tue, 9 Jun 2009 21:26:31 +0000 (18:26 -0300)]
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>

14 years agolinux-user: initialize mmap_mutex properly
Nathan Froyd [Thu, 4 Jun 2009 18:51:56 +0000 (11:51 -0700)]
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>

14 years agoRFC: fix fcntl support in linux-user - new try
Arnaud Patard (Rtp) [Wed, 3 Jun 2009 12:35:04 +0000 (14:35 +0200)]
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>

14 years agolinux-user: add tee, splice and vmsplice
vibisreenivasan [Sat, 16 May 2009 13:02:41 +0000 (18:32 +0530)]
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>

14 years agolinux-user: implement pipe2 [v3]
Riku Voipio [Tue, 5 May 2009 09:10:04 +0000 (12:10 +0300)]
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>

14 years agolinux-user: update syscall list
Riku Voipio [Mon, 4 May 2009 20:02:06 +0000 (23:02 +0300)]
linux-user: update syscall list

In preparation for supporting pipe2()

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>

14 years agoadd futex wake op
Riku Voipio [Thu, 28 May 2009 09:13:41 +0000 (12:13 +0300)]
add futex wake op

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>

14 years agolinux-user: support private futexes
Martin Mohring [Mon, 4 May 2009 18:34:56 +0000 (21:34 +0300)]
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>

14 years agolinux-user: include linux/fs.h
Martin Mohring [Mon, 4 May 2009 18:21:41 +0000 (21:21 +0300)]
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>

14 years agolinux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt
Lionel Landwerlin [Sat, 25 Apr 2009 21:31:18 +0000 (23:31 +0200)]
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>

14 years agolinux-user: Added IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP flags to setsockopt
Lionel Landwerlin [Sat, 25 Apr 2009 21:30:19 +0000 (23:30 +0200)]
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>

14 years agoReturn EOPNOTSUPP instead of ENOSYS for *xattr* syscalls
Arnaud Patard [Tue, 21 Apr 2009 18:04:18 +0000 (21:04 +0300)]
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>

14 years agoFix struct termios host - target translation
Arnaud Patard [Tue, 21 Apr 2009 14:39:08 +0000 (17:39 +0300)]
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>

14 years agolinux-user: fix utimensat
Riku Voipio [Tue, 21 Apr 2009 12:01:51 +0000 (15:01 +0300)]
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>

14 years agolinux-user: strace now handles guest strings correctly [v2]
Mika Westerberg [Tue, 7 Apr 2009 13:57:29 +0000 (16:57 +0300)]
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>

14 years agolinux-user: added x86 and x86_64 support for ELF coredump
Mika Westerberg [Tue, 7 Apr 2009 06:57:59 +0000 (09:57 +0300)]
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>

14 years agolinux-user: implemented ELF coredump support for ARM target
Mika Westerberg [Tue, 7 Apr 2009 06:57:11 +0000 (09:57 +0300)]
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>

14 years agoImplement shm* syscalls and fix 64/32bit errors
Riku Voipio [Fri, 3 Apr 2009 07:42:00 +0000 (10:42 +0300)]
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>

14 years agoexport mmap_find_vma for shmat
Riku Voipio [Tue, 21 Apr 2009 14:23:23 +0000 (17:23 +0300)]
export mmap_find_vma for shmat

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>

14 years agoIncorporate changes from v2 of Gleb's RTC reset patch
Anthony Liguori [Mon, 15 Jun 2009 19:33:24 +0000 (14:33 -0500)]
Incorporate changes from v2 of Gleb's RTC reset patch

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoetrax: Don't pass CPUState to peripherals.
Edgar E. Iglesias [Mon, 15 Jun 2009 19:00:50 +0000 (21:00 +0200)]
etrax: Don't pass CPUState to peripherals.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agoMerge commit 'block/master' into staging
Anthony Liguori [Mon, 15 Jun 2009 17:52:49 +0000 (12:52 -0500)]
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>

14 years agoFix warning in qemu-nbd.c
Anthony Liguori [Mon, 15 Jun 2009 17:49:59 +0000 (12:49 -0500)]
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>

14 years agoraw-posix: cleanup ioctl methods
Christoph Hellwig [Mon, 15 Jun 2009 12:04:34 +0000 (14:04 +0200)]
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>

14 years agoblock: add bdrv_probe_device method
Christoph Hellwig [Mon, 15 Jun 2009 12:04:22 +0000 (14:04 +0200)]
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>

14 years agoraw-posix: split hdev drivers
Christoph Hellwig [Mon, 15 Jun 2009 11:55:19 +0000 (13:55 +0200)]
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>

14 years agoraw-posix: add a raw_open_common helper
Christoph Hellwig [Mon, 15 Jun 2009 11:53:38 +0000 (13:53 +0200)]
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>

14 years agoraw-posix: always store open flags
Christoph Hellwig [Mon, 15 Jun 2009 11:53:26 +0000 (13:53 +0200)]
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>

14 years agofix qemu_aio_flush
Andrea Arcangeli [Mon, 15 Jun 2009 11:52:27 +0000 (13:52 +0200)]
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>

14 years agoAdd rtc reset function.
Gleb Natapov [Mon, 8 Jun 2009 12:56:04 +0000 (15:56 +0300)]
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>

14 years agomigrate_fd_close: delete associated io-handler before closing the fd
Uri Lublin [Mon, 8 Jun 2009 11:28:01 +0000 (14:28 +0300)]
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>

14 years agoexec-migration: handle EINTR in popen_get_buffer()
Uri Lublin [Mon, 8 Jun 2009 16:27:21 +0000 (19:27 +0300)]
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>

14 years agoFix prototype of function zfree.
Stefan Weil [Tue, 9 Jun 2009 21:36:03 +0000 (23:36 +0200)]
Fix prototype of function zfree.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoAdd static to local machine declaration.
Stefan Weil [Tue, 9 Jun 2009 21:34:41 +0000 (23:34 +0200)]
Add static to local machine declaration.

Variable akitapda_machine is only used locally,
so the static attribute avoids a compiler warning.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoDon't use cpu_index as apic_id.
Gleb Natapov [Wed, 10 Jun 2009 12:40:48 +0000 (15:40 +0300)]
Don't use cpu_index as apic_id.

(patch is on top of "Apic creation should not depend on pci" series)

Currently cpu_index is used as cpu apic id on x86.  This is incorrect
since apic ids not have to be continuous (they can also encode cpu
hierarchy information). This patch uses cpuid_apic_id for initial apic id
value. For now cpuid_apic_id is set to be equal to cpu_index so behaviour
is fully backward compatible, but it allows us to add qemu option to
provide other values for cpu apic id.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoApic creation should not depend on pci
Gleb Natapov [Mon, 8 Jun 2009 12:59:46 +0000 (15:59 +0300)]
Apic creation should not depend on pci

It should depend on whether cpu has APIC.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoAdd -no-virtio-balloon command-line option
Eduardo Habkost [Wed, 10 Jun 2009 19:34:08 +0000 (16:34 -0300)]
Add -no-virtio-balloon command-line option

This new option may be used to disable the virtio-balloon device.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFix SDL include path.
Stefan Weil [Sat, 13 Jun 2009 11:19:11 +0000 (13:19 +0200)]
Fix SDL include path.

SDL header files can be included in two different ways:

* like this: #include <SDL/SDL.h>
* like this: #include <SDL.h>

The 1st alternative is simple and works in many cases.

The 2nd alternative needs sdl-config to get the
correct compiler flags. It is the recommended way
to write SDL includes and standard for QEMU.

The patch fixes two non-standard SDL includes.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoReally enable -Werror
Blue Swirl [Sat, 13 Jun 2009 15:37:55 +0000 (15:37 +0000)]
Really enable -Werror

487fefdb.. did not actually enable -Werror despite the claims made by
configure output.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoAvoid collision with system NGROUPS definition
Blue Swirl [Sat, 13 Jun 2009 15:10:28 +0000 (15:10 +0000)]
Avoid collision with system NGROUPS definition

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoFix a warning: uint_fast8_t is not 8 bits on OpenBSD/Sparc64
Blue Swirl [Sat, 13 Jun 2009 15:09:38 +0000 (15:09 +0000)]
Fix a warning: uint_fast8_t is not 8 bits on OpenBSD/Sparc64

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoAvoid a gcc 3 format warning
Blue Swirl [Sat, 13 Jun 2009 15:08:49 +0000 (15:08 +0000)]
Avoid a gcc 3 format warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoAvoid gcc 4.4 warning about uninitialized field
Blue Swirl [Sat, 13 Jun 2009 13:20:25 +0000 (13:20 +0000)]
Avoid gcc 4.4 warning about uninitialized field

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoFix signedness problems
Blue Swirl [Sat, 13 Jun 2009 13:19:25 +0000 (13:19 +0000)]
Fix signedness problems

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoxen nic: check tx queue after connect.
Gerd Hoffmann [Thu, 11 Jun 2009 09:32:51 +0000 (11:32 +0200)]
xen nic: check tx queue after connect.

Needed for savevm/loadvm + migration: In that case the queue might
already have packets on (re-)connect.  The guest wouldn't notify us
because notifications are only sent when stuffing a packet into an
empty queue.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoinclude inttypes.h in xen.h
Gerd Hoffmann [Thu, 11 Jun 2009 09:32:50 +0000 (11:32 +0200)]
include inttypes.h in xen.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoxen: adapt to qemu_machine changes
Gerd Hoffmann [Thu, 11 Jun 2009 09:32:49 +0000 (11:32 +0200)]
xen: adapt to qemu_machine changes

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoxen_disk: move sanity check to the correct place
Gerd Hoffmann [Thu, 11 Jun 2009 09:32:48 +0000 (11:32 +0200)]
xen_disk: move sanity check to the correct place

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoWin32: Don't remove const attribute in type casts.
Stefan Weil [Sat, 13 Jun 2009 11:05:27 +0000 (13:05 +0200)]
Win32: Don't remove const attribute in type casts.

Type casts removing the const attribute are bad because
they hide the fact that the argument remains const.

They also result in a compiler warning (at least with MS-C).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>

14 years agoFix mingw32 build warnings
Blue Swirl [Sat, 13 Jun 2009 08:44:31 +0000 (08:44 +0000)]
Fix mingw32 build warnings

Work around buffer and ioctlsocket argument type signedness problems
Suppress a prototype which is unused on mingw32
Expand a macro to avoid warnings from some GCC versions

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoEnable -Werror by default for git builds on Linux hosts
Anthony Liguori [Thu, 11 Jun 2009 18:28:25 +0000 (13:28 -0500)]
Enable -Werror by default for git builds on Linux hosts

Additional hosts can be added to the white list as they are confirmed to build
with --enable-werror.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoCRIS: Prettify sizes for the internal disasm.
Edgar E. Iglesias [Fri, 12 Jun 2009 13:55:36 +0000 (15:55 +0200)]
CRIS: Prettify sizes for the internal disasm.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agoETRAX: DMA fixes for 64bit hosts.
Edgar E. Iglesias [Fri, 12 Jun 2009 13:41:25 +0000 (15:41 +0200)]
ETRAX: DMA fixes for 64bit hosts.

Mainly to remove warnings.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agoETRAX: Correct PIC creation for the bare FS board.
Edgar E. Iglesias [Thu, 11 Jun 2009 13:11:48 +0000 (15:11 +0200)]
ETRAX: Correct PIC creation for the bare FS board.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agoqdev: move name+size into DeviceInfo (v2)
Gerd Hoffmann [Wed, 10 Jun 2009 07:41:42 +0000 (09:41 +0200)]
qdev: move name+size into DeviceInfo (v2)

Rationale: move device information from code to data structures.

v2: Adapt the drivers missed in the first version.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoFix stellaris ethernet
Paul Brook [Thu, 11 Jun 2009 12:22:27 +0000 (13:22 +0100)]
Fix stellaris ethernet

Revert bogus part of e3f5ec2b
(pass VLANClientState* as first arg to receive handlers)

Signed-off-by: Paul Brook <paul@codesourcery.com>

14 years agoFix xilinx_ethlite breakage by 4f1c942b7f
Jan Kiszka [Thu, 11 Jun 2009 09:42:26 +0000 (11:42 +0200)]
Fix xilinx_ethlite breakage by 4f1c942b7f

Namely the new xilinx_ethlite used by mircoblaze.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

14 years agoFix build breakage when using VDE introduced by 4f1c942
Anthony Liguori [Thu, 11 Jun 2009 01:24:44 +0000 (20:24 -0500)]
Fix build breakage when using VDE introduced by 4f1c942

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoMerge branch 'net-queue'
Anthony Liguori [Wed, 10 Jun 2009 23:05:55 +0000 (18:05 -0500)]
Merge branch 'net-queue'

* net-queue: (28 commits)
  virtio-net: Increase filter and control limits
  virtio-net: Add new RX filter controls
  virtio-net: MAC filter optimization
  virtio-net: Fix MAC filter overflow handling
  virtio-net: reorganize receive_filter()
  virtio-net: Use a byte to store RX mode flags
  virtio-net: Add version_id 7 placeholder for vnet header support
  virtio-net: implement rx packet queueing
  net: make use of async packet sending API in tap client
  net: add qemu_send_packet_async()
  net: split out packet queueing and flushing into separate functions
  net: return status from qemu_deliver_packet()
  net: add return value to packet receive handler
  net: pass VLANClientState* as first arg to receive handlers
  net: re-name vc->fd_read() to vc->receive()
  net: add fd_readv() handler to qemu_new_vlan_client() args
  net: only read from tapfd when we can send
  net: vlan clients with no fd_can_read() can always receive
  net: move the tap buffer into TAPState
  net: factor tap_read_packet() out of tap_send()
  ...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFix "defined but not used" warning
Luiz Capitulino [Tue, 9 Jun 2009 21:24:57 +0000 (18:24 -0300)]
Fix "defined but not used" warning

The function qemu_calculate_timeout() is only used when CONFIG_IOTHREAD
is not defined. When CONFIG_IOTHREAD is defined, we have the following
warning:

vl.c:4389: warning: ‘qemu_calculate_timeout’ defined but not used

This change fixes that by moving the #ifdef/#endif from main_loop()
into qemu_calculate_timeout(). This encapsulates the logic and allow
us to use qemu_calculate_timeout() when CONFIG_IOTHREAD is defined
or not (suggested by Glauber Costa).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

14 years agomonitor: Introduce get_command_name()
Luiz Capitulino [Tue, 9 Jun 2009 21:21:30 +0000 (18:21 -0300)]
monitor: Introduce get_command_name()

Move code to extract command name into a function of its own, this
clearifies the code and let us remove two variables from
monitor_handle_command().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

14 years agomonitor: Remove unused variable
Luiz Capitulino [Tue, 9 Jun 2009 21:20:49 +0000 (18:20 -0300)]
monitor: Remove unused variable

The local pointer 'q' is not used by monitor_handle_command().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

14 years agomonitor: Remove uneeded 'return' statement
Luiz Capitulino [Tue, 9 Jun 2009 21:22:20 +0000 (18:22 -0300)]
monitor: Remove uneeded 'return' statement

The 'return' statement at the of monitor_handle_command() is not
needed and can be removed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

14 years agomonitor: Remove uneeded goto
Luiz Capitulino [Tue, 9 Jun 2009 21:21:54 +0000 (18:21 -0300)]
monitor: Remove uneeded goto

The 'found' goto in monitor_handle_command() can be dropped if we check
for 'cmd->name' after looking up for the command to execute.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

14 years agoUse snprintf to avoid OpenBSD warning
Blue Swirl [Tue, 9 Jun 2009 19:12:21 +0000 (19:12 +0000)]
Use snprintf to avoid OpenBSD warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoFix Sparse warning
Blue Swirl [Tue, 9 Jun 2009 18:50:02 +0000 (21:50 +0300)]
Fix Sparse warning

Fix this warning:
./qemu-options.h:198:1: error: expected preprocessor identifier

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoClean up generated qemu-img-cmds.h
Blue Swirl [Tue, 9 Jun 2009 18:45:16 +0000 (18:45 +0000)]
Clean up generated qemu-img-cmds.h

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoFix Sparse warning
Blue Swirl [Tue, 9 Jun 2009 18:38:51 +0000 (18:38 +0000)]
Fix Sparse warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agomicroblaze-dis.c does not need to be executable
Blue Swirl [Tue, 9 Jun 2009 18:27:02 +0000 (18:27 +0000)]
microblaze-dis.c does not need to be executable

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoFix warning
Blue Swirl [Tue, 9 Jun 2009 17:51:21 +0000 (20:51 +0300)]
Fix warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoRemove unused and misnamed field and variable
Blue Swirl [Tue, 9 Jun 2009 17:16:53 +0000 (17:16 +0000)]
Remove unused and misnamed field and variable

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoUpdate irqs on reset and device load
Blue Swirl [Tue, 9 Jun 2009 17:11:48 +0000 (17:11 +0000)]
Update irqs on reset and device load

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agoRegister reset functions for e1000 and rtl8139
Blue Swirl [Tue, 9 Jun 2009 15:02:00 +0000 (15:02 +0000)]
Register reset functions for e1000 and rtl8139

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

14 years agovirtio-net: Increase filter and control limits
Alex Williamson [Fri, 5 Jun 2009 20:47:23 +0000 (14:47 -0600)]
virtio-net: Increase filter and control limits

Increase the size of the perfect filter table and control queue depth.
This should give us more headroom in the MAC filter and is known to be
needed by at least one guest user.  Increasing the control queue depth
allows a guest to feed several commands back to back if they so desire
rather than using the send and wait approach Linux uses.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: Add new RX filter controls
Alex Williamson [Fri, 5 Jun 2009 20:47:18 +0000 (14:47 -0600)]
virtio-net: Add new RX filter controls

Add a few new RX modes to better control the receive_filter.  These
are all fairly obvious features that hardware could provide.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: MAC filter optimization
Alex Williamson [Fri, 5 Jun 2009 20:47:13 +0000 (14:47 -0600)]
virtio-net: MAC filter optimization

The MAC filter table is received from the guest as two separate
buffers, one with unicast entries, the other with multicast
entries.  If we track the index dividing the two sets, we can
avoid searching the part of the table with the wrong type of
entries.

We could store this index as part of the save image, but its
trivially easy to discover it on load.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: Fix MAC filter overflow handling
Alex Williamson [Fri, 5 Jun 2009 20:47:08 +0000 (14:47 -0600)]
virtio-net: Fix MAC filter overflow handling

Overloading the promisc and allmulti flags for indicating filter
table overflow makes it difficult to track the actual requested
operating mode.  Split these out into separate flags.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: reorganize receive_filter()
Alex Williamson [Fri, 5 Jun 2009 20:47:02 +0000 (14:47 -0600)]
virtio-net: reorganize receive_filter()

Reorganize receive_filter to better handle the split between
unicast and multicast filtering.  This allows us to skip the
broadcast check on unicast packets and leads to more opportunities
for optimization.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: Use a byte to store RX mode flags
Alex Williamson [Fri, 5 Jun 2009 20:46:57 +0000 (14:46 -0600)]
virtio-net: Use a byte to store RX mode flags

There's no need to save 4 bytes for promisc and allmulti.
Use one byte each just to avoid the overhead of a bitmap.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: Add version_id 7 placeholder for vnet header support
Alex Williamson [Fri, 5 Jun 2009 20:46:52 +0000 (14:46 -0600)]
virtio-net: Add version_id 7 placeholder for vnet header support

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agovirtio-net: implement rx packet queueing
Mark McLoughlin [Wed, 29 Apr 2009 12:40:02 +0000 (13:40 +0100)]
virtio-net: implement rx packet queueing

If we don't have room to receive a packet, we return zero
from virtio_net_receive() and call qemu_flush_queued_packets()
as soon as space becomes available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: make use of async packet sending API in tap client
Mark McLoughlin [Wed, 29 Apr 2009 12:30:24 +0000 (13:30 +0100)]
net: make use of async packet sending API in tap client

If a packet is queued by qemu_send_packet(), remove I/O
handler for the tap fd until we get notification that the
packet has been sent.

A not insignificant side effect of this is we can now
drain the tap send queue in one go without fear of packets
being dropped.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: add qemu_send_packet_async()
Mark McLoughlin [Wed, 29 Apr 2009 11:15:26 +0000 (12:15 +0100)]
net: add qemu_send_packet_async()

Add a qemu_send_packet() variant which will queue up the packet
if it cannot be sent when all client queues are full. It later
invokes the supplied callback when the packet has been sent.

If qemu_send_packet_async() returns zero, the caller is expected
to not send any more packets until the queued packet has been
sent.

Packets are queued iff a receive() handler returns zero (indicating
queue full) and the caller has provided a sent notification callback
(indicating it will stop and start its own queue).

We need the packet sending API to support queueing because:

  - a sending client should process all available packets in one go
    (e.g. virtio-net emptying its tx ring)

  - a receiving client may not be able to handle the packet
    (e.g. -EAGAIN from write() to tapfd)

  - the sending client could detect this condition in advance
    (e.g. by select() for writable on tapfd)

  - that's too much overhead (e.g. a select() call per packet)

  - therefore the sending client must handle the condition by
    dropping the packet or queueing it

  - dropping packets is poor form; we should queue.

However, we don't want queueing to be completely transparent. We
want the sending client to stop sending packets as soon as a
packet is queued. This allows the sending client to be throttled
by the receiver.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: split out packet queueing and flushing into separate functions
Mark McLoughlin [Wed, 29 Apr 2009 10:48:12 +0000 (11:48 +0100)]
net: split out packet queueing and flushing into separate functions

We'll be doing more packet queueing in later commits.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: return status from qemu_deliver_packet()
Mark McLoughlin [Wed, 29 Apr 2009 10:34:52 +0000 (11:34 +0100)]
net: return status from qemu_deliver_packet()

Will allow qemu_send_packet() handle queue full condition.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: add return value to packet receive handler
Mark McLoughlin [Mon, 18 May 2009 12:40:55 +0000 (13:40 +0100)]
net: add return value to packet receive handler

This allows us to handle queue full conditions rather than dropping
the packet on the floor.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: pass VLANClientState* as first arg to receive handlers
Mark McLoughlin [Mon, 18 May 2009 12:33:03 +0000 (13:33 +0100)]
net: pass VLANClientState* as first arg to receive handlers

Give static type checking a chance to catch errors.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: re-name vc->fd_read() to vc->receive()
Mark McLoughlin [Mon, 18 May 2009 12:13:16 +0000 (13:13 +0100)]
net: re-name vc->fd_read() to vc->receive()

VLANClientState's fd_read() handler doesn't read from file
descriptors, it adds a buffer to the client's receive queue.

Re-name the handlers to make things a little less confusing.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: add fd_readv() handler to qemu_new_vlan_client() args
Mark McLoughlin [Mon, 18 May 2009 11:55:27 +0000 (12:55 +0100)]
net: add fd_readv() handler to qemu_new_vlan_client() args

This, apparently, is the style we prefer - all VLANClientState
should be an argument to qemu_new_vlan_client().

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: only read from tapfd when we can send
Mark McLoughlin [Wed, 29 Apr 2009 08:50:32 +0000 (09:50 +0100)]
net: only read from tapfd when we can send

Reduce the number of packets dropped under heavy network
traffic by only reading a packet from the tapfd when a
client can actually handle it.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: vlan clients with no fd_can_read() can always receive
Mark McLoughlin [Wed, 29 Apr 2009 08:36:43 +0000 (09:36 +0100)]
net: vlan clients with no fd_can_read() can always receive

If a vlan client has no fd_can_read(), that means it can
always receive packets. The current code assumes it can *never*
receive packets.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: move the tap buffer into TAPState
Mark McLoughlin [Mon, 18 May 2009 11:05:44 +0000 (12:05 +0100)]
net: move the tap buffer into TAPState

KVM uses a 64k buffer for reading from tapfd (for GSO support)
and allocates the buffer with TAPState rather than on the stack.

Not allocating it on the stack probably makes sense for qemu
anyway, so merge it in advance of GSO support.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: factor tap_read_packet() out of tap_send()
Mark McLoughlin [Wed, 29 Apr 2009 08:43:37 +0000 (09:43 +0100)]
net: factor tap_read_packet() out of tap_send()

Move portability clutter out into its own function.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agoslirp: Reorder initialization
Jan Kiszka [Fri, 8 May 2009 10:34:18 +0000 (12:34 +0200)]
slirp: Reorder initialization

This patch reorders the initialization of slirp itself as well as its
associated features smb and redirection. So far the first reference to
slirp triggered the initialization, independent of the actual -net user
option which may carry additional parameters. Now we save any request to
add a smb export or some redirections until the actual initialization of
the stack. This also allows to move a few parameters that were passed
via global variable into the argument list of net_slirp_init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: Improve parameter error reporting
Jan Kiszka [Fri, 8 May 2009 10:34:18 +0000 (12:34 +0200)]
net: Improve parameter error reporting

As host network devices can also be instantiated via the monitor, errors
should then be reported to the related monitor instead of stderr. This
requires larger refactoring, so this patch starts small with introducing
a helper to catch both cases and convert net_client_init as well as
net_slirp_redir.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: fix error reporting for some net parameter checks
Mark McLoughlin [Thu, 28 May 2009 15:39:54 +0000 (16:39 +0100)]
net: fix error reporting for some net parameter checks

A small bit of confusion between buffers is causing errors like:

  qemu: invalid parameter '10' in 'script=/etc/qemu-ifup,fd=10'

instead of:

  qemu: invalid parameter 'script' in 'script=/etc/qemu-ifup,fd=10'

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agonet: Real fix for check_params users
Jan Kiszka [Fri, 8 May 2009 10:34:17 +0000 (12:34 +0200)]
net: Real fix for check_params users

OK, last try: 8e4416af45 broke -net socket, ffad4116b9 tried to fix it
but broke error reporting of invalid parameters. So this patch widely
reverts ffad4116b9 again and intead fixes those callers of check_params
that originally suffered from overwritten buffers by using separate
ones.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>

14 years agoRevert "Fix output of uninitialized strings"
Mark McLoughlin [Thu, 28 May 2009 13:07:31 +0000 (14:07 +0100)]
Revert "Fix output of uninitialized strings"

This reverts commit 8cf07dcbe7691dbe4f47563058659dba6ef66b05.

This is a sorry saga.

This commit:

  8e4416af45 net: Add parameter checks for VLAN clients

broken '-net socket' and this commit:

  ffad4116b9 net: Fix -net socket parameter checks

fixed the problem but introduced another problem which
this commit:

  8cf07dcbe7 Fix output of uninitialized strings

fixed that final problem, but causing us to lose some
error reporting information in the process.

Meanwhile Jan posted a patch to mostly re-do ffad4116b9
in a way that fixes the original issue, but without
losing the error reporting information. So, let's revert
8cf07dcbe7 and apply Jan's patch.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>