]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
12 years agoblock: Add bdrv_co_readv/writev
Kevin Wolf [Thu, 14 Jul 2011 15:27:13 +0000 (17:27 +0200)]
block: Add bdrv_co_readv/writev

Add new block driver callbacks bdrv_co_readv/writev, which work on a
QEMUIOVector like bdrv_aio_*, but don't need a callback. The function may only
be called inside a coroutine, so a block driver implementing this interface can
yield instead of blocking during I/O.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agocoroutine: add test-coroutine --benchmark-lifecycle
Stefan Hajnoczi [Thu, 12 May 2011 07:27:39 +0000 (08:27 +0100)]
coroutine: add test-coroutine --benchmark-lifecycle

Add a microbenchmark for coroutine create, enter, and return (aka
lifecycle).  This is a useful benchmark because users are expected to
create many coroutines, one per I/O request for example, and we
therefore need to provide good performance in that scenario.

To run:

  make test-coroutine
  ./test-coroutine --benchmark-lifecycle 20000000

This will do 20,000,000 coroutine create, enter, return iterations and
print the resulting time.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocoroutine: add test-coroutine automated tests
Stefan Hajnoczi [Tue, 10 May 2011 09:21:18 +0000 (10:21 +0100)]
coroutine: add test-coroutine automated tests

To run automated tests for coroutines:

  make test-coroutine
  ./test-coroutine

On success the program terminates with exit status 0.  On failure an
error message is written to stderr and the program exits with exit
status 1.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocoroutine: implement coroutines using gthread
Aneesh Kumar K.V [Thu, 9 Jun 2011 17:41:06 +0000 (23:11 +0530)]
coroutine: implement coroutines using gthread

On platforms that don't support makecontext(3) use gthread based
coroutine implementation.

Darwin has makecontext(3) but getcontext(3) is stubbed out to return
ENOTSUP.  Andreas Färber <andreas.faerber@web.de> debugged this and
contributed the ./configure test which solves the issue for Darwin/ppc64
(and ppc) v10.5.

[Original patch by Aneesh, made consistent with coroutine-ucontext.c and
switched to GStaticPrivate by Stefan.  Tested on Linux and OpenBSD.]

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocoroutine: introduce coroutines
Kevin Wolf [Mon, 17 Jan 2011 16:08:14 +0000 (16:08 +0000)]
coroutine: introduce coroutines

Asynchronous code is becoming very complex.  At the same time
synchronous code is growing because it is convenient to write.
Sometimes duplicate code paths are even added, one synchronous and the
other asynchronous.  This patch introduces coroutines which allow code
that looks synchronous but is asynchronous under the covers.

A coroutine has its own stack and is therefore able to preserve state
across blocking operations, which traditionally require callback
functions and manual marshalling of parameters.

Creating and starting a coroutine is easy:

  coroutine = qemu_coroutine_create(my_coroutine);
  qemu_coroutine_enter(coroutine, my_data);

The coroutine then executes until it returns or yields:

  void coroutine_fn my_coroutine(void *opaque) {
      MyData *my_data = opaque;

      /* do some work */

      qemu_coroutine_yield();

      /* do some more work */
  }

Yielding switches control back to the caller of qemu_coroutine_enter().
This is typically used to switch back to the main thread's event loop
after issuing an asynchronous I/O request.  The request callback will
then invoke qemu_coroutine_enter() once more to switch back to the
coroutine.

Note that if coroutines are used only from threads which hold the global
mutex they will never execute concurrently.  This makes programming with
coroutines easier than with threads.  Race conditions cannot occur since
only one coroutine may be active at any time.  Other coroutines can only
run across yield.

This coroutines implementation is based on the gtk-vnc implementation
written by Anthony Liguori <anthony@codemonkey.ws> but it has been
significantly rewritten by Kevin Wolf <kwolf@redhat.com> to use
setjmp()/longjmp() instead of the more expensive swapcontext() and by
Paolo Bonzini <pbonzini@redhat.com> for Windows Fibers support.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoraw-posix: Always check paio_init result
Frediano Ziglio [Wed, 27 Jul 2011 18:12:02 +0000 (20:12 +0200)]
raw-posix: Always check paio_init result

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoraw-posix: Typo fix
Frediano Ziglio [Wed, 27 Jul 2011 18:12:01 +0000 (20:12 +0200)]
raw-posix: Typo fix

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Removed unused function bdrv_write_sync
Frediano Ziglio [Wed, 27 Jul 2011 18:12:00 +0000 (20:12 +0200)]
block: Removed unused function bdrv_write_sync

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: Remove 'drive_kind'
Hannes Reinecke [Fri, 22 Jul 2011 14:44:46 +0000 (16:44 +0200)]
scsi-disk: Remove 'drive_kind'

Instead of using its own definitions scsi-disk should
be using the device type of the parent device.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: Sanitize command definitions
Hannes Reinecke [Fri, 22 Jul 2011 14:51:15 +0000 (16:51 +0200)]
scsi: Sanitize command definitions

Sanitize SCSI command definitions.
Add _10 suffix to READ_CAPACITY, WRITE_VERIFY, VERIFY, READ_LONG,
WRITE_LONG, and WRITE_SAME.
Add new command definitions for LOCATE_10, UNMAP, VARLENGTH_CDB,
WRITE_FILEMARKS_16, EXTENDED_COPY, ATA_PASSTHROUGH, ACCESS_CONTROL_IN,
ACCESS_CONTROL_OUT, COMPARE_AND_WRITE, VERIFY_16, SYNCHRONIZE_CACHE_16,
LOCATE_16, ERASE_16, WRITE_LONG_16, LOAD_UNLOAD, VERIFY_12.
Remove invalid definition of WRITE_LONG_2.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: Remove REZERO_UNIT emulation
Hannes Reinecke [Fri, 22 Jul 2011 14:51:14 +0000 (16:51 +0200)]
scsi: Remove REZERO_UNIT emulation

REZERO_UNIT command is obsolete. Remove support for it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: Remove references to SET_WINDOW
Hannes Reinecke [Fri, 22 Jul 2011 14:51:13 +0000 (16:51 +0200)]
scsi: Remove references to SET_WINDOW

SET_WINDOW command is vendor-specific only.
So we shouldn't try to emulate it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: Codingstyle fixes
Hannes Reinecke [Fri, 22 Jul 2011 14:51:12 +0000 (16:51 +0200)]
scsi-disk: Codingstyle fixes

Replace tabs with spaces.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock/vpc.c: Detect too-large vpc file
Serge E. Hallyn [Mon, 25 Jul 2011 18:34:35 +0000 (18:34 +0000)]
block/vpc.c: Detect too-large vpc file

VHD files technically can be up to 2Tb, but virtual pc is limited
to 127G.  Currently qemu-img refused to create vpc files > 127G,
but it is failing to return error when converting from a non-vpc
VHD file which is >127G.  It returns success, but creates a truncated
converted image.  Also, qemu-img info claims the vpc file is 127G
(and clean).

This patch detects a too-large vpc file and returns -EFBIG.  Without
this patch,

=============================================================
root@ip-10-38-123-242:~/qemu-fixed# qemu-img info /mnt/140g-dynamic.vhd
image: /mnt/140g-dynamic.vhd
file format: vpc
virtual size: 127G (136899993600 bytes)
disk size: 284K
root@ip-10-38-123-242:~/qemu-fixed# qemu-img convert -f vpc -O raw /mnt/140g-dynamic.vhd /mnt/y
root@ip-10-38-123-242:~/qemu-fixed# echo $?
0
root@ip-10-38-123-242:~/qemu-fixed# qemu-img info /mnt/y
image: /mnt/y
file format: raw
virtual size: 127G (136899993600 bytes)
disk size: 0
=============================================================

(The 140G image was truncated with no warning or error.)

With the patch, I get:

=============================================================
root@ip-10-38-123-242:~/qemu-fixed# ./qemu-img info /mnt/140g-dynamic.vhd
qemu-img: Could not open '/mnt/140g-dynamic.vhd': File too large
root@ip-10-38-123-242:~/qemu-fixed# ./qemu-img convert -f vpc -O raw /mnt/140g-dynamic.vhd /mnt/y
qemu-img: Could not open '/mnt/140g-dynamic.vhd': File too large
qemu-img: Could not open '/mnt/140g-dynamic.vhd'
=============================================================

See https://bugs.launchpad.net/qemu/+bug/814222 for details.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Don't let locked flag prevent medium load
Markus Armbruster [Wed, 20 Jul 2011 16:23:43 +0000 (18:23 +0200)]
block: Don't let locked flag prevent medium load

Commit aea2a33c made bdrv_eject() obey the locked flag.  Correct for
medium eject (eject_flag set), incorrect for medium load (eject_flag
clear).  See MMC-5 Table 341 "Actions for Lock/Unlock/Eject".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Make BlockDriver method bdrv_eject() return void
Markus Armbruster [Wed, 20 Jul 2011 16:23:42 +0000 (18:23 +0200)]
block: Make BlockDriver method bdrv_eject() return void

Callees always return 0, except for FreeBSD's cdrom_eject(), which
returns -ENOTSUP when the device is in a terminally wedged state.

The only caller is bdrv_eject(), and it maps -ENOTSUP to 0 since
commit 4be9762a.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Make BlockDriver method bdrv_set_locked() return void
Markus Armbruster [Wed, 20 Jul 2011 16:23:41 +0000 (18:23 +0200)]
block: Make BlockDriver method bdrv_set_locked() return void

The only caller is bdrv_set_locked(), and it ignores the value.

Callees always return 0, except for FreeBSD's cdrom_set_locked(),
which returns -ENOTSUP when the device is in a terminally wedged
state.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock/raw-win32: Drop disabled code for removable host devices
Markus Armbruster [Wed, 20 Jul 2011 16:23:40 +0000 (18:23 +0200)]
block/raw-win32: Drop disabled code for removable host devices

It's been disabled since the start (commit 19cb3738, Aug 2006), and
has been untouched except for spelling fixes and such.  I don't feel
like dragging it along any further.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Reset device model callbacks on detach
Markus Armbruster [Wed, 20 Jul 2011 16:23:36 +0000 (18:23 +0200)]
block: Reset device model callbacks on detach

BlockDriverState members change_cb and change_opaque are initially
null.  The device model may set them, with bdrv_set_change_cb().  If
the device model gets detached (hot unplug), they're left dangling.
Only safe because device hot unplug automatically destroys the
BlockDriverState.  But that's a questionable feature, best not to rely
on it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblockdev: Make eject fail for non-removable drives even with -f
Markus Armbruster [Wed, 20 Jul 2011 16:23:35 +0000 (18:23 +0200)]
blockdev: Make eject fail for non-removable drives even with -f

Ejecting hard disk platters can only end in tears.

If you need to revoke access to an image, use drive_del, not eject -f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agomicroblaze: Add missing call to qemu_init_vcpu.
Peter A. G. Crosthwaite [Sun, 31 Jul 2011 04:40:13 +0000 (06:40 +0200)]
microblaze: Add missing call to qemu_init_vcpu.

Fixes emulation with io-thread.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoTCG: fix breakage by previous patch
Blue Swirl [Sat, 30 Jul 2011 18:53:27 +0000 (18:53 +0000)]
TCG: fix breakage by previous patch

Fix incorrect logic and typos in previous commit
1bfd07bdfe56cea43dbe258dcb161e46b0ee29b7.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoTCG: fix breakage on some RISC hosts
Blue Swirl [Sat, 30 Jul 2011 12:21:33 +0000 (12:21 +0000)]
TCG: fix breakage on some RISC hosts

Fix breakage by a640f03178c22355a158fa9378e4f8bfa4f517a6
and 55c0975c5b358e948b9ae7bd7b07eff92508e756.

Some TCG targets don't implement all TCG ops, so make
optimizing those conditional.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoDo constant folding for unary operations.
Kirill Batuzov [Thu, 7 Jul 2011 12:37:17 +0000 (16:37 +0400)]
Do constant folding for unary operations.

Perform constant folding for NOT and EXT{8,16,32}{S,U} operations.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoDo constant folding for shift operations.
Kirill Batuzov [Thu, 7 Jul 2011 12:37:16 +0000 (16:37 +0400)]
Do constant folding for shift operations.

Perform constant forlding for SHR, SHL, SAR, ROTR, ROTL operations.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoDo constant folding for boolean operations.
Kirill Batuzov [Thu, 7 Jul 2011 12:37:15 +0000 (16:37 +0400)]
Do constant folding for boolean operations.

Perform constant folding for AND, OR, XOR operations.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoDo constant folding for basic arithmetic operations.
Kirill Batuzov [Thu, 7 Jul 2011 12:37:14 +0000 (16:37 +0400)]
Do constant folding for basic arithmetic operations.

Perform actual constant folding for ADD, SUB and MUL operations.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd copy and constant propagation.
Kirill Batuzov [Thu, 7 Jul 2011 12:37:13 +0000 (16:37 +0400)]
Add copy and constant propagation.

Make tcg_constant_folding do copy and constant propagation. It is a
preparational work before actual constant folding.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd TCG optimizations stub
Kirill Batuzov [Thu, 7 Jul 2011 12:37:12 +0000 (16:37 +0400)]
Add TCG optimizations stub

Added file tcg/optimize.c to hold TCG optimizations. Function tcg_optimize
is called from tcg_gen_code_common. It calls other functions performing
specific optimizations. Stub for constant folding was added.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec.h cleanup
Blue Swirl [Wed, 13 Jul 2011 12:44:15 +0000 (12:44 +0000)]
exec.h cleanup

Move softmmu_exec.h include directives from target-*/exec.h to
target-*/op_helper.c. Move also various other stuff only used in
op_helper.c there.

Define global env in dyngen-exec.h.

For i386, move wrappers for segment and FPU helpers from user-exec.c
to op_helper.c. Implement raise_exception_err_env() to handle dynamic
CPUState. Move the function declarations to cpu.h since they can be
used outside of op_helper.c context.

LM32, s390x, UniCore32: remove unused cpu_halted(), regs_to_env() and
env_to_regs().

ARM: make raise_exception() static.

Convert
#include "exec.h"
to
#include "cpu.h"
#include "dyngen-exec.h"
and remove now unused target-*/exec.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agorevamp acpitable parsing and allow to specify complete (headerful) table
Michael Tokarev [Thu, 12 May 2011 14:44:17 +0000 (18:44 +0400)]
revamp acpitable parsing and allow to specify complete (headerful) table

This patch almost rewrites acpi_table_add() function
(but still leaves it using old get_param_value() interface).
The result is that it's now possible to specify whole table
(together with a header) in an external file, instead of just
data portion, with a new file= parameter, but at the same time
it's still possible to specify header fields as before.

Now with the checkpatch.pl formatting fixes, thanks to
Stefan Hajnoczi for suggestions, with changes from
Isaku Yamahata, and with my further refinements.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: John Baboval <john.baboval@virtualcomputer.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
[yamahata@valinux.co.jp: fix compile error, comment fallthrough]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: implement %fprs dirty bits
Tsuneo Saito [Sat, 23 Jul 2011 02:20:07 +0000 (11:20 +0900)]
SPARC64: implement %fprs dirty bits

Implement %fprs.DU/DL bits.
The FPU sets %fprs.DL and %fprs.DU when values are assigned to %f0-31
and %f32-63 respectively.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: fix fnor* and fnand*
Tsuneo Saito [Sat, 23 Jul 2011 02:20:06 +0000 (11:20 +0900)]
SPARC64: fix fnor* and fnand*

Fix the problem that result values are not assigned to the destination
registers.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosd: do not add one sector to the disk size
Vincent Palatin [Mon, 25 Jul 2011 23:19:05 +0000 (16:19 -0700)]
sd: do not add one sector to the disk size

This leads to random off-by-one error.
When the size of the SD is exactly 1GB, the emulation was returning a
wrong SDHC CSD descriptor.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agouser: Restore debug usage message for '-d ?' in user mode emulation
Peter Maydell [Mon, 18 Jul 2011 10:44:09 +0000 (11:44 +0100)]
user: Restore debug usage message for '-d ?' in user mode emulation

The code which prints the debug usage message on '-d ?' for *-user
has to come before the check for "not enough arguments", so that
"qemu-foo -d ?" prints the list of possible debug log items rather than
the generic usage message. (This was inadvertently broken in commit
c235d73.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agousb-hid: Fix 0/0 position for Windows in tablet mode
Jan Kiszka [Sat, 30 Jul 2011 05:18:41 +0000 (07:18 +0200)]
usb-hid: Fix 0/0 position for Windows in tablet mode

For unknown reasons, Windows drivers (tested with XP and Win7) ignore
usb-tablet events that move the pointer to 0/0. So always report 0/0 as
1/0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoAdd support for Zipit Z2 machine
Vasily Khoruzhick [Wed, 6 Jul 2011 13:52:49 +0000 (16:52 +0300)]
Add support for Zipit Z2 machine

Zipit Z2 is small PXA270 based handheld.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoonenand: Add missing brace.
Andrzej Zaborowski [Sat, 30 Jul 2011 04:53:39 +0000 (06:53 +0200)]
onenand: Add missing brace.

Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/onenand: program actions can only clear bits
Juha Riihimäki [Fri, 29 Jul 2011 15:35:28 +0000 (16:35 +0100)]
hw/onenand: program actions can only clear bits

The program actions onenand_prog_main() and onenand_prog_spare()
can only set bits.

This implies a rewrite of onenand_erase() to not use the program
functions, since erase does need to set bits.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoonenand: Handle various ID fields separately
Juha Riihimäki [Fri, 29 Jul 2011 15:35:26 +0000 (16:35 +0100)]
onenand: Handle various ID fields separately

Handle the manufacturer, device and version IDs separately rather than
smooshing them all together into a single uint32_t. Note that the ID
registers are actually 16 bit, even though typically the top bits are 0
and the Read Identification Data command only returns the bottom 8 bits.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoonenand: Pass BlockDriverState to init function
Peter Maydell [Fri, 29 Jul 2011 15:35:25 +0000 (16:35 +0100)]
onenand: Pass BlockDriverState to init function

Pass the BlockDriverState to the onenand init function so it doesn't
need to look up the drive itself.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/nand: qdevify
Juha Riihimäki [Fri, 29 Jul 2011 15:35:24 +0000 (16:35 +0100)]
hw/nand: qdevify

Qdevify the NAND device.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/nand: Writing to NAND can only clear bits
Peter Maydell [Fri, 29 Jul 2011 15:35:23 +0000 (16:35 +0100)]
hw/nand: Writing to NAND can only clear bits

Writing to a NAND device cannot set bits, it can only clear them;
implement this rather than simply copying the data.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/nand: Support multiple reads following READ STATUS
Juha Riihimäki [Fri, 29 Jul 2011 15:35:22 +0000 (16:35 +0100)]
hw/nand: Support multiple reads following READ STATUS

After receiving READ STATUS command all subsequent IO reads should return
the status register value until another command is issued.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/nand: Support devices wider than 8 bits
Juha Riihimäki [Fri, 29 Jul 2011 15:35:21 +0000 (16:35 +0100)]
hw/nand: Support devices wider than 8 bits

Support NAND devices which are wider than 8 bits.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agonand: Bump vmstate version after changing structure.
Andrzej Zaborowski [Sat, 30 Jul 2011 04:01:37 +0000 (06:01 +0200)]
nand: Bump vmstate version after changing structure.

Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/nand: Support large NAND devices
Juha Riihimäki [Fri, 29 Jul 2011 15:35:20 +0000 (16:35 +0100)]
hw/nand: Support large NAND devices

Add support for NAND devices of over 1Gb.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/nand: Pass block device state to init function
Peter Maydell [Fri, 29 Jul 2011 15:35:19 +0000 (16:35 +0100)]
hw/nand: Pass block device state to init function

Pass the BlockDeviceState to the nand_init() function rather
than having it look it up via drive_get() itself.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agolm832x: Take DeviceState pointer in lm832x_key_event()
Peter Maydell [Fri, 29 Jul 2011 15:35:18 +0000 (16:35 +0100)]
lm832x: Take DeviceState pointer in lm832x_key_event()

Since lm832x has been qdev'ified, its users will generally
have a DeviceState pointer rather than an i2c_slave pointer,
so adjust lm832x_key_event's prototype to suit.

This allows the n810 (its only user) to actually pass a correct
pointer to it rather than NULL. The effect is that we no longer
segfault when a key is pressed.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/omap_gpio.c: Convert to qdev
Juha Riihimäki [Fri, 29 Jul 2011 15:35:17 +0000 (16:35 +0100)]
hw/omap_gpio.c: Convert to qdev

Convert the OMAP GPIO module to qdev.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/omap_clk: Add the clock for the OMAP2430-specific fifth GPIO module
Peter Maydell [Fri, 29 Jul 2011 15:35:16 +0000 (16:35 +0100)]
hw/omap_clk: Add the clock for the OMAP2430-specific fifth GPIO module

The OMAP2430 has a fifth GPIO module which earlier OMAP2 models lack; add
the clock definition for it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agohw/omap_l4.c: Add helper function omap_l4_region_base
Juha Riihimäki [Fri, 29 Jul 2011 15:35:14 +0000 (16:35 +0100)]
hw/omap_l4.c: Add helper function omap_l4_region_base

Add helper function omap_l4_region_base() to return the base address
of a particular region of an L4 target agent.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 29 Jul 2011 14:46:16 +0000 (09:46 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

12 years agoMerge remote-tracking branch 'alon/pull-libcacard.afe' into staging
Anthony Liguori [Fri, 29 Jul 2011 14:43:36 +0000 (09:43 -0500)]
Merge remote-tracking branch 'alon/pull-libcacard.afe' into staging

12 years agoMerge remote-tracking branch 'agraf/xen-next' into staging
Anthony Liguori [Fri, 29 Jul 2011 14:42:12 +0000 (09:42 -0500)]
Merge remote-tracking branch 'agraf/xen-next' into staging

12 years agoMerge remote-tracking branch 'kraxel/migration.2' into staging
Anthony Liguori [Fri, 29 Jul 2011 14:39:37 +0000 (09:39 -0500)]
Merge remote-tracking branch 'kraxel/migration.2' into staging

12 years agomonitor: fix build breakage with --disable-vnc
TeLeMan [Mon, 25 Jul 2011 08:29:14 +0000 (16:29 +0800)]
monitor: fix build breakage with --disable-vnc

The breakage was introduced by the commit 13661089810d3e59931f3e80d7cb541b99af7071

Signed-off-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAllow to leave type on default in -machine
Jan Kiszka [Mon, 25 Jul 2011 16:11:20 +0000 (18:11 +0200)]
Allow to leave type on default in -machine

This allows to specify -machine options without setting an explicit
machine type. We will pick the default machine in this case. Requesting
the list of available machines is still possible via '-machine ?' e.g.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoCODING_STYLE: explicitly allow braceless 'else if'
Avi Kivity [Mon, 25 Jul 2011 15:55:53 +0000 (18:55 +0300)]
CODING_STYLE: explicitly allow braceless 'else if'

It's already allowed by the example; there are about 1800 instances in the
tree; and disallowing it would lead to

    if (a) {
        ...
    } else {
        if (b) {
            ...
        } else {
            if (c) {
                ...
            } else {
                if (d) {
                    ...
                } else {
                    ...
                }
            }
        }
    }

instead of

    if (a) {
        ...
    } else if (b) {
        ...
    } else if (c) {
        ...
    } else if (d) {
        ...
    } else {
        ...
    }

which is more readable.

Acked-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoFix a compilation error in xen-mapcache.c
Stefan Berger [Tue, 26 Jul 2011 14:33:11 +0000 (10:33 -0400)]
Fix a compilation error in xen-mapcache.c

This patch fixes a compilation error in xen-mapcache.c .

/home/stefanb/qemu/qemu-git/xen-mapcache.c: In function ‘xen_ram_addr_from_mapcache’:
/home/stefanb/qemu/qemu-git/xen-mapcache.c:240:42: error: variable ‘pentry’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomultiboot: Fix bss segment support
Göran Weinholt [Sun, 24 Jul 2011 15:55:58 +0000 (17:55 +0200)]
multiboot: Fix bss segment support

Multiboot images can specify a bss segment. The boot loader must clear
the memory of the bss and ensure that no modules or structures are
allocated inside it. Several fields are provided in the Multiboot
header that were previously not used properly. The header is now used
to determine how much data should be read from the image and how much
memory should be reserved to the bss segment.

Signed-off-by: Göran Weinholt <goran@weinholt.se>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: add --disable-zlib-test
Alon Levy [Tue, 26 Jul 2011 09:30:40 +0000 (12:30 +0300)]
configure: add --disable-zlib-test

This is required for building libcacard which doesn't itself require
zlib without bringing in this requirement to the build environment.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd missing trace call to oslib-posix.c:qemu_vmalloc()
Jes Sorensen [Mon, 25 Jul 2011 15:13:36 +0000 (17:13 +0200)]
Add missing trace call to oslib-posix.c:qemu_vmalloc()

Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoFix last sector write on sd card
Dr. David Alan Gilbert [Mon, 25 Jul 2011 12:21:30 +0000 (13:21 +0100)]
Fix last sector write on sd card

    When writing the last sector of an SD card using WRITE_MULTIPLE_BLOCK
QEmu throws an error saying that we've run off the end, and leaves
itself in the wrong state.

    Tested on ARM Vexpress model.

Signed-off-by: Dr. David Alan Gilbert <david.gilbert@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomove unaligned memory access functions to bswap.h
Paolo Bonzini [Thu, 28 Jul 2011 10:10:30 +0000 (12:10 +0200)]
move unaligned memory access functions to bswap.h

This is just code movement, and moving the fpu/ include path from
target-dependent to target-independent Make variables.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosoftfloat: change default nan definitions to variables
Paolo Bonzini [Thu, 28 Jul 2011 10:10:29 +0000 (12:10 +0200)]
softfloat: change default nan definitions to variables

Most definitions in softfloat.h are really target-independent, but the
file is not because it includes definitions of the default NaN values.
Change those to variables to allow including softfloat.h from files that
are not compiled per-target.  By making them const, the compiler is
allowed to optimize them into softfloat functions that use them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomove WORDS_ALIGNED to qemu-common.h
Paolo Bonzini [Thu, 28 Jul 2011 10:10:28 +0000 (12:10 +0200)]
move WORDS_ALIGNED to qemu-common.h

This is not a CPU interface, and a configure test would not be too
precise.  So just add it to qemu-common.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoshowing a splash picture when start
wayne [Wed, 27 Jul 2011 10:04:55 +0000 (18:04 +0800)]
showing a splash picture when start

    Added options to let qemu transfer two configuration files to bios:
"bootsplash.bmp" and "etc/boot-menu-wait", which could be specified by command
    -boot splash=P,splash-time=T
P is jpg/bmp file name or an absolute path, T have a max value of 0xffff, unit
is ms. With these two options, if user invoke qemu with menu=on option, then
a splash picture would be showed in a given time. For example:
    qemu -boot menu=on,splash=/root/boot.bmp,splash-time=5000
would make boot.bmp shown as a brand with 5 seconds in the booting up process.
This feature need the new seabios's support, which could be got from git.

Signed-off-by: Wayne Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agousb-ohci: convert to MemoryRegion
Avi Kivity [Tue, 26 Jul 2011 11:26:22 +0000 (14:26 +0300)]
usb-ohci: convert to MemoryRegion

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosysbus: add MemoryRegion based memory management API
Avi Kivity [Tue, 26 Jul 2011 11:26:21 +0000 (14:26 +0300)]
sysbus: add MemoryRegion based memory management API

Allow registering sysbus device memory using a MemoryRegion.  Once all users
are converted, sysbus_init_mmio() and sysbus_init_mmio_cb() will be removed.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopci: add MemoryRegion based BAR management API
Avi Kivity [Tue, 26 Jul 2011 11:26:20 +0000 (14:26 +0300)]
pci: add MemoryRegion based BAR management API

Allow registering a BAR using a MemoryRegion.  Once all users are converted,
pci_register_bar() and pci_register_bar_simple() will be removed.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopci: pass address space to pci bus when created
Avi Kivity [Tue, 26 Jul 2011 11:26:19 +0000 (14:26 +0300)]
pci: pass address space to pci bus when created

This is now done sloppily, via get_system_memory().  Eventually callers
will be converted to stop using that.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopc: move global memory map out of pc_init1() and into its callers
Avi Kivity [Tue, 26 Jul 2011 11:26:18 +0000 (14:26 +0300)]
pc: move global memory map out of pc_init1() and into its callers

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopc: convert pc_memory_init() to memory API
Avi Kivity [Tue, 26 Jul 2011 11:26:17 +0000 (14:26 +0300)]
pc: convert pc_memory_init() to memory API

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agopc: grab system_memory
Avi Kivity [Tue, 26 Jul 2011 11:26:16 +0000 (14:26 +0300)]
pc: grab system_memory

While eventually this should come from the machine initialization function,
take a short cut to avoid converting all machines now.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoioport: register ranges by byte aligned addresses always
Avi Kivity [Tue, 26 Jul 2011 11:26:15 +0000 (14:26 +0300)]
ioport: register ranges by byte aligned addresses always

The I/O port space is byte addressable, even for word and long accesses.

An example is the VMware svga card, which has long ports on offsets 0,
1, and 2.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoexec.c: initialize memory map
Avi Kivity [Tue, 26 Jul 2011 11:26:14 +0000 (14:26 +0300)]
exec.c: initialize memory map

Allocate the root memory region and initialize it.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: transaction API
Avi Kivity [Tue, 26 Jul 2011 11:26:13 +0000 (14:26 +0300)]
memory: transaction API

Allow changes to the memory hierarchy to be accumulated and
made visible all at once.  This reduces computational effort,
especially when an accelerator (e.g. kvm) is involved.

Useful when a single register update causes multiple changes
to an address space.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: separate building the final memory map into two steps
Avi Kivity [Tue, 26 Jul 2011 11:26:12 +0000 (14:26 +0300)]
memory: separate building the final memory map into two steps

Instead of adding and deleting regions in one pass, do a delete
pass followed by an add pass.  This fixes the following case:

from:
  0x0000-0x0fff ram  (a1)
  0x1000-0x1fff mmio (a2)
  0x2000-0x2fff ram  (a3)

to:
  0x0000-0x2fff ram  (b1)

The single pass algorithm removed a1, added b2, then removed a2 and a3,
which caused the wrong memory map to be built.  The two pass algorithm
removes a1, a2, and a3, then adds b1.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: add ioeventfd support
Avi Kivity [Tue, 26 Jul 2011 11:26:11 +0000 (14:26 +0300)]
memory: add ioeventfd support

As with the rest of the memory API, the caller associates an eventfd
with an address, and the memory API takes care of registering or
unregistering when the address is made visible or invisible to the
guest.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: add backward compatibility for old mmio registration
Avi Kivity [Tue, 26 Jul 2011 11:26:10 +0000 (14:26 +0300)]
memory: add backward compatibility for old mmio registration

This eases the transition to the new API.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: add backward compatibility for old portio registration
Avi Kivity [Tue, 26 Jul 2011 11:26:09 +0000 (14:26 +0300)]
memory: add backward compatibility for old portio registration

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: I/O address space support
Avi Kivity [Tue, 26 Jul 2011 11:26:08 +0000 (14:26 +0300)]
memory: I/O address space support

Allow registering I/O ports via the same mechanism as mmio ranges.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: late initialization of ram_addr
Avi Kivity [Tue, 26 Jul 2011 11:26:07 +0000 (14:26 +0300)]
memory: late initialization of ram_addr

For non-RAM memory regions, we cannot tell whether this is an I/O region
or an MMIO region.  Since the qemu backing registration is different for
the two, we have to defer initialization until we know which address
space we are in.

These shenanigans will be removed once the backing registration is unified
with the memory API.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: rename MemoryRegion::has_ram_addr to ::terminates
Avi Kivity [Tue, 26 Jul 2011 11:26:06 +0000 (14:26 +0300)]
memory: rename MemoryRegion::has_ram_addr to ::terminates

I/O regions will not have ram_addrs, so this is a better name.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: abstract address space operations
Avi Kivity [Tue, 26 Jul 2011 11:26:05 +0000 (14:26 +0300)]
memory: abstract address space operations

Prepare for multiple address space support by abstracting away the details
of registering a memory range with qemu's flat representation into an
AddressSpace object.

Note operations which are memory specific are not abstracted, since they will
never be called on I/O address spaces anyway.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoInternal interfaces for memory API
Avi Kivity [Tue, 26 Jul 2011 11:26:04 +0000 (14:26 +0300)]
Internal interfaces for memory API

get_system_memory() provides the root of the memory hierarchy.

This interface is intended to be private between memory.c and exec.c.
If this file is included elsewhere, it should be regarded as a bug (or
TODO item).  However, it will be temporarily needed for the conversion
to hierarchical memory routing.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: merge adjacent segments of a single memory region
Avi Kivity [Tue, 26 Jul 2011 11:26:03 +0000 (14:26 +0300)]
memory: merge adjacent segments of a single memory region

Simple implementations of memory routers, for example the Cirrus VGA memory banks
or the 440FX PAM registers can generate adjacent memory regions which are contiguous.
Detect these and merge them; this saves kvm memory slots and shortens lookup times.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomemory: implement dirty tracking
Avi Kivity [Tue, 26 Jul 2011 11:26:02 +0000 (14:26 +0300)]
memory: implement dirty tracking

Currently dirty tracking is implemented by passing through
all calls to the underlying cpu_physical_memory_*() calls.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoHierarchical memory region API
Avi Kivity [Tue, 26 Jul 2011 11:26:01 +0000 (14:26 +0300)]
Hierarchical memory region API

The memory API separates the attributes of a memory region (its size, how
reads or writes are handled, dirty logging, and coalescing) from where it
is mapped and whether it is enabled.  This allows a device to configure
a memory region once, then hand it off to its parent bus to map it according
to the bus configuration.

Hierarchical registration also allows a device to compose a region out of
a number of sub-regions with different properties; for example some may be
RAM while others may be MMIO.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd memory API documentation
Avi Kivity [Tue, 26 Jul 2011 11:26:00 +0000 (14:26 +0300)]
Add memory API documentation

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqdev: Reset hot-plugged devices
Jan Kiszka [Sun, 24 Jul 2011 17:38:36 +0000 (19:38 +0200)]
qdev: Reset hot-plugged devices

Device models rely on the core invoking their reset handlers after init.
We do this in the cold-plug case, but so far we miss this step after
hot-plug.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoxen_mapcache: remove unused variable
Juan Quintela [Mon, 11 Jul 2011 16:15:11 +0000 (18:15 +0200)]
xen_mapcache: remove unused variable

Signed-off-by: Juan Quintela <quintela@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMakefile: add missing deps on $(GENERATED_HEADERS)
Michael Roth [Tue, 26 Jul 2011 16:39:24 +0000 (11:39 -0500)]
Makefile: add missing deps on $(GENERATED_HEADERS)

This fixes a build issue with make -j6+ due to qapi-generated files
being built before $(GENERATED_HEADERS) have been created.

Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqmp: fix efect -> effect typo in qmp-commands.hx
Zhi Yong Wu [Wed, 27 Jul 2011 06:32:56 +0000 (14:32 +0800)]
qmp: fix efect -> effect typo in qmp-commands.hx

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoslirp: Fix unusual "comments" in unused code
Stefan Weil [Thu, 21 Jul 2011 19:46:45 +0000 (21:46 +0200)]
slirp: Fix unusual "comments" in unused code

cppcheck detected two rather strange comments which were not
correctly written as C comments.

They did not cause any harm because they were framed by
#ifdef notdef ... #endif, so they were never compiled.

Fix them nevertheless (we could also remove the unused code).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMakefile: Minor cscope fixups
Alexandre Raymond [Thu, 21 Jul 2011 03:12:15 +0000 (23:12 -0400)]
Makefile: Minor cscope fixups

Create cscope symbols for assembly files in addition to .c/.h files.
Create cscope database with full path instead of relative path so cscope
can be used with CSCOPE_DB in any directory.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agovhost build fix for i386
Wolfgang Mauerer [Mon, 11 Jul 2011 12:57:43 +0000 (14:57 +0200)]
vhost build fix for i386

vhost.c uses __sync_fetch_and_and(), which is only
available for -march=i486 and above (see
https://bugzilla.redhat.com/show_bug.cgi?id=624279).

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agolibcacard: add pc file, install it + includes
Alon Levy [Mon, 27 Jun 2011 09:58:20 +0000 (11:58 +0200)]
libcacard: add pc file, install it + includes

Additionally:
 + add --includedir configure parameters
 + make install-libcacard install vscclient as well

12 years agoxen: implement unplug protocol in xen_platform
Stefano Stabellini [Mon, 18 Jul 2011 06:07:02 +0000 (06:07 +0000)]
xen: implement unplug protocol in xen_platform

The unplug protocol is necessary to support PV drivers in the guest: the
drivers expect to be able to "unplug" emulated disks and nics before
initializing the Xen PV interfaces.
It is responsibility of the guest to make sure that the unplug is done
before the emulated devices or the PV interface start to be used.

We use pci_for_each_device to walk the PCI bus, identify the devices and
disks that we want to disable and dynamically unplug them.

Changes in v2:

- use PCI_CLASS constants;

- replace pci_unplug_device with qdev_unplug;

- do not import hw/ide/internal.h in xen_platform.c;

Changes in v3:

- introduce piix3-ide-xen, that support hot-unplug;

- move the unplug code to hw/ide/piix.c;

- just call qdev_unplug from xen_platform.c to unplug the IDE disks;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>