sdk/emulator/qemu.git
13 years agox86: fix daa opcode for al register values higher than 0xf9
Boris Figovsky [Tue, 30 Aug 2011 07:00:55 +0000 (10:00 +0300)]
x86: fix daa opcode for al register values higher than 0xf9

The second if statement should consider the original al register value,
and not the new one.

Signed-off-by: Boris Figovsky <boris.figovksy@ravellosystems.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agosh4: Fix potential crash in debug code
Stefan Weil [Wed, 20 Jul 2011 18:56:35 +0000 (20:56 +0200)]
sh4: Fix potential crash in debug code

cppcheck reports this error:

qemu/hw/sh_intc.c:390: error: Possible null pointer dereference:
 s - otherwise it is redundant to check if s is null at line 385

If s were NULL, the printf() statement would crash.
Setting braces fixes this bug.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 1 Sep 2011 18:57:19 +0000 (13:57 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/core' into staging
Anthony Liguori [Thu, 1 Sep 2011 18:55:58 +0000 (13:55 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/core' into staging

13 years agobuild: sort objects to remove duplicates for link
Stefan Hajnoczi [Thu, 25 Aug 2011 08:18:52 +0000 (09:18 +0100)]
build: sort objects to remove duplicates for link

Avoid duplicate object files during the link.  There are legitimate
cases where a link command-line would include duplicate object files
because two independent subsystems both depend on common infrastructure.

Use GNU make's $(sort) function to remove duplicate object files from
the link command-line.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomain: switch qemu_set_fd_handler to g_io_add_watch
Anthony Liguori [Mon, 22 Aug 2011 13:12:53 +0000 (08:12 -0500)]
main: switch qemu_set_fd_handler to g_io_add_watch

This patch changes qemu_set_fd_handler to be implemented in terms of
g_io_add_watch().  The semantics are a bit different so some glue is required.

qemu_set_fd_handler2 is much harder to convert because of its use of polling.

The glib main loop has the major of advantage of having a proven thread safe
architecture.  By using the glib main loop instead of our own, it will allow us
to eventually introduce multiple I/O threads.

I'm pretty sure that this will work on Win32, but I would appreciate some help
testing.  I think the semantics of g_io_channel_unix_new() are really just tied
to the notion of a "unix fd" and not necessarily unix itself.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoAdd glib support to main loop
Anthony Liguori [Mon, 22 Aug 2011 13:12:52 +0000 (08:12 -0500)]
Add glib support to main loop

This allows GSources to be used to register callback events in QEMU.  This is
useful as it allows us to take greater advantage of glib and also because it
allows us to write code that is more easily testable outside of QEMU since we
can make use of glib's main loop in unit tests.

All new code should use glib's callback mechanisms for registering fd events
which are very well documented at:

http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html

And:

http://developer.gnome.org/gio/stable/

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agotcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings
Peter Maydell [Thu, 1 Sep 2011 15:45:01 +0000 (16:45 +0100)]
tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings

Move the declaration and initialisation of some variables in
tcg_out_qemu_ld and tcg_out_qemu_st inside CONFIG_SOFTMMU, to
avoid the "variable set but not used" warning of gcc 4.6.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: malc <av1474@comtv.ru>
13 years agotusb6010: Convert to qdev
Peter Maydell [Tue, 30 Aug 2011 17:36:56 +0000 (18:36 +0100)]
tusb6010: Convert to qdev

Convert the tusb6010 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: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomemory: Fix memory_region_get_ram_ptr for ROM devices
Jan Kiszka [Mon, 29 Aug 2011 22:38:24 +0000 (00:38 +0200)]
memory: Fix memory_region_get_ram_ptr for ROM devices

Mask out the sub-page bits that are used by ROM device for storing the
io-index and the IO_MEM_ROMD flag.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoMerge branch 'omap-for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm...
Edgar E. Iglesias [Mon, 29 Aug 2011 21:59:06 +0000 (23:59 +0200)]
Merge branch 'omap-for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm into pm

13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 29 Aug 2011 14:57:06 +0000 (09:57 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm/memory/core' into staging
Anthony Liguori [Mon, 29 Aug 2011 13:48:43 +0000 (08:48 -0500)]
Merge remote-tracking branch 'qemu-kvm/memory/core' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm/memory/urgent' into staging
Anthony Liguori [Mon, 29 Aug 2011 13:48:28 +0000 (08:48 -0500)]
Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging

13 years agoMerge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Mon, 29 Aug 2011 13:48:15 +0000 (08:48 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging

13 years agoMerge remote-tracking branch 'qmp/queue/monitor' into staging
Anthony Liguori [Mon, 29 Aug 2011 13:48:07 +0000 (08:48 -0500)]
Merge remote-tracking branch 'qmp/queue/monitor' into staging

13 years agoqemu-img: Require larger zero areas for sparse handling
Kevin Wolf [Fri, 26 Aug 2011 13:27:13 +0000 (15:27 +0200)]
qemu-img: Require larger zero areas for sparse handling

By default, require 4k of consecutive zero bytes for qemu-img to make the
output file sparse by not issuing a write request for the zeroed parts. Add an
-S option to allow users to tune this setting.

This helps to avoid situations where a lot of zero sectors and data sectors are
mixed and qemu-img tended to issue many tiny 512 byte writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFix spelling in comments and debug messages (recieve -> receive)
Stefan Weil [Sun, 28 Aug 2011 19:45:40 +0000 (21:45 +0200)]
Fix spelling in comments and debug messages (recieve -> receive)

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agohw/pci-stub: fix comment typo
Alon Levy [Fri, 26 Aug 2011 19:06:01 +0000 (22:06 +0300)]
hw/pci-stub: fix comment typo

[Stefan fixed "doesn't" -> "don't"]

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agomemory: fix rom_device I/O mode
Avi Kivity [Mon, 29 Aug 2011 06:12:49 +0000 (09:12 +0300)]
memory: fix rom_device I/O mode

When adding a rom_device in I/O mode, we incorrectly masked off the low
bits, resulting in a pure RAM map.  Fix my masking off the high bits and
IO_MEM_ROMD, yielding a pure I/O map.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap_gpmc: Implement prefetch engine
Peter Maydell [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
omap_gpmc: Implement prefetch engine

This commit implements the prefetch engine feature of the GPMC
which can be used for NAND devices. This includes both interrupt
driven and DMA-filling modes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap: Wire up the DMA request line to the GPMC
Peter Maydell [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
omap: Wire up the DMA request line to the GPMC

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Pull prefetch engine data into sub-struct
Peter Maydell [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
omap_gpmc: Pull prefetch engine data into sub-struct

Refactor the gpmc state structure so items relating to
the prefetch engine are in their own sub-struct and have
more useful names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Accept a zero mask field on omap3630
Juha Riihimäki [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
omap_gpmc: Accept a zero mask field on omap3630

OMAP3630 adds an extra bit of address masking, so a mask of
0xb1111 is valid. Unfortunately the GPMC_REVISION is the same as
on the OMAP3430 which only has three bits of address masking, so
we have to derive this feature directly from the OMAP revision
rather than from the GPMC revision.

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>
13 years agohw/omap.h: Add OMAP 3630 to omap_mpu_model enumeration
Peter Maydell [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
hw/omap.h: Add OMAP 3630 to omap_mpu_model enumeration

Add the OMAP 3630 to the omap_mpu_model enumeration, and add the
corresponding cpu_is_omap3630() function.

(OMAP3 isn't supported yet but this is useful in upgrading common
components to be "OMAP3 ready". We already have this for OMAP3430.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Support NAND devices
Peter Maydell [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Support NAND devices

Support accesses to NAND devices, both by mapping them into
the GPMC address space, and via the NAND_COMMAND, NAND_ADDRESS
and NAND_DATA GPMC registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Reindent misindented switch statements
Peter Maydell [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Reindent misindented switch statements

Whitespace-only change fixing indentation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Calculate revision from OMAP model
Juha Riihimäki [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Calculate revision from OMAP model

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>
13 years agoomap_gpmc: Take omap_mpu_state* in omap_gpmc_init
Juha Riihimäki [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Take omap_mpu_state* in omap_gpmc_init

Take a pointer to the omap mpu state struct in omap_gpmc_init.
Some details of GPMC behaviour depend on the OMAP version we
are a part of.

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>
13 years agoomap_gpmc: Fix handling of FIFOTHRESHOLDSTATUS bit
Peter Maydell [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Fix handling of FIFOTHRESHOLDSTATUS bit

The OMAP3 TRM is inconsistent about whether the GPMC FIFOTHRESHOLDSTATUS
bit should be set when FIFOPOINTER > FIFOTHRESHOLD or when it is >=
FIFOTHRESHOLD. Apparently the underlying functional spec from which
the TRM was created states that the behaviour is ">=", and this also
makes more conceptual sense.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Wire up the GPMC IRQ correctly
Peter Maydell [Sun, 28 Aug 2011 16:22:18 +0000 (16:22 +0000)]
omap_gpmc: Wire up the GPMC IRQ correctly

The omap_gpmc wasn't actually wiring up its IRQ, so
anything that provoked an interrupt would be using
uninitialised data for its IRQ number.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: GPMC_IRQSTATUS is write-one-to-clear
Peter Maydell [Sun, 28 Aug 2011 16:22:18 +0000 (16:22 +0000)]
omap_gpmc: GPMC_IRQSTATUS is write-one-to-clear

Fix a bug in the handling of writes to GPMC_IRQSTATUS:
it behaves as "write one to clear, writing zero is ignored".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Refactor omap_gpmc_cs_map and omap_gpmc_cs_unmap
Peter Maydell [Sun, 28 Aug 2011 16:22:18 +0000 (16:22 +0000)]
omap_gpmc: Refactor omap_gpmc_cs_map and omap_gpmc_cs_unmap

Refactor the omap_gpmc_cs_map/unmap functions:
 * take the omap_gpmc_s* and a chipselect id rather than the
   omap_gpmc_cs_file_s*, so they have access to the general gpmc
   member fields
 * extract the base and mask from the config registers in the functions
   rather than at every callsite
 * check for CSVALID in the functions rather than at every callsite

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agoomap_gpmc: Clean up omap_gpmc_attach MemoryRegion conversion
Peter Maydell [Sun, 28 Aug 2011 16:22:18 +0000 (16:22 +0000)]
omap_gpmc: Clean up omap_gpmc_attach MemoryRegion conversion

Now that all callers of omap_gpmc_attach pass in a MemoryRegion*,
we can remove the base_update and unmap function pointer arguments,
and the opaque pointer that was passed into these callbacks.

We can also remove the base and size fields from omap_gpmc_cs_file_s
as these are no longer necessary (you don't need the base/size
to unmap a MemoryRegion the way you did to undo a mapping made
with cpu_register_physical_memory()).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agohw/onenand: Minor spacing fixes
Juha Riihimäki [Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)]
hw/onenand: Minor spacing fixes

Minor whitespace-only cleanup (separated out from the qdevifying
patch for clarity).

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>
13 years agohw/onenand: Qdevify
Juha Riihimäki [Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)]
hw/onenand: Qdevify

Qdevify the ONENAND 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>
13 years agohw/onenand: Remove unnecessary argument from onenand_command()
Juha Riihimäki [Sun, 28 Aug 2011 16:33:02 +0000 (16:33 +0000)]
hw/onenand: Remove unnecessary argument from onenand_command()

Refactor onenand_command() -- since it is essentially a method of
the device object, it doesn't make sense to pass in something as
an argument which is one of the object's own member fields.

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>
13 years agohw/sysbus: Add sysbus_mmio_get_region()
Peter Maydell [Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)]
hw/sysbus: Add sysbus_mmio_get_region()

Add a sysbus_mmio_get_region() which allows users of sysbus
devices to turn a (SysBusDevice*, mmioidx) tuple into a
MemoryRegion*. This enables some useful simplifications of
devices which pass through another device's mmio region
(either directly or by implementing some kind of memory
controller device).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agosh_pci: Fix sh_pci memory alias confusion
Avi Kivity [Sun, 28 Aug 2011 15:17:04 +0000 (18:17 +0300)]
sh_pci: Fix sh_pci memory alias confusion

The a7 area was set up as an alias of itself, rather than the p4 area.  This
sent the memory core into infinite recursion.

Fix by aliasing the a7 area to the p4 area.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoFix disabling interrupts in sun4u
Artyom Tarasenko [Mon, 25 Jul 2011 17:22:38 +0000 (19:22 +0200)]
Fix disabling interrupts in sun4u

clear interrupt request if the interrupt priority < CPU pil
clear hardware interrupt request if interrupts are disabled

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
[blauwirbel@gmail.com: added a comment about magic 2]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoxilinx: Convert most xilinx devices to MemoryRegion
Edgar E. Iglesias [Thu, 25 Aug 2011 22:13:47 +0000 (00:13 +0200)]
xilinx: Convert most xilinx devices to MemoryRegion

This converts ethlite, intc, timer and uartlite to use
MemoryRegions.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoTCG: improve optimizer debugging
Blue Swirl [Sat, 30 Jul 2011 19:18:32 +0000 (19:18 +0000)]
TCG: improve optimizer debugging

Use enum TCGOpcode instead of plain old int so that the name of
current op can be seen in GDB. Add a default case to switch
so that GCC does not complain about unhandled enum cases.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodyngen-exec.h: cleanup
Blue Swirl [Sat, 30 Jul 2011 15:50:22 +0000 (15:50 +0000)]
dyngen-exec.h: cleanup

Remove unused or otherwise available stuff.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agog364fb: convert to qdev
Hervé Poussineau [Fri, 26 Aug 2011 19:20:12 +0000 (21:20 +0200)]
g364fb: convert to qdev

Extract G364 ROM contents from device emulation to machine emulation,
so device emulation can be reused in other machines (Commodore Amiga)

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agog364fb: use trace framework
Hervé Poussineau [Fri, 26 Aug 2011 19:20:11 +0000 (21:20 +0200)]
g364fb: use trace framework

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agocheckpatch: fix braces {} handling
Pavel Borzenkov [Fri, 26 Aug 2011 13:34:37 +0000 (17:34 +0400)]
checkpatch: fix braces {} handling

checkpatch.pl doesn't report warning for if/else statements with missing
'else' braces:

if (something) {
    foo;
} else
    bar;

The patch has been tested using the last 100 commits.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoFix linker scripts
Gerd Hoffmann [Fri, 26 Aug 2011 09:16:10 +0000 (11:16 +0200)]
Fix linker scripts

Remove PROVIDE_HIDDEN and ONLY_IF_{RO,RW} from linker scripts to make
them work with older binutils versions.  Fixes *-bsd-user build on
OpenBSD 4.9 which ships binutils 2.15.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoFix build on OpenBSD with BSD userland emu and smartcard NSS enabled
Brad [Mon, 22 Aug 2011 20:39:59 +0000 (16:39 -0400)]
Fix build on OpenBSD with BSD userland emu and smartcard NSS enabled

The first issue is the hard coded POSIX Real Time extensions library in the
libcacard/Makefile. From looking at the code it doesn't seem this is necessary
anyway. Robert Relyea seems to think it most likely isn't necessary.

The second issue was the missing exclusion of the BSD userland binary
builds from the addition of this Makefile target for the smartcard NSS
code which breaks the builds if smartcard NSS support is enabled.

pastebin clip of the build failure..

http://pastebin.com/raw.php?i=BLCKd3s6

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoblock: latency accounting
Christoph Hellwig [Thu, 25 Aug 2011 06:26:10 +0000 (08:26 +0200)]
block: latency accounting

Account the total latency for read/write/flush requests.  This allows
management tools to average it based on a snapshot of the nr ops
counters and allow checking for SLAs or provide statistics.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovhost-net: cleanup host notifiers at last step
Michael S. Tsirkin [Thu, 11 Aug 2011 07:21:18 +0000 (10:21 +0300)]
vhost-net: cleanup host notifiers at last step

When the vhost notifier is disabled, the userspace handler runs
immediately: virtio_pci_set_host_notifier_internal might
call virtio_queue_notify_vq.
Since the VQ state and the tap backend state aren't
recovered yet, this causes
"Guest moved used index from XXX to YYY" assertions.

The solution is to split out host notifier handling
from vhost VQ setup and disable notifiers as our last step
when we stop vhost-net. For symmetry enable them first thing
on start.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agolinux-user: Correct a few missuses of host addresses
Edgar E. Iglesias [Mon, 22 Aug 2011 16:44:58 +0000 (18:44 +0200)]
linux-user: Correct a few missuses of host addresses

Fix a few cases where we were passing host pointers to the
guest.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomemory: add opaque parameter to memory_region_init_rom_device()
Avi Kivity [Thu, 25 Aug 2011 21:35:15 +0000 (00:35 +0300)]
memory: add opaque parameter to memory_region_init_rom_device()

The MemoryRegionOps callbacks expect it.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomicroblaze: Add an MSR_PVR constant and use it.
Edgar E. Iglesias [Thu, 25 Aug 2011 06:41:19 +0000 (16:41 +1000)]
microblaze: Add an MSR_PVR constant and use it.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agomicroblaze: Make the MSR PVR bit non writable
Edgar E. Iglesias [Thu, 25 Aug 2011 06:41:18 +0000 (16:41 +1000)]
microblaze: Make the MSR PVR bit non writable

Instead of hardcoding it to 1.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agoRevert "Merge remote-tracking branch 'qemu-kvm/memory/batch' into staging"
Anthony Liguori [Thu, 25 Aug 2011 19:39:18 +0000 (14:39 -0500)]
Revert "Merge remote-tracking branch 'qemu-kvm/memory/batch' into staging"

This reverts commit 8ef9ea85a2cc1007eaefa53e6871f1f83bcef22d, reversing
changes made to 444dc48298c480e42e15a8fe676be737d8a6b2a1.

From Avi:

  Please revert the entire pull (git revert 8ef9ea85a2cc1) while I work this
  out - it isn't trivial.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovga: Silence bogus gcc warning about uninitialized variables
Jan Kiszka [Thu, 25 Aug 2011 09:10:13 +0000 (11:10 +0200)]
vga: Silence bogus gcc warning about uninitialized variables

Some gcc versions do not properly detect that all possible cases are
covered and base and size are always initialized. Please gcc by defining
a pseudo default case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoblock: explicit I/O accounting
Christoph Hellwig [Thu, 25 Aug 2011 06:26:01 +0000 (08:26 +0200)]
block: explicit I/O accounting

Decouple the I/O accounting from bdrv_aio_readv/writev/flush and
make the hardware models call directly into the accounting helpers.

This means:
 - we do not count internal requests from image formats in addition
   to guest originating I/O
 - we do not double count I/O ops if the device model handles it
   chunk wise
 - we only account I/O once it actuall is done
 - can extent I/O accounting to synchronous or coroutine I/O easily
 - implement I/O latency tracking easily (see the next patch)

I've conveted the existing device model callers to the new model,
device models that are using synchronous I/O and weren't accounted
before haven't been updated yet.  Also scsi hasn't been converted
to the end-to-end accounting as I want to defer that after the pending
scsi layer overhaul.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agomonitor: fix build breakage for !CONFIG_VNC
Jamie Iles [Wed, 10 Aug 2011 14:18:42 +0000 (15:18 +0100)]
monitor: fix build breakage for !CONFIG_VNC

Commit c62f6d1 (monitor: fix build breakage with --disable-vnc)
conditionalised some VNC setup code but left an unused variable.  Move
the variable into the conditional code to fix the build breakage.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
13 years agoqcow2: remove unused qcow2_create_refcount_update function
Frediano Ziglio [Thu, 25 Aug 2011 07:29:32 +0000 (09:29 +0200)]
qcow2: remove unused qcow2_create_refcount_update function

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: use always stderr for debugging
Frediano Ziglio [Thu, 25 Aug 2011 07:23:55 +0000 (09:23 +0200)]
qcow2: use always stderr for debugging

let all DEBUG_ALLOC2 printf goes to stderr

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 25 Aug 2011 12:50:07 +0000 (07:50 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm/memory/batch' into staging
Anthony Liguori [Thu, 25 Aug 2011 12:48:24 +0000 (07:48 -0500)]
Merge remote-tracking branch 'qemu-kvm/memory/batch' into staging

13 years agoMerge remote-tracking branch 'aneesh/for-upstream-2' into staging
Anthony Liguori [Thu, 25 Aug 2011 12:48:15 +0000 (07:48 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream-2' into staging

13 years agomemory: fix memory_region_init_rom_device() not initializing ->ops
Avi Kivity [Thu, 25 Aug 2011 11:56:14 +0000 (14:56 +0300)]
memory: fix memory_region_init_rom_device() not initializing ->ops

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agodisasm: update comment
Frediano Ziglio [Thu, 25 Aug 2011 07:14:38 +0000 (09:14 +0200)]
disasm: update comment

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoFix up some style nits of last uq/master merge
Jan Kiszka [Mon, 15 Aug 2011 23:24:48 +0000 (16:24 -0700)]
Fix up some style nits of last uq/master merge

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agomilkymist: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:42:57 +0000 (21:42 +0300)]
milkymist: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomilkymist-softusb: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:40:35 +0000 (21:40 +0300)]
milkymist-softusb: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomilkymist-minimac2: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:32:25 +0000 (21:32 +0300)]
milkymist-minimac2: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomcf5208: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:21:47 +0000 (21:21 +0300)]
mcf5208: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomainstone: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:08:45 +0000 (21:08 +0300)]
mainstone: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agolm32_boards: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:05:07 +0000 (21:05 +0300)]
lm32_boards: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agog364fb: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:01:16 +0000 (21:01 +0300)]
g364fb: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agodummy_m68k: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 17:44:23 +0000 (20:44 +0300)]
dummy_m68k: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopflash_cfi01/pflash_cfi02: convert to memory API
Avi Kivity [Thu, 4 Aug 2011 12:55:30 +0000 (15:55 +0300)]
pflash_cfi01/pflash_cfi02: convert to memory API

cfi02 is annoying in that is ignores some address bits; we probably
want explicit support in the memory API for that.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoMakefile.hw: allow hw/ files to include glib headers
Avi Kivity [Wed, 3 Aug 2011 15:55:00 +0000 (18:55 +0300)]
Makefile.hw: allow hw/ files to include glib headers

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopiix_pci: wrap memory update in a transaction
Avi Kivity [Mon, 1 Aug 2011 08:04:39 +0000 (11:04 +0300)]
piix_pci: wrap memory update in a transaction

The code will remap all PAMs, even if just one is updated, resulting
in reduced performance.  Wrap in a transaction to detect that those
other PAMs have not changed.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agocirrus: wrap memory update in a transaction
Avi Kivity [Mon, 1 Aug 2011 08:03:42 +0000 (11:03 +0300)]
cirrus: wrap memory update in a transaction

This prevents spurious unmapping and remapping of the vga windows,
which reduces performance.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoleon3: convert to memory API
Avi Kivity [Mon, 25 Jul 2011 12:07:22 +0000 (15:07 +0300)]
leon3: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agointegratorcp: convert to memory API (RAM/flash only)
Avi Kivity [Mon, 25 Jul 2011 12:03:19 +0000 (15:03 +0300)]
integratorcp: convert to memory API (RAM/flash only)

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosysbus: add sysbus_add_memory_overlap()
Avi Kivity [Mon, 25 Jul 2011 12:02:17 +0000 (15:02 +0300)]
sysbus: add sysbus_add_memory_overlap()

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoaxis_dev88: convert to memory API (RAM only)
Avi Kivity [Mon, 25 Jul 2011 11:32:34 +0000 (14:32 +0300)]
axis_dev88: convert to memory API (RAM only)

Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoppc_oldworld, ppc_newworld: fix escc BAR related crash
Avi Kivity [Wed, 24 Aug 2011 18:37:05 +0000 (21:37 +0300)]
ppc_oldworld, ppc_newworld: fix escc BAR related crash

ppc maps the escc mmio region both at a fixed offset (as a sysbus area) and as part of a PCI BAR.
This crashes, since a MemoryRegion may have only one parent.  Use an alias so we have a separate
MemoryRegion for the BAR.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agogt64xxx: fix crash in gt64120_pci_mapping()
Avi Kivity [Wed, 24 Aug 2011 19:09:41 +0000 (22:09 +0300)]
gt64xxx: fix crash in gt64120_pci_mapping()

The map/unmap code was assymetric - unmap used the local MemoryRegion while
map used isa_mmio_init(), which cannot handle dynamic mappings.

Fix by using isa_mmio_setup() and the local MemoryRegion.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoarmv7m: convert to memory API
Avi Kivity [Mon, 25 Jul 2011 11:27:01 +0000 (14:27 +0300)]
armv7m: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoan5206: convert to memory API
Avi Kivity [Mon, 25 Jul 2011 11:14:31 +0000 (14:14 +0300)]
an5206: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoReadWriteHandler: remove
Avi Kivity [Sun, 24 Jul 2011 16:27:24 +0000 (19:27 +0300)]
ReadWriteHandler: remove

No longer used.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopci_host: convert conf index and data ports to memory API
Avi Kivity [Sun, 24 Jul 2011 14:47:18 +0000 (17:47 +0300)]
pci_host: convert conf index and data ports to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosysbus: add helpers to add and delete memory regions to the system bus
Avi Kivity [Sun, 24 Jul 2011 14:12:11 +0000 (17:12 +0300)]
sysbus: add helpers to add and delete memory regions to the system bus

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agostellaris_enet: convert to memory API
Avi Kivity [Mon, 18 Jul 2011 08:58:50 +0000 (11:58 +0300)]
stellaris_enet: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosheepdog: use coroutines
MORITA Kazutaka [Fri, 12 Aug 2011 12:33:15 +0000 (21:33 +0900)]
sheepdog: use coroutines

This makes the sheepdog block driver support bdrv_co_readv/writev
instead of bdrv_aio_readv/writev.

With this patch, Sheepdog network I/O becomes fully asynchronous.  The
block driver yields back when send/recv returns EAGAIN, and is resumed
when the sheepdog network connection is ready for the operation.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agopci: Error on PCI capability collisions
Jan Kiszka [Wed, 24 Aug 2011 12:29:30 +0000 (14:29 +0200)]
pci: Error on PCI capability collisions

Nothing good can happen when we overlap capabilities. This may happen
when plugging in assigned devices or when devices models contain bugs.
Detect the overlap and report it.

Based on qemu-kvm commit by Alex Williamson.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Don Dutile <ddutile@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopcie/aer: fix inject aer error command
Isaku Yamahata [Fri, 5 Aug 2011 09:22:06 +0000 (18:22 +0900)]
pcie/aer: fix inject aer error command

various fixes to make aer inject error command work.
- wrong assert
- command line parser
- err.status needs initialization

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopcie/slot: fix hotplug event
Isaku Yamahata [Fri, 5 Aug 2011 09:22:03 +0000 (18:22 +0900)]
pcie/slot: fix hotplug event

When slot status register is cleared, PCIDevice::exp.hpev_notify
needs to be cleared.
Otherwise, PCIDevice::exp.hpev_notify is never set to false resulting
in no more hot plug event once it's raised.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoPPC: E500: Set ESR values
Alexander Graf [Tue, 23 Aug 2011 04:55:44 +0000 (06:55 +0200)]
PPC: E500: Set ESR values

When an exception occurs on BookE, we need to set ESR bits to expose
to the guest information on what exactly happened. Add the obvious ones.

Reported-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoPPC: E500: Inject SPE exception on invalid SPE access
Alexander Graf [Tue, 23 Aug 2011 04:55:43 +0000 (06:55 +0200)]
PPC: E500: Inject SPE exception on invalid SPE access

When accessing an SPE instruction despite it being not available,
throw an SPE exception instead of an APU exception. That way the
guest knows what's going on and actually uses SPE.

Reported-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoPPC: E500: Add ESR bit definitions
Alexander Graf [Tue, 23 Aug 2011 04:55:42 +0000 (06:55 +0200)]
PPC: E500: Add ESR bit definitions

The BookE spec specifies a number of ESR bits. Add defines for them
so we can use them later on.

Reported-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agohw/omap_gpmc: Don't try to map CS0 twice on reset
Peter Maydell [Tue, 23 Aug 2011 18:24:32 +0000 (19:24 +0100)]
hw/omap_gpmc: Don't try to map CS0 twice on reset

Remove a spurious second map of the OMAP GPMC CS0 region on reset.
This fixes an assertion failure when we try to add the region to
its container when it was already added. (The old code did not
complain about mismatched map/unmap calls, but the new MemoryRegion
implementation does.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agotcg: Update --enable-debug for TCG_OPF_NOT_PRESENT.
Richard Henderson [Tue, 23 Aug 2011 17:43:32 +0000 (10:43 -0700)]
tcg: Update --enable-debug for TCG_OPF_NOT_PRESENT.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoqcow2: remove memory leak
Frediano Ziglio [Tue, 23 Aug 2011 13:21:20 +0000 (15:21 +0200)]
qcow2: remove memory leak

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>