]> git.proxmox.com Git - qemu.git/log
qemu.git
13 years agotcg/arm: Support host code being compiled for Thumb
Peter Maydell [Wed, 16 Mar 2011 15:21:31 +0000 (15:21 +0000)]
tcg/arm: Support host code being compiled for Thumb

Although the TCG generated code is always in ARM mode, it is possible
that the host code was compiled by gcc in Thumb mode (this is often the
default for Linux distributions targeting ARM v7 only). Handle this
by using BLX imm when doing a call from ARM into Thumb mode.
Since BLX imm is not a conditionalisable instruction, we make
tcg_out_call() no longer take a condition code; we were only ever
using it with COND_AL anyway.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
13 years agoRevert "x86: Save/restore PAT MSR"
Anthony Liguori [Tue, 22 Mar 2011 12:58:52 +0000 (07:58 -0500)]
Revert "x86: Save/restore PAT MSR"

This reverts commit c995b495b9d6e60ab1e390bd398a22425d0b3c8c.

From Jan Kiszka:

 Ouch, indeed. Moreover, CPU_SAVE_VERSION was not updated (likely the
 reason for the breakage). Thanks for debugging this!

 Anthony (or whoever), please revert this unneeded commit in qemu.git.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovnc: fix build error from VNC_DIRTY_WORDS
Anthony Liguori [Tue, 22 Mar 2011 16:27:33 +0000 (11:27 -0500)]
vnc: fix build error from VNC_DIRTY_WORDS

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agofix vnc regression
Wen Congyang [Fri, 11 Mar 2011 09:10:32 +0000 (17:10 +0800)]
fix vnc regression

This patch fix the following regression:
1. we should use bitmap_set() and bitmap_clear() to replace vnc_set_bits().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqmp-commands.hx: Clean up mess of client_migrate_info
Jes Sorensen [Wed, 9 Mar 2011 13:31:06 +0000 (14:31 +0100)]
qmp-commands.hx: Clean up mess of client_migrate_info

client_migrate_info was put into qmp-commands.hx in the middle of
migrate_set_speed, between the command and it's description. In
addition client_migrate_info put the description before the command
itself, which is the wrong order.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoMake VNC support optional
Jes Sorensen [Wed, 16 Mar 2011 12:33:36 +0000 (13:33 +0100)]
Make VNC support optional

Per default VNC is enabled.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoerror message if user specifies curses on cmd line when curses is disabled
Jes Sorensen [Wed, 16 Mar 2011 12:33:35 +0000 (13:33 +0100)]
error message if user specifies curses on cmd line when curses is disabled

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoerror message if user specifies SDL cmd line option when SDL is disabled
Jes Sorensen [Wed, 16 Mar 2011 12:33:34 +0000 (13:33 +0100)]
error message if user specifies SDL cmd line option when SDL is disabled

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoAdd support for -display vnc
Jes Sorensen [Wed, 16 Mar 2011 12:33:33 +0000 (13:33 +0100)]
Add support for -display vnc

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoIntroduce -display none
Jes Sorensen [Wed, 16 Mar 2011 12:33:32 +0000 (13:33 +0100)]
Introduce -display none

New option -display none. This option differs from -nographic by not
trying to take control of stdio etc. but instead behaves as if a
graphics display is enabled, except that it doesn't show one.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoIntroduce -display argument
Jes Sorensen [Wed, 16 Mar 2011 12:33:31 +0000 (13:33 +0100)]
Introduce -display argument

This patch introduces a -display argument which consolidates the
setting of the display mode. Valid options are:
sdl/curses/default

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoConsolidate DisplaySurface allocation in qemu_alloc_display()
Jes Sorensen [Wed, 16 Mar 2011 12:33:30 +0000 (13:33 +0100)]
Consolidate DisplaySurface allocation in qemu_alloc_display()

This removes various code duplication from console.e and sdl.c

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agotarget-arm: use make_float32() to make constant floats for VRSQRTS
Peter Maydell [Mon, 14 Mar 2011 15:37:13 +0000 (15:37 +0000)]
target-arm: use make_float32() to make constant floats for VRSQRTS

The preferred way to create a constant floating point value is to use
make_float32() rather than doing a runtime int32_to_float32().
Convert the code in the VRSQRTS helper to work this way.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix VRECPS edge cases handling
Peter Maydell [Mon, 14 Mar 2011 15:37:12 +0000 (15:37 +0000)]
target-arm: Fix VRECPS edge cases handling

Correct the handling of edge cases for the VRECPS instruction:
 * this is a Neon instruction so uses the "standard FPSCR value"
 * (zero, inf) is a special case which returns 2.0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix TCG temporary leaks for scalar VMULL
Peter Maydell [Fri, 11 Mar 2011 13:32:34 +0000 (13:32 +0000)]
target-arm: Fix TCG temporary leaks for scalar VMULL

Fix a TCG temporary leak when translating 32-bit scalar VMULL.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Set Q bit for overflow in SMUAD and SMLAD
Peter Maydell [Fri, 11 Mar 2011 10:09:58 +0000 (10:09 +0000)]
target-arm: Set Q bit for overflow in SMUAD and SMLAD

SMUAD and SMLAD are supposed to set the Q bit if the addition of
the two 16x16 multiply products and optional accumulator overflows
considered as a signed value. However we were only doing this check
for the addition of the accumulator, not when adding the products,
with the effect that we were mishandling the edge case where
both inputs are 0x80008000.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix GE bits for v6media signed modulo arithmetic
Peter Maydell [Thu, 10 Mar 2011 18:51:49 +0000 (18:51 +0000)]
target-arm: Fix GE bits for v6media signed modulo arithmetic

Fix the signed modulo arithmetic helpers for the v6media
instructions (SADD8, SSUB8, SADD16, SSUB16, SASX, SSAX) to set
the GE bits correctly (based on the result of the add or subtract
before it is truncated to 16 bits, not after).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix UNDEF cases in Thumb load/store
Peter Maydell [Thu, 10 Mar 2011 16:48:49 +0000 (16:48 +0000)]
target-arm: Fix UNDEF cases in Thumb load/store

Decode of Thumb load/store was merging together the cases of 'bit 11==0'
(reg+reg LSL imm) and 'bit 11==1' (reg+imm). This happens to work for
valid instruction patterns but meant that we would not UNDEF for the
cases the architecture mandates that we must. Make the decode actually
look at bit 11 as well as [10..8] so that we UNDEF in the right places.

This change also removes what was a spurious unreachable 'case 8',
and correctly frees TCG temporaries on the illegal-insn codepaths.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agolinux-user: Fix unlock_user() call in return from poll()
Peter Maydell [Fri, 25 Feb 2011 10:27:40 +0000 (10:27 +0000)]
linux-user: Fix unlock_user() call in return from poll()

Correct the broken attempt to calculate the third argument
to unlock_user() in the code path which unlocked the pollfd
array on return from poll() and ppoll() emulation. (This
only caused a problem if unlock_user() wasn't a no-op, eg
if DEBUG_REMAP is defined.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovmmouse: Register vmstate via qdev
Jan Kiszka [Mon, 21 Mar 2011 09:53:00 +0000 (10:53 +0100)]
vmmouse: Register vmstate via qdev

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovmmouse: Fix initialization
Jan Kiszka [Mon, 21 Mar 2011 09:52:24 +0000 (10:52 +0100)]
vmmouse: Fix initialization

Latest refactorings left vmmouse nonfunctional behind. Fix it by adding
the required device initialization.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovmmouse: Fix typo preventing x86-64 build
Jan Kiszka [Mon, 21 Mar 2011 09:52:10 +0000 (10:52 +0100)]
vmmouse: Fix typo preventing x86-64 build

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agofix applesmc REV key
René Rebe [Mon, 21 Mar 2011 10:33:21 +0000 (11:33 +0100)]
fix applesmc REV key

Fix applesmc REV key string literal hex encoding.

Signed-off-by: René Rebe <rene@exactcode.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoenable kvm for ppc(32) on ppc64
René Rebe [Mon, 21 Mar 2011 10:18:50 +0000 (11:18 +0100)]
enable kvm for ppc(32) on ppc64

ppc64 is backward compatible, likewise.

Signed-off-by: René Rebe <rene@exactcode.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-ppc: add support for 6 SPE instructions
Fabien Chouteau [Wed, 16 Mar 2011 10:21:22 +0000 (11:21 +0100)]
target-ppc: add support for 6 SPE instructions

Add support for 6 SPE instructions: evmra, evmwsmi{a{a}}, evmwumi{a{a}}

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopc-bios: update linuxboot.bin and multiboot.bin
Aurelien Jarno [Tue, 22 Mar 2011 06:03:15 +0000 (07:03 +0100)]
pc-bios: update linuxboot.bin and multiboot.bin

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agofix linuxboot.bin and multiboot.bin to not hijack int19
Gleb Natapov [Mon, 31 Jan 2011 13:11:01 +0000 (15:11 +0200)]
fix linuxboot.bin and multiboot.bin to not hijack int19

Currently linuxboot.bin and multiboot.bin option roms override int19
vector to intercept boot process. No sane option rom should do that.
Provide bev entry instead that will be called by BIOS if option rom
is selected for booting.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMerge remote branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 21 Mar 2011 22:42:20 +0000 (17:42 -0500)]
Merge remote branch 'qemu-kvm/uq/master' into staging

13 years agoseabios: update to latest git
Anthony Liguori [Tue, 15 Mar 2011 16:22:12 +0000 (11:22 -0500)]
seabios: update to latest git

 - cc97564 Add config option to permit running option roms with bad checksums.
 - 424f217 Add config option to disable MTRR initialization.
 - fb2f10d Prep version for next release.
 - f18b09b Update version to 0.6.2
 - 20fcf9b lets pretend that RTC can be used to wakeup from S4
 - 1efb10b Expand user configurable parameters in Kconfig.
 - 3dba4c2 Support non-local build directory - allow "make OUT=abc/" to work.
 - 42d9771 The vgabios build must depend on autoconf.h.
 - 32aa9f3 fix parallel compilation of SeaBIOS
 - 713be89 Start using Kconfig to configure SeaBIOS settings.
 - b623e7c Change kconfig to emit disabled symbols in autoconf.h.
 - 0da7bfd Build changes for Linux kconfig code to work in seabios dir structure.
 - a4c5daf Initial commit of Kconfig build tool.
 - 4d0c592 Minor boot fixes.
 - 812478e Minor comment / code layout improvement to romlayout.S.
 - 6fc7cf1 Fix to prevent infinite loop in build_pci_path().
 - f5154e2 support T13 EDD3.0 spec
 - d08eb9c Add ability to track PCI paths and add to build_pci_path().
 - 89a1efd Move the CBFS payload setup to later in the boot.
 - 9e881a3 Extract space trimming code from ATA and use in USB and bootorder code.
 - 3c241ed seabios: acpi: add _RMV control method for PCI devices
 - c2002a1 Add support for finding the boot priority of USB drives.
 - a5f2b91 Extend 'usb_pipe' to track the controller and ports of each device.
 - 8bf5503 Add functions for boot device path parsing.
 - c4bd3b9 Use bootprio_find_named_rom() for ramdisk and cbfs payload priorities.
 - ca2bc1c Remove drive->desc field.
 - f13a180 Minor reorganization of some of the boot_xxx code in boot.c.
 - 3da2c1c Move IPL.fw_bootorder to static variables in boot.c.
 - 7bb1584 Move IPL.bev to static variables in boot.c
 - baaadb6 Move IPL.checkfloppysig to a global (CheckFloppySig) in boot.c.
 - a0842f8 Remove Drives global struct in favor of independent global variables.
 - ecbcf77 Don't access drive_g->desc from boot_cdrom().
 - 551caa2 Simplify keyboard reading code in the interactive boot menu.
 - 697e63c Call setup_translation() from map_hd_drive().
 - 3c5e0e1 Rename add_ordered_drive() to add_drive() and use in map_hd_drive().
 - 031ef55 Add stubs to permit devices to specify their boot priority.
 - 72eee3e Simplify boot ordering by building an inclusive boot list.
 - ce24be5 Populate drive_g->desc prior to calling add_bcv_internal().
 - 74fd942 pciinit: fix off-by-one
 - 311f887 Minor build fixes.
 - bca3a87 Track the source of each optionrom deployed.
 - c6629e0 Support qemu based romfile wrappers called out of order.
 - d1a1746 Breakup boot_setup() bootorder code into its own function.
 - f9b0930 Add romfile_loadfile() helper function.
 - b9a7591 Read bootorder file into memory.
 - 2e109a6 Add strchr() function.
 - 1703ea2 Add romfile_name() function.
 - b674152 Add BAID for ahci cdrom.
 - f77e179 Provide full EDD 3.0 info for virtio disk
 - 67863be Enhance layoutrom.py to work around a binutils quirk.
 - 4c90a20 Create separate IPL entry for each CD/DVD
 - 0e6f636 ahci: set controller id
 - 1e924bb ahci: fix off-by-one in port count
 - 7eb0222 ahci: enable io/mem/dma
 - c19fc71 ahci: set dma feature flag
 - 80c2b6e Check if capability enabled in XXX_cmd_data functions.
 - f3fe3aa Require a "_cfuncXX_" symbol prefix for inter-mode c function references.
 - d52fdf6 add ahci support
 - 54fa8ec ata: make helpers available
 - 0a80608 util: add memset_fl()
 - f1f18eb pci: add helper functions for mmio bar access from real mode.
 - af9629b Enhance call32() to pass a parameter to called function.
 - 4057f98 Don't pass return address to transition(32,16,16big) on stack.
 - e2623fc pciinit: use pci_region functions.
 - 58a38e8 pci: introduce pci_region to manage pci io/memory/prefmemory regions.
 - 6d5a217 mark irq9 active high in DSDT
 - 9433098 Report meaningful error if pyserial not present in tools/readserial.py
 - 94dc9c4 Show size of non-relocatable runtime code during build.
 - 4d96edc Cleanup - it's no longer necessary to manually reset global variables.
 - a899945 Allow rom to grow to 256K.
 - 4a446d7 Fix typo preventing relocated space from being used for option roms.
 - 0f67397 fix virtio-blk failure after reboot
 - d4bded4 Add a debug method to AML code.
 - 2f96800 Warn that ohci bulk is not supported.
 - e826465 Enable optionroms to use freed space due to CONFIG_RELOCATE_INIT.
 - 7f55fd3 Move the 32bit init code to high memory at runtime.
 - 025cabd Move init code from _start() to post().
 - 12fa24a Add memalign_tmp() helper function.
 - 244caf8 Try to hard-reboot on rerun of post even on emulators.
 - 5bd01de Don't do shadow copying of optionroms when CONFIG_OPTIONROMS_DEPLOYED.
 - adaf373 Try to hard-reboot processor on rerun of post under coreboot.
 - 402fd9c Enhance build to emit relocation information.
 - d1b4f96 Separate out init code from the rest of the 32bit flat code.
 - 1a4885e Modify tools/layoutrom.py to use classes instead of tuples.
 - 6c2e781 Use str.startswith() in python scripts.
 - d9c916e Prep version for next release.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoFix migration uint8 arrys handled
Juan Quintela [Tue, 15 Mar 2011 14:53:25 +0000 (15:53 +0100)]
Fix migration uint8 arrys handled

commit 82fa39b75181b730d6d4d09f443bd26bcfcd045c

only contains half of the fix.  It forgots the save state fix for
UINT8 indexes.

Anthony, please apply, without this migration using hpet is broken.
(only current user).

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosoftfloat: Drop [s]bits{8, 16, 32, 64} types in favor of [u]int{8, 16, 32, 64}_t
Andreas Färber [Mon, 7 Mar 2011 00:34:06 +0000 (01:34 +0100)]
softfloat: Drop [s]bits{8, 16, 32, 64} types in favor of [u]int{8, 16, 32, 64}_t

They are defined with the same semantics as the POSIX types,
so prefer those for consistency. Suggested by Peter Maydell.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: Resolve type mismatches between declaration and implementation
Andreas Färber [Mon, 7 Mar 2011 00:34:05 +0000 (01:34 +0100)]
softfloat: Resolve type mismatches between declaration and implementation

The original SoftFloat 2.0b library avoided the use of custom integer types
in its public headers. This requires the definitions of int{8,16,32,64} to
match the assumptions in the declarations. This breaks on BeOS R5 and Haiku/x86,
where int32 is defined in {be,os}/support/SupportDefs.h in terms of a long
rather than an int. Spotted by Michael Lotz.

Since QEMU already breaks this distinction by defining those types just above,
do use them for consistency and to allow #ifndef'ing them out as done for
[u]int16 on AIX.

Cc: Michael Lotz <mmlr@mlotz.ch>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: Prepend QEMU-style header with derivation notice
Andreas Färber [Mon, 7 Mar 2011 00:34:04 +0000 (01:34 +0100)]
softfloat: Prepend QEMU-style header with derivation notice

The SoftFloat license requires "prominent notice that the work
is derivative". Having added features like improved 16-bit support
for arm already, add such a notice to the sources.

softfloat-native.[ch] are not under the SoftFloat license
and thus are not changed.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoe1000: Fix multi-descriptor packet checksum offload
Stefan Hajnoczi [Mon, 7 Mar 2011 20:04:07 +0000 (20:04 +0000)]
e1000: Fix multi-descriptor packet checksum offload

The PCI/PCI-X Family of Gigabit Ethernet Controllers Software
Developer’s Manual states the following about the POPTS field:

  Provides a number of options which control the handling of this
  packet.  This field is ignored except on the first data descriptor of
  a packet.

The current implementation always loads the field and its checksum
offload flags.  This patch uses only the first descriptor's POPTS field
in order to comply with the specification.

When Solaris sends multi-descriptor packets it fills in POPTS for the
first descriptor only.  Therefore this patch is necessary in order to
perform checksum offload correctly for multi-descriptor packets.

Reported-by: Daniel Pecka <dpecka@techniservit.cz>
Reported-by: Gabriele A. Trombetti <gabriele.trombetti@itb.cnr.it>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMerge branch 'for-anthony' of git://github.com/bonzini/qemu
Aurelien Jarno [Mon, 21 Mar 2011 20:28:38 +0000 (21:28 +0100)]
Merge branch 'for-anthony' of git://github.com/bonzini/qemu

* 'for-anthony' of git://github.com/bonzini/qemu:
  remove qemu_get_clock
  add a generic scaling mechanism for timers
  change all other clock references to use nanosecond resolution accessors
  change all rt_clock references to use millisecond resolution accessors
  add more helper functions with explicit milli/nanosecond resolution

13 years agoMerge branch 'for-anthony' of git://repo.or.cz/qemu/kevin
Aurelien Jarno [Mon, 21 Mar 2011 20:28:19 +0000 (21:28 +0100)]
Merge branch 'for-anthony' of git://repo.or.cz/qemu/kevin

* 'for-anthony' of git://repo.or.cz/qemu/kevin:
  Add qcow2 documentation
  hw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0
  Improve error handling in do_snapshot_blkdev()
  Fix ATA SMART and CHECK POWER MODE
  Don't allow multiwrites against a block device without underlying medium
  tools: Use real async.c instead of stubs
  Add error message for loading snapshot without VM state
  block/qcow: Don't ignore immediate read/write and other failures
  block/vdi: Don't ignore immediate read/write failures

13 years agorbd: don't link with -lcrypto
Aurelien Jarno [Mon, 7 Mar 2011 06:17:49 +0000 (07:17 +0100)]
rbd: don't link with -lcrypto

rbd support tries to both link with -lrados and -lcrypto. While the
first one is of course necessary, the second is not necessary (only
librados ifself needs to link with libcrypto).

This fixes a licensing issue: qemu as a whole is GPL v2, and thus can't
be linked with OpenSSL without an exception in the license, which seems
difficult to get given the number of persons involved.

Cc: Christian Brunner <chb@muc.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agohw/arm_sysctl.c: Add the Versatile Express system registers
Peter Maydell [Mon, 7 Mar 2011 11:10:31 +0000 (11:10 +0000)]
hw/arm_sysctl.c: Add the Versatile Express system registers

Add support for the Versatile Express SYS_CFG registers, which provide
a generic means of reading or writing configuration information from
various parts of the board. We only implement shutdown and reset.

Also make the RESETCTL register RAZ/WI on Versatile Express rather
than reset the board. Other system registers are generally the same
as Versatile and Realview.

This includes a VMState version number bump for arm_sysctl,
since we have new register state to preserve. It also adds
sys_mci to the VMState while we're bumping the version number
(an accidental omission from commit b50ff6f5).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoremove qemu_get_clock
Paolo Bonzini [Fri, 11 Mar 2011 17:27:26 +0000 (18:27 +0100)]
remove qemu_get_clock

These patches are already not doing a great service to out-of-tree
modifications to QEMU.  However, at least we can warn them by getting
rid of the old confusing functions, or otherwise causing compilation
errors.  This patch removes qemu_get_clock; the previous one changed
qemu_new_timer's signature.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agoadd a generic scaling mechanism for timers
Paolo Bonzini [Fri, 11 Mar 2011 15:33:58 +0000 (16:33 +0100)]
add a generic scaling mechanism for timers

This enables rt_clock timers to use nanosecond resolution, just by
using the _ns functions; there is really no reason to forbid that.

Migrated timers are all using vm_clock (of course; but I checked that
anyway) so the timers in the savevm files are already in nanosecond
resolution.  So this patch makes no change to the migration format.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agochange all other clock references to use nanosecond resolution accessors
Paolo Bonzini [Fri, 11 Mar 2011 15:47:48 +0000 (16:47 +0100)]
change all other clock references to use nanosecond resolution accessors

This was done with:

    sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \
        $(git grep -l 'qemu_get_clock\>' )
    sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \
        $(git grep -l 'qemu_new_timer\>' )

after checking that get_clock and new_timer never occur twice
on the same line.  There were no missed occurrences; however, even
if there had been, they would have been caught by the compiler.

There was exactly one false positive in qemu_run_timers:

     -    current_time = qemu_get_clock (clock);
     +    current_time = qemu_get_clock_ns (clock);

which is of course not in this patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agochange all rt_clock references to use millisecond resolution accessors
Paolo Bonzini [Fri, 11 Mar 2011 15:47:48 +0000 (16:47 +0100)]
change all rt_clock references to use millisecond resolution accessors

This was done with:

    sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \
        $(git grep -l 'get_clock\>.*rt_clock' )
    sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \
        $(git grep -l 'new_timer\>.*rt_clock' )

after checking that get_clock and new_timer never occur twice
on the same line.  There were no missed occurrences; however, even
if there had been, they would have been caught by the compiler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agoadd more helper functions with explicit milli/nanosecond resolution
Paolo Bonzini [Fri, 11 Mar 2011 15:46:02 +0000 (16:46 +0100)]
add more helper functions with explicit milli/nanosecond resolution

The code doesn't make much sense right now, but it will as
soon as timers will be able to scale their resolution arbitrarily.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agoFix conversions from pointer to int and vice versa
Stefan Weil [Wed, 23 Feb 2011 18:09:16 +0000 (19:09 +0100)]
Fix conversions from pointer to int and vice versa

Here the int values fds[0], sigfd, s, sock and fd are converted
to void pointers which are later converted back to an int value.

These conversions should always use intptr_t instead of unsigned long.

They are needed for environments where sizeof(long) != sizeof(void *).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopetalogix_ml605_mmu: remove unused variable
Blue Swirl [Sat, 19 Mar 2011 08:43:22 +0000 (08:43 +0000)]
petalogix_ml605_mmu: remove unused variable

Remove a write-only variable, spotted by GCC 4.6.0:
/src/qemu/hw/petalogix_ml605_mmu.c: In function 'petalogix_ml605_init':
/src/qemu/hw/petalogix_ml605_mmu.c:153:11: error: variable 'serial' set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoqemu-thread: delete unused functions
Blue Swirl [Tue, 15 Mar 2011 20:48:52 +0000 (20:48 +0000)]
qemu-thread: delete unused functions

qemu_mutex_timedlock() and qemu_cond_timedwait() are no longer used.

Remove them and their helper timespec_add_ms().

Reported-by: François Revol <revol@free.fr>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agow32: Add missing functions qemu_mutex_destroy, qemu_cond_destroy
Stefan Weil [Sun, 13 Mar 2011 18:00:52 +0000 (19:00 +0100)]
w32: Add missing functions qemu_mutex_destroy, qemu_cond_destroy

These functions were missing in commit
9257d46d55f1fe4e8209be9a6870e339ac3266fe.

Both functions are needed for compilations with
configuration --enable-vnc-thread.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8254: Fix migration from older versions
Jan Kiszka [Sun, 6 Mar 2011 15:09:49 +0000 (16:09 +0100)]
i8254: Fix migration from older versions

qdev conversion broke migration as the previous version used vmstate
instance IDs derived from the iobase. Fix it by registering a legacy
alias.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoExpose thread_id in info cpus
Jan Kiszka [Tue, 15 Mar 2011 11:26:31 +0000 (12:26 +0100)]
Expose thread_id in info cpus

Based on patch by Glauber Costa:

To allow management applications like libvirt to apply CPU affinities to
the VCPU threads, expose their ID via info cpus. This patch provides the
pre-existing and used interface from qemu-kvm.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Push kvm_arch_debug to kvm_arch_handle_exit
Jan Kiszka [Tue, 15 Mar 2011 11:26:30 +0000 (12:26 +0100)]
kvm: x86: Push kvm_arch_debug to kvm_arch_handle_exit

There are no generic bits remaining in the handling of KVM_EXIT_DEBUG.
So push its logic completely into arch hands, i.e. only x86 so far.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Reorder functions in kvm.c
Jan Kiszka [Tue, 15 Mar 2011 11:26:29 +0000 (12:26 +0100)]
kvm: x86: Reorder functions in kvm.c

Required for next patch which will access guest debug services from
kvm_arch_handle_exit. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes
Jan Kiszka [Tue, 15 Mar 2011 11:26:28 +0000 (12:26 +0100)]
kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes

Make the return code of kvm_arch_handle_exit directly usable for
kvm_cpu_exec. This is straightforward for x86 and ppc, just s390
would require more work. Avoid this for now by pushing the return code
translation logic into s390's kvm_arch_handle_exit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Rework inner loop of kvm_cpu_exec
Jan Kiszka [Tue, 15 Mar 2011 11:26:27 +0000 (12:26 +0100)]
kvm: Rework inner loop of kvm_cpu_exec

Let kvm_cpu_exec return EXCP_* values consistently and generate those
codes already inside its inner loop. This means we will now re-enter the
kernel while ret == 0.

Update kvm_handle_internal_error accordingly, but keep
kvm_arch_handle_exit untouched, it will be converted in a separate step.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Reorder error handling of KVM_RUN
Jan Kiszka [Tue, 15 Mar 2011 11:26:26 +0000 (12:26 +0100)]
kvm: Reorder error handling of KVM_RUN

Test for general errors first as this is the slower path.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Keep KVM_RUN return value in separate variable
Jan Kiszka [Tue, 15 Mar 2011 11:26:25 +0000 (12:26 +0100)]
kvm: Keep KVM_RUN return value in separate variable

Avoid using 'ret' both for the return value of KVM_RUN as well as the
code kvm_cpu_exec is supposed to return. Both have no direct relation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Consider EXIT_DEBUG unknown without CAP_SET_GUEST_DEBUG
Jan Kiszka [Tue, 15 Mar 2011 11:26:24 +0000 (12:26 +0100)]
kvm: Consider EXIT_DEBUG unknown without CAP_SET_GUEST_DEBUG

Without KVM_CAP_SET_GUEST_DEBUG, we neither motivate the kernel to
report KVM_EXIT_DEBUG nor do we expect such exits. So fall through to
the arch code which will simply report an unknown exit reason.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Synchronize PAT MSR with the kernel
Jan Kiszka [Tue, 15 Mar 2011 11:26:23 +0000 (12:26 +0100)]
kvm: x86: Synchronize PAT MSR with the kernel

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Save/restore PAT MSR
Jan Kiszka [Tue, 15 Mar 2011 11:26:22 +0000 (12:26 +0100)]
x86: Save/restore PAT MSR

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Properly reset PAT MSR
Jan Kiszka [Tue, 15 Mar 2011 11:26:21 +0000 (12:26 +0100)]
x86: Properly reset PAT MSR

Conforming to the Intel spec, set the power-on value of PAT also on
reset, but save it across INIT.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Mark VCPU state dirty on creation
Jan Kiszka [Tue, 15 Mar 2011 11:26:20 +0000 (12:26 +0100)]
kvm: Mark VCPU state dirty on creation

This avoids that early cpu_synchronize_state calls try to retrieve an
uninitialized state from the kernel. That even causes a deadlock if
io-thread is enabled.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Do not leave halt if interrupts are disabled
Jan Kiszka [Tue, 15 Mar 2011 11:26:19 +0000 (12:26 +0100)]
kvm: x86: Do not leave halt if interrupts are disabled

When an external interrupt is pending but IF is cleared, we must not
leave the halt state prematurely.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Add in-kernel irqchip awareness to cpu_thread_is_idle
Jan Kiszka [Tue, 15 Mar 2011 11:26:18 +0000 (12:26 +0100)]
kvm: Add in-kernel irqchip awareness to cpu_thread_is_idle

With in-kernel irqchip support enabled, the vcpu threads sleep in kernel
space while halted. Account for this difference in cpu_thread_is_idle.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agomicroblaze: Add PetaLogix ml605 MMU little-endian ref design
Michal Simek [Mon, 14 Mar 2011 10:29:19 +0000 (11:29 +0100)]
microblaze: Add PetaLogix ml605 MMU little-endian ref design

Add the first Microblaze little endian platform.
Platform uses uart16550, axi ethernet, timer, intc.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agoxilinx: Add AXIENET & DMA models
Edgar E. Iglesias [Mon, 14 Mar 2011 10:13:55 +0000 (11:13 +0100)]
xilinx: Add AXIENET & DMA models

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agomicroblaze: Compile uart 16550 serial driver
Michal Simek [Fri, 4 Mar 2011 13:40:29 +0000 (14:40 +0100)]
microblaze: Compile uart 16550 serial driver

Upcomming little endian platform will use 16550 serial driver.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agoAdd qcow2 documentation
Kevin Wolf [Mon, 14 Feb 2011 16:49:46 +0000 (17:49 +0100)]
Add qcow2 documentation

This adds a description of the qcow2 file format to the docs/ directory.
Besides documenting what's there, which is never wrong, the document should
provide a good basis for the discussion of format extensions (called "qcow3"
in previous discussions)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agowin32: implement missing timersub
Blue Swirl [Sun, 13 Mar 2011 10:30:52 +0000 (10:30 +0000)]
win32: implement missing timersub

Implement and wrap timersub() for Win32.

Acked-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosimpletrace: Move st_init() error reporting
Stefan Hajnoczi [Sun, 13 Mar 2011 20:14:30 +0000 (20:14 +0000)]
simpletrace: Move st_init() error reporting

User emulator builds do not have error_report() so it should not be used
by simpletrace.c.  In fact, error reporting inside simpletrace.c is
inappropriate and should be done by the caller instead.

This patch moves st_init() error reporting out to its caller,
vl.c:main().

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agos390: Detect invalid invocations of qemu_ram_free/remap
Jan Kiszka [Tue, 15 Mar 2011 11:26:14 +0000 (12:26 +0100)]
s390: Detect invalid invocations of qemu_ram_free/remap

This both detects invalid invocations of qemu_ram_free and
qemu_ram_remap when mem_path is non-NULL and fixes a build error on
s390 ("'area' may be used uninitialized in this function").

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Unbreak TCG support for hardware breakpoints
Jan Kiszka [Tue, 15 Mar 2011 11:26:13 +0000 (12:26 +0100)]
x86: Unbreak TCG support for hardware breakpoints

Commit 83f338f73e broke x86 hardware breakpoint emulation by moving the
debug exception handling out of cpu_exec. Fix this by moving all TCG
related bits back, only leaving the generic guest debugging parts in
cpus.c.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: TeLeMan <geleman@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoImplement qemu_kvm_eat_signals only for CONFIG_LINUX
Jan Kiszka [Tue, 15 Mar 2011 11:26:12 +0000 (12:26 +0100)]
Implement qemu_kvm_eat_signals only for CONFIG_LINUX

qemu_kvm_eat_signals requires POSIX support with realtime extensions for
sigtimedwait. Not all our target platforms provide this. Moreover,
undefined sigbus_reraise was referenced on non-Linux as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agohw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0
Feiran Zheng [Wed, 9 Mar 2011 13:19:35 +0000 (21:19 +0800)]
hw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0

In hw/xen_disk.c, async writing ioreq is leaked when
ioreq->req.nr_segments==0, because `aio_inflight` flag is not released
properly (skipped by misplaced "break").

Signed-off-by: Feiran Zheng <famcool@gmail.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoImprove error handling in do_snapshot_blkdev()
Jes Sorensen [Wed, 9 Mar 2011 10:20:30 +0000 (11:20 +0100)]
Improve error handling in do_snapshot_blkdev()

In case we cannot open the newly created snapshot image, try to fall
back to the original image file and continue running on that, which
should prevent the guest from aborting.

This is a corner case which can happen if the admin by mistake
specifies the snapshot file on a virtual file system which does not
support O_DIRECT. bdrv_create() does not use O_DIRECT, but the
following open in bdrv_open() does and will then fail.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFix ATA SMART and CHECK POWER MODE
Brian Wheeler [Tue, 1 Mar 2011 13:30:23 +0000 (08:30 -0500)]
Fix ATA SMART and CHECK POWER MODE

This patch fixes two things:

 1) CHECK POWER MODE

The error return value wasn't always zero, so it would show up as
offline.  Error is now explicitly set to zero.

 2) SMART

The smart values that were returned were invalid and tools like skdump
would not recognize that the smart data was actually valid and would
dump weird output.  The data has been fixed up and raw value support
was added.  Tools like skdump and palimpsest work as expected.

Signed-off-by: Brian Wheeler <bdwheele@indiana.edu>
Acked-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoDon't allow multiwrites against a block device without underlying medium
Ryan Harper [Mon, 7 Mar 2011 16:01:04 +0000 (10:01 -0600)]
Don't allow multiwrites against a block device without underlying medium

If the block device has been closed, we no longer have a medium to submit
IO against, check for this before submitting io.  This prevents a segfault
further in the code where we dereference elements of the block driver.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agotools: Use real async.c instead of stubs
Kevin Wolf [Tue, 22 Feb 2011 17:42:31 +0000 (18:42 +0100)]
tools: Use real async.c instead of stubs

It's wrong to call BHs directly, even in tools. The only operations that
schedule BHs are called in a loop that (indirectly) contains a call to
qemu_bh_poll anyway, so we're not losing the scheduled BHs: Tools either use
synchronous functions, which are guaranteed to have completed (including any
BHs) when they return; or if they use asynchronous functions, they need to call
qemu_aio_wait() or similar functions already today.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoAdd error message for loading snapshot without VM state
Kevin Wolf [Tue, 1 Mar 2011 09:48:12 +0000 (10:48 +0100)]
Add error message for loading snapshot without VM state

It already fails, but it didn't tell the user why.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
13 years agoblock/qcow: Don't ignore immediate read/write and other failures
Stefan Weil [Sat, 19 Feb 2011 21:18:12 +0000 (22:18 +0100)]
block/qcow: Don't ignore immediate read/write and other failures

This patch is similar to 171e3d6b9997c98a97d0c525867f7cd9b640cadd
which fixed qcow2:

Returning -EIO is far from optimal, but at least it's an error code.

In addition to read/write failures, -EIO is also returned when
decompress_cluster failed.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock/vdi: Don't ignore immediate read/write failures
Stefan Weil [Sat, 19 Feb 2011 21:18:11 +0000 (22:18 +0100)]
block/vdi: Don't ignore immediate read/write failures

This patch is similar to 171e3d6b9997c98a97d0c525867f7cd9b640cadd
which fixed qcow2:

Returning -EIO is far from optimal, but at least it's an error code.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoKVM, MCE, unpoison memory address across reboot
Huang Ying [Wed, 2 Mar 2011 07:56:20 +0000 (08:56 +0100)]
KVM, MCE, unpoison memory address across reboot

In Linux kernel HWPoison processing implementation, the virtual
address in processes mapping the error physical memory page is marked
as HWPoison.  So that, the further accessing to the virtual
address will kill corresponding processes with SIGBUS.

If the error physical memory page is used by a KVM guest, the SIGBUS
will be sent to QEMU, and QEMU will simulate a MCE to report that
memory error to the guest OS.  If the guest OS can not recover from
the error (for example, the page is accessed by kernel code), guest OS
will reboot the system.  But because the underlying host virtual
address backing the guest physical memory is still poisoned, if the
guest system accesses the corresponding guest physical memory even
after rebooting, the SIGBUS will still be sent to QEMU and MCE will be
simulated.  That is, guest system can not recover via rebooting.

In fact, across rebooting, the contents of guest physical memory page
need not to be kept.  We can allocate a new host physical page to
back the corresponding guest physical address.

This patch fixes this issue in QEMU-KVM via calling qemu_ram_remap()
to clear the corresponding page table entry, so that make it possible
to allocate a new page to recover the issue.

[ Jan: rebasing and tiny cleanups]

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoAdd qemu_ram_remap
Huang Ying [Wed, 2 Mar 2011 07:56:19 +0000 (08:56 +0100)]
Add qemu_ram_remap

qemu_ram_remap() unmaps the specified RAM pages, then re-maps these
pages again.  This is used by KVM HWPoison support to clear HWPoisoned
page tables across guest rebooting, so that a new page may be
allocated later to recover the memory error.

[ Jan: style fixlets, WIN32 fix ]

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Fail kvm_arch_init_vcpu if MCE initialization fails
Jan Kiszka [Wed, 2 Mar 2011 07:56:18 +0000 (08:56 +0100)]
kvm: x86: Fail kvm_arch_init_vcpu if MCE initialization fails

There is no reason to continue if the kernel claims to support MCE but
then fails to process our request.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Clean up kvm_setup_mce
Jan Kiszka [Wed, 2 Mar 2011 07:56:17 +0000 (08:56 +0100)]
kvm: x86: Clean up kvm_setup_mce

There is nothing to abstract here. Fold kvm_setup_mce into its caller
and fix up the error reporting (return code of kvm_vcpu_ioctl holds the
error value).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Consolidate TCG and KVM MCE injection code
Jan Kiszka [Wed, 2 Mar 2011 07:56:16 +0000 (08:56 +0100)]
kvm: x86: Consolidate TCG and KVM MCE injection code

This switches KVM's MCE injection path to cpu_x86_inject_mce, both for
SIGBUS and monitor initiated events. This means we prepare the MCA MSRs
in the VCPUState also for KVM.

We have to drop the MSRs writeback restrictions for this purpose which
is now safe as every uncoordinated MSR injection is removed with this
patch.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Run qemu_inject_x86_mce on target VCPU
Jan Kiszka [Wed, 2 Mar 2011 07:56:15 +0000 (08:56 +0100)]
x86: Run qemu_inject_x86_mce on target VCPU

We will use the current TCG-only MCE injection path for KVM as well, and
then this read-modify-write of the target VCPU state has to be performed
synchronously in the corresponding thread.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Inject pending MCE events on state writeback
Jan Kiszka [Wed, 2 Mar 2011 07:56:14 +0000 (08:56 +0100)]
kvm: x86: Inject pending MCE events on state writeback

The current way of injecting MCE events without updating of and
synchronizing with the CPUState is broken and causes spurious
corruptions of the MCE-related parts of the CPUState.

As a first step towards a fix, enhance the state writeback code with
support for injecting events that are pending in the CPUState. A pending
exception will then be signaled via cpu_interrupt(CPU_INTERRUPT_MCE).
And, just like for TCG, we need to leave the halt state when
CPU_INTERRUPT_MCE is pending (left broken for the to-be-removed old KVM
code).

This will also allow to unify TCG and KVM injection code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Rename kvm_arch_process_irqchip_events to async_events
Jan Kiszka [Wed, 2 Mar 2011 07:56:13 +0000 (08:56 +0100)]
kvm: Rename kvm_arch_process_irqchip_events to async_events

We will broaden the scope of this function on x86 beyond irqchip events.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Move MCE functions together
Jan Kiszka [Wed, 2 Mar 2011 07:56:12 +0000 (08:56 +0100)]
kvm: x86: Move MCE functions together

Pure function suffling to avoid multiple #ifdef KVM_CAP_MCE sections,
no functional changes. While at it, annotate some #ifdef sections.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoSynchronize VCPU states before reset
Jan Kiszka [Wed, 2 Mar 2011 07:56:11 +0000 (08:56 +0100)]
Synchronize VCPU states before reset

This is required to support keeping VCPU states across a system reset.
If we do not read the current state before the reset,
cpu_synchronize_all_post_reset may write back incorrect state
information.

The first user of this will be MCE MSR synchronization which currently
works around the missing cpu_synchronize_all_states.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Optionally avoid injecting AO MCEs while others are pending
Jan Kiszka [Wed, 2 Mar 2011 07:56:10 +0000 (08:56 +0100)]
x86: Optionally avoid injecting AO MCEs while others are pending

Allow to tell cpu_x86_inject_mce that it should ignore Action Optional
MCE events when the target VCPU is still processing another one. This
will be used by KVM soon.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Refine error reporting of MCE injection services
Jan Kiszka [Wed, 2 Mar 2011 07:56:09 +0000 (08:56 +0100)]
x86: Refine error reporting of MCE injection services

As this service is used by the human monitor, make sure that errors get
reported to the right channel, and also raise the verbosity.

This requires to move Monitor typedef in qemu-common.h to resolve the
include dependency.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Small cleanups of MCE helpers
Jan Kiszka [Wed, 2 Mar 2011 07:56:08 +0000 (08:56 +0100)]
x86: Small cleanups of MCE helpers

Fix some code style issues, use proper headers, and align to cpu_x86
naming scheme. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Perform implicit mcg_status reset
Jan Kiszka [Wed, 2 Mar 2011 07:56:07 +0000 (08:56 +0100)]
x86: Perform implicit mcg_status reset

Reorder mcg_status in CPUState to achieve automatic clearing on reset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Account for MCE in cpu_has_work
Jan Kiszka [Wed, 2 Mar 2011 07:56:06 +0000 (08:56 +0100)]
x86: Account for MCE in cpu_has_work

MCEs can be injected asynchronously, so they can also terminate the halt
state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Huang Ying <ying.huang@intel.com>
CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
CC: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Fix build warning when KVM_CAP_SET_GUEST_DEBUG is lacking
Jan Kiszka [Wed, 2 Mar 2011 07:56:05 +0000 (08:56 +0100)]
kvm: Fix build warning when KVM_CAP_SET_GUEST_DEBUG is lacking

Original fix by David Gibson.

CC: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: ppc: Fix breakage of kvm_arch_pre_run/process_irqchip_events
Jan Kiszka [Wed, 2 Mar 2011 07:56:04 +0000 (08:56 +0100)]
kvm: ppc: Fix breakage of kvm_arch_pre_run/process_irqchip_events

Commit 7a39fe5882 failed to convert the right arch function.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoadd Win32 IPI service
Paolo Bonzini [Sat, 12 Mar 2011 16:44:08 +0000 (17:44 +0100)]
add Win32 IPI service

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoprotect qemu_cpu_kick_self for Win32
Paolo Bonzini [Sat, 12 Mar 2011 16:44:07 +0000 (17:44 +0100)]
protect qemu_cpu_kick_self for Win32

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoprovide dummy signal init functions for win32
Paolo Bonzini [Sat, 12 Mar 2011 16:44:06 +0000 (17:44 +0100)]
provide dummy signal init functions for win32

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomerge all signal initialization with qemu_signalfd_init, rename
Paolo Bonzini [Sat, 12 Mar 2011 16:44:05 +0000 (17:44 +0100)]
merge all signal initialization with qemu_signalfd_init, rename

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>