]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Mon, 27 Jun 2011 16:26:47 +0000 (11:26 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 27 Jun 2011 16:25:23 +0000 (11:25 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agovnc: Fix compilation with --enable-vnc-png
Stefan Weil [Sun, 26 Jun 2011 19:29:13 +0000 (19:29 +0000)]
vnc: Fix compilation with --enable-vnc-png

Commit f26e428da505709ec03b2ed2c9eb3db82b30bd7b fixed compilation
with --enable-vnc-png, but broke it with --enable-vnc-png.

The breakage is caused by pngconfig.h which checks whether
setjmp.h was already included and fails because qemu-common.h
includes setjmp.h.

The check is disabled by defining PNG_SKIP_SETJMP_CHECK.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoFix MinGW compilation when --enable-vnc-jpeg is specified
Roy Tam [Sat, 18 Jun 2011 05:13:39 +0000 (13:13 +0800)]
Fix MinGW compilation when --enable-vnc-jpeg is specified

Fix conflicting types for 'INT32' in basetsd.h and jmorecfg.h by
including qemu-common.h first.

Signed-off-by: Roy Tam <roytam@gmail.com>
Acked-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG/Sparc64: use stack for TCG temps
Blue Swirl [Sat, 14 May 2011 17:06:56 +0000 (17:06 +0000)]
TCG/Sparc64: use stack for TCG temps

Use stack instead of temp_buf array in CPUState for TCG temps.

On Sparc64, stack pointer is not aligned but there is a fixed bias of 2047,
so don't try to enforce alignment.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG/x86: use stack for TCG temps
Blue Swirl [Sat, 14 May 2011 13:14:45 +0000 (13:14 +0000)]
TCG/x86: use stack for TCG temps

Use stack instead of temp_buf array in CPUState for TCG
temps.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG/x86: use TCG_REG_CALL_STACK instead of TCG_REG_ESP
Blue Swirl [Sat, 28 May 2011 06:51:52 +0000 (06:51 +0000)]
TCG/x86: use TCG_REG_CALL_STACK instead of TCG_REG_ESP

Except for specific cases where the use of %esp changes the encoding of
the instruction, it's cleaner to use TCG_REG_CALL_STACK instead of
TCG_REG_ESP.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: remove broken stack allocation for call arguments
Blue Swirl [Sat, 28 May 2011 07:13:05 +0000 (07:13 +0000)]
TCG: remove broken stack allocation for call arguments

The code for stack allocation for call arguments is way too simplistic
to actually work on targets with non-trivial stack allocation policies,
e.g. ppc64. We've also already allocated TCG_STATIC_CALL_ARGS_SIZE worth
of stack for calls which should be well more than any helper needs.

Remove broken dynamic stack allocation code and replace it with an assert.
Should dynamic stack allocation ever be needed again, target specific
functions should be added.

Thanks to Richard Henderson for the analysis.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: fix negative frame offset calculations
Blue Swirl [Sat, 14 May 2011 14:03:22 +0000 (14:03 +0000)]
TCG: fix negative frame offset calculations

size_t is unsigned, so the frame offset calculations can be incorrect for
negative offsets.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoDelegate setup of TCG temporaries to targets
Blue Swirl [Sat, 14 May 2011 12:58:04 +0000 (12:58 +0000)]
Delegate setup of TCG temporaries to targets

Delegate TCG temp_buf setup to targets, so that they can use a stack
frame later instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocpu-exec.c: avoid AREG0 use
Blue Swirl [Sun, 15 May 2011 16:03:25 +0000 (16:03 +0000)]
cpu-exec.c: avoid AREG0 use

Make functions take a parameter for CPUState instead of relying
on global env. Pass CPUState pointer to TCG prologue, which moves
it to AREG0.

Thanks to Peter Maydell and Laurent Desnogues for the ARM prologue
change.

Revert the hacks to avoid AREG0 use on Sparc hosts.

Move cpu_has_work() and cpu_pc_from_tb() from exec.h to cpu.h.

Compile the file without HELPER_CFLAGS.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoRemove exec-all.h include directives
Blue Swirl [Sun, 19 Jun 2011 20:38:22 +0000 (20:38 +0000)]
Remove exec-all.h include directives

Most exec-all.h include directives are now useless, remove them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMove cpu_has_work and cpu_pc_from_tb to cpu.h
Blue Swirl [Sat, 21 May 2011 07:10:23 +0000 (07:10 +0000)]
Move cpu_has_work and cpu_pc_from_tb to cpu.h

Move functions cpu_has_work() and cpu_pc_from_tb() from exec.h to cpu.h. This is
needed by later patches.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec.h: fix coding style and change cpu_has_work to return bool
Blue Swirl [Sat, 21 May 2011 12:16:05 +0000 (12:16 +0000)]
exec.h: fix coding style and change cpu_has_work to return bool

Before the next patch, fix coding style of the areas affected.

Change the type of the return value from cpu_has_work() and
qemu_cpu_has_work() to bool.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocpu-exec: unify do_interrupt call
Blue Swirl [Sat, 21 May 2011 08:17:08 +0000 (08:17 +0000)]
cpu-exec: unify do_interrupt call

Now that all targets use common function signature for do_interrupt(), there is no
need for the #ifdeffery anymore.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agom68k: use caller supplied CPUState for interrupt related stuff
Blue Swirl [Sat, 21 May 2011 07:55:24 +0000 (07:55 +0000)]
m68k: use caller supplied CPUState for interrupt related stuff

Pass CPUState to do_interrupt(). This is needed by later patches.

It would be cleaner to move the function to helper.c, but there are
a few dependencies between do_interrupt() and other functions.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: use caller supplied CPUState for interrupt related stuff
Blue Swirl [Mon, 16 May 2011 19:38:48 +0000 (19:38 +0000)]
x86: use caller supplied CPUState for interrupt related stuff

Several x86 specific functions are called from cpu-exec.c with the
assumption that global env register is valid. This will be changed
later, so make the functions use caller supplied CPUState parameter.

It would be cleaner to move the functions to helper.c, but there are
quite a lot of dependencies between do_interrupt() and other functions.

Add helpers for svm_check_intercept() and cpu_cc_compute_all() instead
of calling the helper (which uses global env, AREG0) directly.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosparc: move do_interrupt to helper.c
Blue Swirl [Sun, 15 May 2011 16:11:04 +0000 (16:11 +0000)]
sparc: move do_interrupt to helper.c

do_interrupt() was mixing CPUState pointer passed from caller
and global env (AREG0).

Fix by moving the function to helper.c. Introduce a helper for calling
change_pstate() safely from outside of execution context.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosparc: fix coding style of the area to be moved
Blue Swirl [Sat, 21 May 2011 11:41:50 +0000 (11:41 +0000)]
sparc: fix coding style of the area to be moved

Before the next patch, fix coding style of the areas affected.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocpu_loop_exit: avoid using AREG0
Blue Swirl [Sat, 14 May 2011 12:52:35 +0000 (12:52 +0000)]
cpu_loop_exit: avoid using AREG0

Make cpu_loop_exit() take a parameter for CPUState instead of relying
on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc32: dummy implementation of MXCC MMU breakpoint registers
Blue Swirl [Sat, 18 Jun 2011 20:27:05 +0000 (20:27 +0000)]
Sparc32: dummy implementation of MXCC MMU breakpoint registers

Add dummy registers for SuperSPARC MXCC MMU counter breakpoints, save
and load all MXCC registers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoFix fallouts from Linux header inclusion
Jan Kiszka [Thu, 23 Jun 2011 08:05:12 +0000 (10:05 +0200)]
Fix fallouts from Linux header inclusion

This is an all-in-one fix for the smaller and bigger mistakes of the
build system changes for accompanied Linux headers:
 - only enable KVM and vhost on Linux hosts
 - fix powerpc asm header symlink
 - do not use Linux headers on non-Linux hosts
 - fix kvmclock for !CONFIG_KVM
 - fix s390 build on non-Linux hosts

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Andreas Färber <andreas.faerber@web.de>
Tested-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqemu-kvm: fix pulseaudio detection in configure
Marc-Antoine Perennou [Fri, 29 Apr 2011 05:59:19 +0000 (05:59 +0000)]
qemu-kvm: fix pulseaudio detection in configure

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoexec: last_first_tb was only used in !ONLY_USER case
Juan Quintela [Thu, 2 Jun 2011 01:53:44 +0000 (01:53 +0000)]
exec: last_first_tb was only used in !ONLY_USER case

Once there, use a better variable name.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agow32: Remove redundant definitions of PRI*64
Stefan Weil [Fri, 24 Jun 2011 10:15:49 +0000 (12:15 +0200)]
w32: Remove redundant definitions of PRI*64

The PRI*64 macros are defined in MinGW's inttypes.h since 2002,
so they are not needed in qemu-common.h (which includes inttypes.h).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoDo not include compatfd for WIN32
Jan Kiszka [Thu, 23 Jun 2011 08:15:55 +0000 (10:15 +0200)]
Do not include compatfd for WIN32

sigset_t, used by that header, is not available in mingw32 environments.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoFix comment typos in hw/armv7m.c
Matthew Fernandez [Thu, 23 Jun 2011 00:59:26 +0000 (10:59 +1000)]
Fix comment typos in hw/armv7m.c

Fix a couple of typos in comments.

Signed-off-by: Matthew Fernandez <matthew.fernandez@gmail.com>
Acked-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMAINTAINERS: Fix typo in email address
Peter Maydell [Wed, 22 Jun 2011 14:45:01 +0000 (15:45 +0100)]
MAINTAINERS: Fix typo in email address

Fix a typo in one of the copies of Aurelien Jarno's email address.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoblockdev: Put space after comma in error message
Markus Armbruster [Wed, 22 Jun 2011 12:03:57 +0000 (14:03 +0200)]
blockdev: Put space after comma in error message

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoSpell "unkown" correctly in error_report() arguments
Markus Armbruster [Wed, 22 Jun 2011 12:03:56 +0000 (14:03 +0200)]
Spell "unkown" correctly in error_report() arguments

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqemu-img: Don't prepend qemu-img to error messages twice.
Markus Armbruster [Wed, 22 Jun 2011 12:03:55 +0000 (14:03 +0200)]
qemu-img: Don't prepend qemu-img to error messages twice.

error_report() prepends the location already.  Example:

$ qemu-img convert -6
qemu-img: qemu-img: option -6 is deprecated, please use '-o compat6' instead!

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoStrip trailing '\n' from error_report()'s first argument
Markus Armbruster [Wed, 22 Jun 2011 12:03:54 +0000 (14:03 +0200)]
Strip trailing '\n' from error_report()'s first argument

error_report() prepends location, and appends a newline.  The message
constructed from the arguments should not contain a newline.  Fix the
obvious offenders.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agosheepdog: qemu_bh_new() can't return null pointer, drop check
Markus Armbruster [Wed, 22 Jun 2011 12:03:53 +0000 (14:03 +0200)]
sheepdog: qemu_bh_new() can't return null pointer, drop check

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoAlign dummy display to fixed-size active console
Jan Kiszka [Sun, 19 Jun 2011 09:53:02 +0000 (11:53 +0200)]
Align dummy display to fixed-size active console

This fixes e.g. '-vga none -monitor vc:120Cx50C'.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Don't create symlinks to nonexistent targets
Peter Maydell [Fri, 3 Jun 2011 16:10:40 +0000 (17:10 +0100)]
configure: Don't create symlinks to nonexistent targets

When we create the symlinks to source tree files, don't create them
if the file is not actually present in the source tree; this will
happen if the file is in a git submodule that wasn't checked out.

This also avoids the odd effect where an in-source-tree configure
will end up creating the missing file as a symlink to itself.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocoreaudio: Fix OSStatus format specifier
Andreas Färber [Thu, 23 Jun 2011 14:24:45 +0000 (16:24 +0200)]
coreaudio: Fix OSStatus format specifier

OSStatus type is defined as SInt32. That's signed int on __LP64__ and
signed long otherwise.
Since it is an explicit 32-bit-width type, cast to corresponsing POSIX type
and use PRId32 format specifier. This avoids a warning on ppc64.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agocoreaudio: Avoid formatting UInt32 type
Andreas Färber [Thu, 23 Jun 2011 14:24:46 +0000 (16:24 +0200)]
coreaudio: Avoid formatting UInt32 type

coreaudioVoiceOut's audioDevicePropertyBufferFrameSize is defined as UInt32
and is being used by reference for AudioDevice{Get,Set}Property().
UInt32 is unsigned int on __LP64__ but unsigned long otherwise.

Cast to POSIX type and use PRIu32 format specifier to hide the details.
This avoids a warning on ppc64.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Signed-off-by: malc <av1474@comtv.ru>
12 years agonet: Warn about "-net nic" options which were ignored
Peter Maydell [Fri, 20 May 2011 15:50:01 +0000 (16:50 +0100)]
net: Warn about "-net nic" options which were ignored

Diagnose the case where the user asked for a NIC via "-net nic"
but the board didn't instantiate that NIC (for example where the
user asked for two NICs but the board only supports one). Note
that this diagnostic doesn't apply to NICs created through -device,
because those are always instantiated.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agonet: Don't warn about the default network setup
Peter Maydell [Fri, 20 May 2011 15:50:00 +0000 (16:50 +0100)]
net: Don't warn about the default network setup

Don't warn about the default network setup that you get if no command line
-net options are specified.  There are two cases that we would otherwise
complain about:

(1) board doesn't support a NIC but the implicit "-net nic" requested one
(2) CONFIG_SLIRP not set, so the implicit "-net nic" sets up a nic that
isn't connected to anything

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRevert "net: Improve the warnings for dubious command line option combinations"
Peter Maydell [Fri, 20 May 2011 15:49:59 +0000 (16:49 +0100)]
Revert "net: Improve the warnings for dubious command line option combinations"

This reverts commit f68b9d672b90dedc79aeb9b44607f484dbe46a6b.
That attempt at diagnosing unused -net nic options failed to account
for NICs created via -device; back it out cleanly in preparation
for implementing in a different manner.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoOptimize screendump
Avi Kivity [Mon, 20 Jun 2011 08:12:47 +0000 (11:12 +0300)]
Optimize screendump

When running kvm-autotest, fputc() is often the second highest (sometimes #1)
function showing up in a profile.  This is due to fputc() locking the file
for every byte written.

Optimize by buffering a line's worth of pixels and writing that out in a
single call.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'qmp/for-anthony' into staging
Anthony Liguori [Wed, 22 Jun 2011 12:14:00 +0000 (07:14 -0500)]
Merge remote-tracking branch 'qmp/for-anthony' into staging

12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Wed, 22 Jun 2011 12:13:10 +0000 (07:13 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

12 years agoMerge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Wed, 22 Jun 2011 12:11:09 +0000 (07:11 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging

Conflicts:
hw/usb-uhci.c

12 years agoMerge remote-tracking branch 'agraf/xen-next' into staging
Anthony Liguori [Wed, 22 Jun 2011 12:07:55 +0000 (07:07 -0500)]
Merge remote-tracking branch 'agraf/xen-next' into staging

12 years agolinux-user: Fix sync_file_range on 32bit mips
Riku Voipio [Mon, 20 Jun 2011 13:24:39 +0000 (16:24 +0300)]
linux-user: Fix sync_file_range on 32bit mips

As noticed while looking at "Bump do_syscall() up to 8 syscall arguments"
patch, sync_file_range uses a pad argument on 32bit mips. Deal with it
by reading the correct arguments when on mips.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user/signal.c: Remove unused fenab
Peter Maydell [Thu, 16 Jun 2011 16:37:15 +0000 (17:37 +0100)]
linux-user/signal.c: Remove unused fenab

Remove fenab as it is only written, never used. Add a FIXME
comment about the discrepancy between our behaviour and that
of the Linux kernel for this routine.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user/signal.c: Remove only-ever-set variable fpu_save_addr
Peter Maydell [Thu, 16 Jun 2011 16:37:14 +0000 (17:37 +0100)]
linux-user/signal.c: Remove only-ever-set variable fpu_save_addr

Move the access of fpu_save into the commented out skeleton code for
restoring FPU registers on SPARC sigreturn, thus silencing a gcc
4.6 "variable set but never used" warning.
(This doesn't affect the calculation of 'err' because in fact
__get_user() can never fail.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: Bump do_syscall() up to 8 syscall arguments
Peter Maydell [Thu, 16 Jun 2011 16:37:13 +0000 (17:37 +0100)]
linux-user: Bump do_syscall() up to 8 syscall arguments

On 32 bit MIPS a few syscalls have 7 arguments, and so to call
them via NR_syscall the guest needs to be able to pass 8 arguments
to do_syscall(). Raise the number of arguments do_syscall() takes
accordingly.

This fixes some gcc 4.6 compiler warnings about arg7 and arg8
variables being set and never used.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agoflatload: memp was a write-only variable
Juan Quintela [Thu, 16 Jun 2011 16:37:12 +0000 (17:37 +0100)]
flatload: memp was a write-only variable

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agoflatload: end_code was only used in a debug message
Juan Quintela [Thu, 16 Jun 2011 16:37:11 +0000 (17:37 +0100)]
flatload: end_code was only used in a debug message

Just unfold its definition in only use.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[peter.maydell@linaro.org: fixed typo in the debug code,
added parentheses to fix precedence issue]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: syscall should use sanitized arg1
Juan Quintela [Thu, 16 Jun 2011 16:37:10 +0000 (17:37 +0100)]
linux-user: syscall should use sanitized arg1

Looking at the other architectures, we should be using "how" not "arg1".

Signed-off-by: Juan Quintela <quintela@redhat.com>
[peter.maydell@linaro.org: remove unnecessary initialisation of how]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agosyscall: really return ret code
Juan Quintela [Thu, 16 Jun 2011 16:37:09 +0000 (17:37 +0100)]
syscall: really return ret code

We assign ret with the error code, but then return 0 unconditionally.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinuxload: id_change was a write only variable
Juan Quintela [Thu, 16 Jun 2011 16:37:08 +0000 (17:37 +0100)]
linuxload: id_change was a write only variable

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: Define AT_RANDOM to support target stack protection mechanism.
Laurent ALFONSI [Mon, 20 Jun 2011 06:43:13 +0000 (08:43 +0200)]
linux-user: Define AT_RANDOM to support target stack protection mechanism.

The dynamic linker from the GNU C library v2.10+ uses the ELF
auxiliary vector AT_RANDOM [1] as a pointer to 16 bytes with random
values to initialize the stack protection mechanism.  Technically the
emulated GNU dynamic linker crashes due to a NULL pointer
derefencement if it is built with stack protection enabled and if
AT_RANDOM is not defined by the QEMU ELF loader.

[1] This ELF auxiliary vector was introduced in Linux v2.6.29.

This patch can be tested with the code above:

    #include <elf.h>       /* Elf*_auxv_t, AT_RANDOM, */
    #include <stdio.h>     /* printf(3), */
    #include <stdlib.h>    /* exit(3), EXIT_*, */
    #include <stdint.h>    /* uint8_t, */
    #include <string.h>    /* memcpy(3), */

    #if defined(__LP64__) || defined(__ILP64__) || defined(__LLP64__)
    #    define Elf_auxv_t Elf64_auxv_t
    #else
    #    define Elf_auxv_t Elf32_auxv_t
    #endif

    main(int argc, char* argv[], char* envp[])
    {
        Elf_auxv_t *auxv;

        /* *envp = NULL marks end of envp. */
        while (*envp++ != NULL);

        /* auxv->a_type = AT_NULL marks the end of auxv. */
        for (auxv = (Elf_auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) {
            if (auxv->a_type == AT_RANDOM) {
                int i;
                uint8_t rand_bytes[16];

                printf("AT_RANDOM is: 0x%x\n", auxv->a_un.a_val);
                memcpy(rand_bytes, (const uint8_t *)auxv->a_un.a_val, sizeof(rand_bytes));
                printf("it points to: ");
                for (i = 0; i < 16; i++) {
                    printf("0x%02x ", rand_bytes[i]);
                }
                printf("\n");
                exit(EXIT_SUCCESS);
            }
        }
        exit(EXIT_FAILURE);
    }

Changes introduced in v2 and v3:

    * Fix typos + thinko (AT_RANDOM is used for stack canary, not for
      ASLR)

    * AT_RANDOM points to 16 random bytes stored inside the user
      stack.

    * Add a small test program.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Signed-off-by: Laurent ALFONSI <laurent.alfonsi@st.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: add pselect6 syscall support
Mike Frysinger [Fri, 3 Jun 2011 21:01:49 +0000 (17:01 -0400)]
linux-user: add pselect6 syscall support

Some architectures (like Blackfin) only implement pselect6 (and skip
select/newselect).  So add support for it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: Fix the computation of the requested heap size
vincent [Tue, 14 Jun 2011 21:56:33 +0000 (21:56 +0000)]
linux-user: Fix the computation of the requested heap size

There were several remaining bugs in the previous implementation of
do_brk():

    1. the value of "new_alloc_size" was one page too large when the
       requested brk was aligned on a host page boundary.

    2. no new pages should be (re-)allocated when the requested brk is
       in the range of the pages that were already allocated
       previsouly (for the same purpose).  Technically these pages are
       never unmapped in the current implementation.

The problem/fix can be reproduced/validated with the test-suite above:

    #include <unistd.h>       /* syscall(2),      */
    #include <sys/syscall.h>  /* SYS_brk,         */
    #include <stdio.h>        /* puts(3),         */
    #include <stdlib.h>       /* exit(3), EXIT_*, */
    #include <stdint.h>       /* uint*_t,         */
    #include <sys/mman.h>     /* mmap(2), MAP_*,  */
    #include <string.h>       /* memset(3), */

    int main()
    {
        int exit_status = EXIT_SUCCESS;
        uint8_t *current_brk = 0;
        uint8_t *initial_brk;
        uint8_t *new_brk;
        uint8_t *old_brk;
        int failure = 0;
        int i;

        void test_brk(int increment, int expected_result) {
            new_brk = (uint8_t *)syscall(SYS_brk, current_brk + increment);
            if ((new_brk == current_brk) == expected_result)
                failure = 1;
            current_brk = (uint8_t *)syscall(SYS_brk, 0);
        }

        void test_result() {
            if (!failure)
                puts("OK");
            else {
                puts("failure");
                exit_status = EXIT_FAILURE;
            }
        }

        void test_title(const char *title) {
            failure = 0;
            printf("%-45s : ", title);
            fflush(stdout);
        }

        test_title("Initialization");
        test_brk(0, 1);
        initial_brk = current_brk;
        test_result();

        test_title("Don't overlap \"brk\" pages");
        test_brk(HOST_PAGE_SIZE, 1);
        test_brk(HOST_PAGE_SIZE, 1);
        test_result();

        /* Preparation for the test "Re-allocated heap is initialized".  */
        old_brk = current_brk - HOST_PAGE_SIZE;
        memset(old_brk, 0xFF, HOST_PAGE_SIZE);

        test_title("Don't allocate the same \"brk\" page twice");
        test_brk(-HOST_PAGE_SIZE, 1);
        test_brk(HOST_PAGE_SIZE, 1);
        test_result();

        test_title("Re-allocated \"brk\" pages are initialized");
        for (i = 0; i < HOST_PAGE_SIZE; i++) {
            if (old_brk[i] != 0) {
                printf("(index = %d, value = 0x%x) ", i, old_brk[i]);
                failure = 1;
                break;
            }
        }
        test_result();

        test_title("Don't allocate \"brk\" pages over \"mmap\" pages");
        new_brk = mmap(current_brk, HOST_PAGE_SIZE / 2, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
        if (new_brk == (void *) -1)
            puts("unknown");
        else {
            test_brk(HOST_PAGE_SIZE, 0);
            test_result();
        }

        test_title("All \"brk\" pages are writable (please wait)");
        if (munmap(current_brk, HOST_PAGE_SIZE / 2) != 0)
            puts("unknown");
        else {
            while (current_brk - initial_brk < 2*1024*1024*1024UL) {
                old_brk = current_brk;

                test_brk(HOST_PAGE_SIZE, -1);
                if (old_brk == current_brk)
                    break;

                for (i = 0; i < HOST_PAGE_SIZE; i++)
                    old_brk[i] = 0xAA;
            }
            puts("OK");
        }

        test_title("Maximum size of the heap > 16MB");
        failure = (current_brk - initial_brk) < 16*1024*1024;
        test_result();

        exit(exit_status);
    }

Changes introduced in patch v2:

    * extend the "brk" test-suite embedded within the commit message;

    * heap contents have to be initialized to zero, this bug was
      exposed by "tst-calloc.c" from the GNU C library;

    * don't [try to] allocate a new host page if the new "brk" is
      equal to the latest allocated host page ("brk_page"); and

    * print some debug information when DEBUGF_BRK is defined.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Reviewed-by: Christophe Guillon <christophe.guillon@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agom68k-semi.c: Use correct check for failure of do_brk()
Peter Maydell [Mon, 18 Apr 2011 15:34:26 +0000 (16:34 +0100)]
m68k-semi.c: Use correct check for failure of do_brk()

In the m68k semihosting implementation of HOSTED_INIT_SIM, use the correct
check for whether do_brk() has failed -- it does not return -1 but the
previous value of the break limit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agoarm-semi.c: Use correct check for failure of do_brk()
Peter Maydell [Mon, 18 Apr 2011 15:34:25 +0000 (16:34 +0100)]
arm-semi.c: Use correct check for failure of do_brk()

In the ARM semihosting implementation of SYS_HEAPINFO, use the correct
check for whether do_brk() has failed -- it does not return -1 but the
previous value of the break limit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: Don't use MAP_FIXED in do_brk()
Peter Maydell [Mon, 18 Apr 2011 15:34:24 +0000 (16:34 +0100)]
linux-user: Don't use MAP_FIXED in do_brk()

Since mmap() with MAP_FIXED will map over the top of existing mappings,
it's a bad idea to use it to implement brk(), because brk() with a
large size is likely to overwrite important things like qemu itself
or the host libc. So we drop MAP_FIXED and handle "mapped but at
different address" as an error case instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: Handle images where lowest vaddr is not page aligned
Peter Maydell [Tue, 17 May 2011 12:34:46 +0000 (13:34 +0100)]
linux-user: Handle images where lowest vaddr is not page aligned

Fix a bug in the linux-user ELF loader code where it was not correctly
handling images where the lowest vaddr to be loaded was not page aligned.
The problem was that the code to probe for a suitable guest base address
was changing the 'loaddr' variable (by rounding it to a page boundary),
which meant that the load bias would then be incorrectly calculated
unless loaddr happened to already be page-aligned.

Binaries generated by gcc with the default linker script do start with
a loadable segment at a page-aligned vaddr, so were unaffected. This
bug was noticed with a binary created by the Google Go toolchain for ARM.

We fix the bug by refactoring the "probe for guest base" code out into
its own self-contained function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agolinux-user: Fix the load of ELF files that have no "useful" symbol
Cédric VINCENT [Wed, 1 Jun 2011 12:36:38 +0000 (14:36 +0200)]
linux-user: Fix the load of ELF files that have no "useful" symbol

This patch fixes a "double free()" due to "realloc(syms, 0)" in the
loader when the ELF file has no "useful" symbol, as with the following
example (compiled with "sh4-linux-gcc -nostdlib"):

    .text
    .align 1
    .global _start
    _start:
        mov     #1, r3
        trapa   #40     // syscall(__NR_exit)
        nop

The bug appears when the log (option "-d") is enabled.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Signed-off-by: Yves JANIN <yves.janin@st.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agokvm: fix FPU state subsection
Marcelo Tosatti [Tue, 21 Jun 2011 16:53:18 +0000 (13:53 -0300)]
kvm: fix FPU state subsection

There is no need to specify version on the subsection fields.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoKVM: Fix XSAVE feature bit enumeration
Andre Przywara [Fri, 10 Jun 2011 13:56:28 +0000 (15:56 +0200)]
KVM: Fix XSAVE feature bit enumeration

When iterating through the XSAVE feature enumeration CPUID leaf (0xD)
we should not stop at the first zero EAX, but instead keep scanning
since there are gaps in the enumeration (ECX=1 for instance).
This fixes the proper usage of AVX in KVM guests.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoRemove unneeded kvm.h from cpu-exec.c
Jan Kiszka [Wed, 8 Jun 2011 14:11:06 +0000 (16:11 +0200)]
Remove unneeded kvm.h from cpu-exec.c

This was obsoleted by 6792a57bf1.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid
Jan Kiszka [Wed, 8 Jun 2011 14:11:05 +0000 (16:11 +0200)]
kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid

kvm_arch_get_supported_cpuid checks for global cpuid restrictions, it
does not require any CPUState reference. Changing its interface allows
to call it before any VCPU is initialized.

CC: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: Clean up stubs
Jan Kiszka [Wed, 8 Jun 2011 14:11:04 +0000 (16:11 +0200)]
kvm: Clean up stubs

No one references kvm_check_extension, kvm_has_vcpu_events, and
kvm_has_robust_singlestep outside KVM code.

kvm_update_guest_debug is never called, thus has no job besides
returning an error.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: ppc: Drop KVM_CAP build dependencies
Jan Kiszka [Wed, 8 Jun 2011 14:11:03 +0000 (16:11 +0200)]
kvm: ppc: Drop KVM_CAP build dependencies

No longer needed with accompanied kernel headers.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: x86: Drop KVM_CAP build dependencies
Jan Kiszka [Wed, 8 Jun 2011 14:11:02 +0000 (16:11 +0200)]
kvm: x86: Drop KVM_CAP build dependencies

No longer needed with accompanied kernel headers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: Drop KVM_CAP build dependencies
Jan Kiszka [Wed, 8 Jun 2011 14:11:01 +0000 (16:11 +0200)]
kvm: Drop KVM_CAP build dependencies

No longer needed with accompanied kernel headers. We are only left with
build dependencies that are controlled by kvm arch headers.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: Drop useless zero-initializations
Jan Kiszka [Wed, 8 Jun 2011 14:11:00 +0000 (16:11 +0200)]
kvm: Drop useless zero-initializations

Backing KVMState is alreay zero-initialized.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: ppc: Drop CONFIG_KVM_PPC_PVR
Jan Kiszka [Wed, 8 Jun 2011 14:10:59 +0000 (16:10 +0200)]
kvm: ppc: Drop CONFIG_KVM_PPC_PVR

Required header support is now unconditionally available.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: Drop CONFIG_KVM_PARA
Jan Kiszka [Wed, 8 Jun 2011 14:10:58 +0000 (16:10 +0200)]
kvm: Drop CONFIG_KVM_PARA

The kvm_para.h header is now always available.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoSwitch build system to accompanied kernel headers
Jan Kiszka [Wed, 8 Jun 2011 14:10:57 +0000 (16:10 +0200)]
Switch build system to accompanied kernel headers

This helps reducing our build-time checks for feature support in the
available Linux kernel headers. And it helps users that do not have
sufficiently recent headers installed on their build machine.

Consequently, the patch removes and build-time checks for kvm and vhost
in configure, the --kerneldir switch, and KVM_CFLAGS. Kernel headers are
supposed to be provided by QEMU only.

s390 needs some extra love as it carries redefinitions from kernel
headers.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoImport kernel headers
Jan Kiszka [Wed, 8 Jun 2011 14:10:56 +0000 (16:10 +0200)]
Import kernel headers

These kernel headers and the COPYING file were automatically imported
from current Linux git, cb0a02ecf9 (post 3.0-rc2).

Licensing:
asm-powerpc GPLv2
asm-s390 GPLv2
asm-x86 Linux top-level license (GPLv2 with exception)
linux/kvm*: Linux top-level license (GPLv2 with exception)
linux/vhost: Linux top-level license (GPLv2 with exception)
linux/virtio*: 3-clause BSB

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoAdd kernel header update script
Jan Kiszka [Wed, 8 Jun 2011 16:22:17 +0000 (18:22 +0200)]
Add kernel header update script

This helper pulls the required kernel headers for KVM and vhost into a
specified directory. The update is triggered via

    scripts/update-linux-headers.sh LINUX_PATH

and will place the output under linux-headers/linux and linux-headers/asm-*.
It also imports the COPYING to care for headers without an explicit license.

CC: Alexander Graf <agraf@suse.de>
CC: Christoph Hellwig <hch@lst.de>
CC: Peter Maydell <peter.maydell@linaro.org>
CC: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agocmd: fix operator precedence
Frediano Ziglio [Mon, 20 Jun 2011 16:08:57 +0000 (17:08 +0100)]
cmd: fix operator precedence

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoFix typo in cpus.c
Alexandre Raymond [Tue, 14 Jun 2011 02:16:36 +0000 (22:16 -0400)]
Fix typo in cpus.c

filed -> failed

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agolsi: Fix unused-but-set-variable warning
Christophe Fergeau [Wed, 1 Jun 2011 12:56:30 +0000 (14:56 +0200)]
lsi: Fix unused-but-set-variable warning

This warning is new in gcc 4.6.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoDon't translate pointer when in restore_sigcontext
Mike McCormack [Wed, 1 Jun 2011 06:14:37 +0000 (15:14 +0900)]
Don't translate pointer when in restore_sigcontext

Fixes crash in i386 when user emulation base address is non-zero.

21797 rt_sigreturn(8,1082124603,1,0,1082126048,1082126248)Exit reason and status: signal 11

Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
12 years agokvm: x86: Save/restore FPU OP, IP and DP
Jan Kiszka [Wed, 15 Jun 2011 13:17:26 +0000 (15:17 +0200)]
kvm: x86: Save/restore FPU OP, IP and DP

These FPU states are properly maintained by KVM but not yet by TCG. So
far we unconditionally set them to 0 in the guest which may cause
state corruptions, though not with modern guests.

To avoid breaking backward migration, use a conditional subsection that
is only written if any of the three fields is non-zero. The guest's
FNINIT clears them frequently, and cleared IA32_MISC_ENABLE MSR[2]
reduces the probability of non-zero values further so that this
subsection is not expected to restrict migration in any common scenario.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoxen: Add the Xen platform pci device
Steven Smith [Thu, 16 Jun 2011 16:05:17 +0000 (17:05 +0100)]
xen: Add the Xen platform pci device

Introduce a new emulated PCI device, specific to fully virtualized Xen
guests.  The device is necessary for PV on HVM drivers to work.

Signed-off-by: Steven Smith <ssmith@xensource.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: fix interrupt routing
Stefano Stabellini [Wed, 15 Jun 2011 16:36:56 +0000 (17:36 +0100)]
xen: fix interrupt routing

Compared to the last version I only added a comment to the code.

- remove i440FX-xen and i440fx_write_config_xen
we don't need to intercept pci config writes to i440FX anymore;

- introduce PIIX3-xen and piix3_write_config_xen
we do need to intercept pci config write to the PCI-ISA bridge to update
the PCI link routing;

- set the number of PIIX3-xen interrupts line to 128;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: only track the linear framebuffer
Stefano Stabellini [Wed, 15 Jun 2011 16:29:27 +0000 (17:29 +0100)]
xen: only track the linear framebuffer

Xen can only do dirty bit tracking for one memory region, so we should
explicitly avoid trying to track anything but the vga vram region.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agocirrus_vga: reset lfb_addr after a pci config write if the BAR is unmapped
Stefano Stabellini [Fri, 3 Jun 2011 15:56:54 +0000 (16:56 +0100)]
cirrus_vga: reset lfb_addr after a pci config write if the BAR is unmapped

If the cirrus_vga PCI BAR is unmapped than we should not only reset
map_addr but also lfb_addr, otherwise we'll keep trying to map
the old lfb_addr in map_linear_vram.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: mapcache performance improvements
Stefano Stabellini [Thu, 19 May 2011 17:35:46 +0000 (18:35 +0100)]
xen: mapcache performance improvements

Use qemu_invalidate_entry in cpu_physical_memory_unmap.

Do not lock mapcache entries in qemu_get_ram_ptr if the address falls in
the ramblock with offset == 0. We don't need to do that because the
callers of qemu_get_ram_ptr either try to map an entire block, other
from the main ramblock, or until the end of a page to implement a single
read or write in the main ramblock.
If we don't lock mapcache entries in qemu_get_ram_ptr we don't need to
call qemu_invalidate_entry in qemu_put_ram_ptr anymore because we can
leave with few long lived block mappings requested by devices.

Also move the call to qemu_ram_addr_from_mapcache at the beginning of
qemu_ram_addr_from_host.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoexec.c: refactor cpu_physical_memory_map
Stefano Stabellini [Thu, 19 May 2011 17:35:45 +0000 (18:35 +0100)]
exec.c: refactor cpu_physical_memory_map

Introduce qemu_ram_ptr_length that takes an address and a size as
parameters rather than just an address.

Refactor cpu_physical_memory_map so that we call qemu_ram_ptr_length only
once rather than calling qemu_get_ram_ptr one time per page.
This is not only more efficient but also tries to simplify the logic of
the function.
Currently we are relying on the fact that all the pages are mapped
contiguously in qemu's address space: we have a check to make sure that
the virtual address returned by qemu_get_ram_ptr from the second call on
is consecutive. Now we are making this more explicit replacing all the
calls to qemu_get_ram_ptr with a single call to qemu_ram_ptr_length
passing a size argument.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: agraf@suse.de
CC: anthony@codemonkey.ws
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: remove xen_map_block and xen_unmap_block
Stefano Stabellini [Thu, 19 May 2011 17:35:44 +0000 (18:35 +0100)]
xen: remove xen_map_block and xen_unmap_block

Replace xen_map_block with qemu_map_cache with the appropriate locking
and size parameters.
Replace xen_unmap_block with qemu_invalidate_entry.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: remove qemu_map_cache_unlock
Stefano Stabellini [Thu, 19 May 2011 17:35:43 +0000 (18:35 +0100)]
xen: remove qemu_map_cache_unlock

There is no need for qemu_map_cache_unlock, just use
qemu_invalidate_entry instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: fix qemu_map_cache with size != MCACHE_BUCKET_SIZE
Stefano Stabellini [Thu, 19 May 2011 17:35:42 +0000 (18:35 +0100)]
xen: fix qemu_map_cache with size != MCACHE_BUCKET_SIZE

Fix the implementation of qemu_map_cache: correctly support size
arguments different from 0 or MCACHE_BUCKET_SIZE.
The new implementation supports locked mapcache entries with size
multiple of MCACHE_BUCKET_SIZE. qemu_invalidate_entry can correctly
find and unmap these "large" mapcache entries given that the virtual
address passed to qemu_invalidate_entry is the same returned by
qemu_map_cache when the locked mapcache entry was created.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: Introduce VGA sync dirty bitmap support
Anthony PERARD [Tue, 24 May 2011 13:34:21 +0000 (14:34 +0100)]
xen: Introduce VGA sync dirty bitmap support

This patch introduces phys memory client for Xen.

Only sync dirty_bitmap and set_memory are actually implemented.
migration_log will stay empty for the moment.

Xen can only log one range for bit change, so only the range in the
first call will be synced.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: Add xc_domain_add_to_physmap to xen_interface.
Anthony PERARD [Tue, 24 May 2011 13:34:20 +0000 (14:34 +0100)]
xen: Add xc_domain_add_to_physmap to xen_interface.

This function will be used to support sync dirty bitmap.

This come with a check against every Xen release, and special
implementation for Xen version that doesn't have this specific call.

This function will not be usable with Xen 3.3 because the behavior is
different.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoReset system before loadvm
Jan Kiszka [Tue, 14 Jun 2011 16:29:45 +0000 (18:29 +0200)]
Reset system before loadvm

In case we load the vmstate during incoming migration, we start from a
clean, default machine state as we went through system reset before. But
if we load from a snapshot, the machine can be in any state. That can
cause troubles if loading an older image which does not carry all state
information the executing QEMU requires. Hardly any device takes care of
this scenario.

However, fixing this is trivial. We just need to issue a system reset
during loadvm as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoAllow silent system resets
Jan Kiszka [Tue, 14 Jun 2011 16:29:43 +0000 (18:29 +0200)]
Allow silent system resets

This allows qemu_system_reset to be issued silently for internal
purposes, ie. without sending out a monitor event. Convert the system
reset after startup to the silent mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoerror framework: Fix compilation for w32/w64
Stefan Weil [Mon, 13 Jun 2011 21:01:53 +0000 (23:01 +0200)]
error framework: Fix compilation for w32/w64

The declaration of function error_set() should use macro GCC_FMT_ATTR
instead of gcc's format printf attribute.

For w32/w64, both declarations are different and GCC_FMT_ATTR is needed.
Compilation for w64 even failed with the original code because mingw64
defines a macro for printf.

GCC_FMT_ATTR requires qemu-common.h, so add it in error.c
(it's also included by error_int.h but too late).

Remove assert.h which is included by qemu-common.h.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agowdt: remove unused variables
Michael S. Tsirkin [Tue, 14 Jun 2011 14:29:34 +0000 (17:29 +0300)]
wdt: remove unused variables

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoalpha: remove unused variable
Michael S. Tsirkin [Tue, 14 Jun 2011 17:06:06 +0000 (20:06 +0300)]
alpha: remove unused variable

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Richard Henderson <rth@twiddle.net>
13 years agoalpha/translate: remve unused variables
Michael S. Tsirkin [Tue, 14 Jun 2011 15:06:40 +0000 (18:06 +0300)]
alpha/translate: remve unused variables

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Richard Henderson <rth@twiddle.net>
13 years agoget_maintainer: update to match qemu tree
Michael S. Tsirkin [Tue, 14 Jun 2011 17:15:41 +0000 (20:15 +0300)]
get_maintainer: update to match qemu tree

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoget_maintainer.pl: copy utility from Linux
Michael S. Tsirkin [Tue, 14 Jun 2011 17:13:42 +0000 (20:13 +0300)]
get_maintainer.pl: copy utility from Linux

Our MAINTAINERS file format matches Linux so
get the utility to parse it from there.
Updated as of linux 3.0-rc3

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>