]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
13 years agocris: Replace tcg branch sequence with setcond
Edgar E. Iglesias [Tue, 25 Jan 2011 18:47:06 +0000 (19:47 +0100)]
cris: Replace tcg branch sequence with setcond

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agopulseaudio: tweak config
Gerd Hoffmann [Mon, 24 Jan 2011 21:07:46 +0000 (22:07 +0100)]
pulseaudio: tweak config

Zap unused divisor field.
Raise the buffer size default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
13 years agopulseaudio: setup buffer attrs
Gerd Hoffmann [Mon, 24 Jan 2011 21:07:45 +0000 (22:07 +0100)]
pulseaudio: setup buffer attrs

Request reasonable buffer sizes from pulseaudio.  Without this
pa_simple_write() can block quite long and lead to dropouts,
especially with guests which use small audio ring buffers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
13 years agopulseaudio: process 1/4 buffer max at once
Gerd Hoffmann [Mon, 24 Jan 2011 21:07:44 +0000 (22:07 +0100)]
pulseaudio: process 1/4 buffer max at once

Limit the size of data pieces processed by the pulseaudio worker
threads.  Never ever process more than 1/4 of the buffer at once.

Background: The buffer area currently processed by the pulseaudio thread
is blocked, i.e. the main thread (or iothread) can't fill in more data
there.  The buffer processing time is roughly real-time due to the
pa_simple_write() call blocking when the output queue to the pulse
server is full.  Thus processing big chunks at once means blocking
a large part of the buffer for a long time.  This brings high latency
and can lead to dropouts.

When processing the buffer in smaller chunks the rpos handling becomes a
problem though.  The thread reads hw->rpos without knowing whenever
qpa_run_out has already seen the last (small) chunk processed and
updated rpos accordingly.  There is no point in reading hw->rpos though,
pa->rpos can be used instead.  We just need to take care to initialize
pa->rpos before kicking the thread.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
13 years agomonitor: use after free in do_wav_capture()
Isaku Yamahata [Fri, 21 Jan 2011 10:53:55 +0000 (19:53 +0900)]
monitor: use after free in do_wav_capture()

use after free in do_wav_capture() on the error path.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomips_fulong: remove bogus HAS_AUDIO
Isaku Yamahata [Fri, 21 Jan 2011 10:53:51 +0000 (19:53 +0900)]
mips_fulong: remove bogus HAS_AUDIO

remove bogus HAS_AUDIO according to 738012bec4c67e697e766edadab3f522c552a04d.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoaudio: consolidate audio_init()
Isaku Yamahata [Fri, 21 Jan 2011 10:53:45 +0000 (19:53 +0900)]
audio: consolidate audio_init()

consolidate audio_init() and remove references to shoundhw.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: fix index of address read error exception
Alexandre Courbot [Tue, 25 Jan 2011 05:00:14 +0000 (14:00 +0900)]
target-sh4: fix index of address read error exception

Exception index of address read error should be 0x0e0.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: fix TLB invalidation code
Alexandre Courbot [Tue, 25 Jan 2011 06:32:01 +0000 (15:32 +0900)]
target-sh4: fix TLB invalidation code

In cpu_sh4_invalidate_tlb, the UTLB was invalidated twice and the
ITLB left unchaged, probably because of some unfortunate copy/paste.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 24 Jan 2011 21:16:56 +0000 (15:16 -0600)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agoSPARC: Add asr17 register support
Fabien Chouteau [Mon, 24 Jan 2011 11:56:56 +0000 (12:56 +0100)]
SPARC: Add asr17 register support

This register is activated by CPU_FEATURE_ASR17 in the feature field.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of Leon3
Fabien Chouteau [Mon, 24 Jan 2011 11:56:55 +0000 (12:56 +0100)]
SPARC: Emulation of Leon3

Leon3 is an open-source VHDL System-On-Chip, well known in space industry (more
information on http://www.gaisler.com).

Leon3 is made of multiple components available in the GrLib VHDL library.
Three devices are implemented: uart, timers and IRQ manager.
You can find code for these peripherals in the grlib_* files.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of GRLIB APB UART
Fabien Chouteau [Mon, 24 Jan 2011 11:56:54 +0000 (12:56 +0100)]
SPARC: Emulation of GRLIB APB UART

This device exposes one parameter:
 - chardev (ptr) : Pointer to a qemu character device

Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of GRLIB IRQMP
Fabien Chouteau [Mon, 24 Jan 2011 11:56:53 +0000 (12:56 +0100)]
SPARC: Emulation of GRLIB IRQMP

This device exposes two parameters:
 - set_pil_in        (ptr) : A function to set the pil_in of the SPARC CPU
 - set_pil_in_opaque (ptr) : Opaque argument of the set_pil_in function

Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC: Emulation of GRLIB GPTimer
Fabien Chouteau [Mon, 24 Jan 2011 11:56:52 +0000 (12:56 +0100)]
SPARC: Emulation of GRLIB GPTimer

This device exposes three parameters:
 - frequency (uint32) : The system frequency
 - irq-line  (uint32) : IRQ line number for the first timer
                        (others use irq-line + 1, irq-line + 2...)
 - nr-timers (uint32) : Number of timers

Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodocs: Document scsi-disk and usb-storage removable parameter
Stefan Hajnoczi [Mon, 24 Jan 2011 15:35:01 +0000 (15:35 +0000)]
docs: Document scsi-disk and usb-storage removable parameter

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agousb-msd: Propagate removable bit to SCSI device
Stefan Hajnoczi [Mon, 24 Jan 2011 15:35:00 +0000 (15:35 +0000)]
usb-msd: Propagate removable bit to SCSI device

USB Mass Storage Devices sometimes have the RMB (removable) bit set in
the SCSI INQUIRY response.  Thumbdrives tend to have the bit set whereas
hard disks do not.

Operating systems differentiate between removable devices and fixed
devices.  Under Linux, the anaconda installer looks for removable
devices.  Under Windows, only fixed devices may have more than one
partition and AutoRun is also affected by the removable bit.

For these reasons, allow USB Mass Storage Devices to override the
removable bit:

qemu -usb
     -drive if=none,file=test.img,cache=none,id=disk0
     -device usb-storage,drive=disk0,removable=on

The default is off.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: Allow scsi_bus_legacy_add_drive() to set removable bit
Stefan Hajnoczi [Mon, 24 Jan 2011 15:34:59 +0000 (15:34 +0000)]
scsi: Allow scsi_bus_legacy_add_drive() to set removable bit

scsi-disk devices may wish to override the removable bit.  Add support
for a qdev property on SCSI devices.  This is will be used by usb-msd.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: Allow overriding SCSI INQUIRY removable bit
Stefan Hajnoczi [Mon, 24 Jan 2011 15:34:58 +0000 (15:34 +0000)]
scsi-disk: Allow overriding SCSI INQUIRY removable bit

Provide the "removable" qdev property bit to override the SCSI INQUIRY
removable (RMB) bit for non-CDROM devices.  This will be used by USB
Mass Storage Devices, which sometimes have this guest-visible bit set
and sometimes do not.  They therefore requires a means for user
configuration.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agotarget-mips: fix save_cpu_state() calls
Aurelien Jarno [Mon, 17 Jan 2011 18:29:34 +0000 (19:29 +0100)]
target-mips: fix save_cpu_state() calls

The rule is:
- don't save PC if the exception is only triggered by softmmu.
- save PC if the exception can be triggered by an helper.

Fix a 64-bit kernel crash when loading modules.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agousb-bus: use snprintf
Blue Swirl [Sun, 23 Jan 2011 08:48:41 +0000 (08:48 +0000)]
usb-bus: use snprintf

Avoid this warning from OpenBSD linker:
  LINK  i386-softmmu/qemu
../usb-bus.o(.text+0x27c): In function `usb_get_fw_dev_path':
/src/qemu/hw/usb-bus.c:294: warning: sprintf() is often misused,
please use snprintf()

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb hid: add migration support
Gerd Hoffmann [Fri, 10 Dec 2010 13:40:30 +0000 (14:40 +0100)]
usb hid: add migration support

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb hub: add migration support
Gerd Hoffmann [Wed, 15 Dec 2010 11:45:24 +0000 (12:45 +0100)]
usb hub: add migration support

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb core: add migration support
Gerd Hoffmann [Fri, 10 Dec 2010 13:20:46 +0000 (14:20 +0100)]
usb core: add migration support

Yes, seriously.  There is no migration support at all for usb devices.
They loose state, especially the device address, and stop responding
because of that.  Oops.

Luckily there is so much broken usb hardware out there that the guest
usually just kicks the device hard (via port reset and
reinitialization), then continues without a hitch.  So we got away with
that in a surprising high number of cases.

The arrival of remote wakeup (which enables autosuspend support) changes
that picture though.  The usb devices also forget that it they are
supposed to wakeup, so they don't do that.  The host also doesn't notice
the device stopped working in case it suspended the device and thus
expects it waking up instead of polling it.  Result is that your mouse
is dead.

Lets start fixing that.  Add a vmstate struct for USBDevice.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agovnc: fix numlock+capslock tracking
Gerd Hoffmann [Fri, 14 Jan 2011 09:56:54 +0000 (10:56 +0100)]
vnc: fix numlock+capslock tracking

This patch makes the numlock+capslock tracking logic only look at
keydown events.  Without this patch the vnc server will insert
bogous capslock keypress in case it sees the following key sequence:

  shift down --- 'A' down --- shift up  --- 'A' up
                                         ^ here

It doesn't hurt with a PS/2 keyboard, but it disturbs the USB Keyboard.
And with the key event queue just added to the usb keyboard the guest
will actually notice.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb hid: move head+n to common struct
Gerd Hoffmann [Fri, 14 Jan 2011 08:23:22 +0000 (09:23 +0100)]
usb hid: move head+n to common struct

This patch moves the 'head' and 'n' fields from USBMouseState and
USBKeyboardState to the common USBHIDState struct.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb keyboard: add event event queue
Gerd Hoffmann [Thu, 13 Jan 2011 16:42:06 +0000 (17:42 +0100)]
usb keyboard: add event event queue

This patch adds a event queue to the usb keyboard.  This makes sure the
guest will see all key events even if they come in bursts.  With this
patch applied sending Ctrl-Alt-Del using vncviewer's F8 menu works.
Also with autosuspend enabled the first keypress on a suspended keyboard
takes a little longer to be delivered to the guest because the usb bus
must be resumed first.  Without event queue this easily gets lost.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoadd event queueing to USB HID
Paolo Bonzini [Wed, 12 Jan 2011 12:19:20 +0000 (13:19 +0100)]
add event queueing to USB HID

The polling nature of the USB HID device makes it very hard to double
click or drag while on a high-latency VNC connection.  This patch,
based on work done in the Xen qemu-dm tree by Ian Jackson, fixes this
bug by adding an event queue to the device.  The event queue associates
each movement with the correct button state, and remembers all button
presses and releases as well.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffman <kraxel@redhat.com>
13 years agoblock: Use backing format driver during image creation
Stefan Hajnoczi [Mon, 24 Jan 2011 09:32:20 +0000 (09:32 +0000)]
block: Use backing format driver during image creation

The backing format should be honored during image creation.  For some
reason we currently use the image format to open the backing file.  This
fails when the backing file has a different format than the image being
created.  Keep the image and backing format drivers completely separate.

Also print the backing filename if there is an error opening the backing
file instead of the image filename.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: Fix drive_del not to crash when drive is not in use
Markus Armbruster [Mon, 17 Jan 2011 18:31:29 +0000 (19:31 +0100)]
blockdev: Fix drive_del not to crash when drive is not in use

Watch this:

    (qemu) drive_add 0 if=none,file=tmp.img
    OK
    (qemu) info block
    none0: type=hd removable=0 file=tmp.img ro=0 drv=raw encrypted=0
    (qemu) drive_del none0
    Segmentation fault (core dumped)

do_drive_del()'s code to clean up the pointer from a qdev using the
drive back to the drive needs to check whether such a device exists.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: Make drive_init() use error_report()
Markus Armbruster [Mon, 17 Jan 2011 18:31:27 +0000 (19:31 +0100)]
blockdev: Make drive_init() use error_report()

This makes the errors point to the error location, and fixes drive_add
to report errors in the monitor instead of stderr.

While there, tweak a few error messages for consistency.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblockdev: Fix error message for invalid -drive CHS
Markus Armbruster [Mon, 17 Jan 2011 18:31:26 +0000 (19:31 +0100)]
blockdev: Fix error message for invalid -drive CHS

When cyls, heads or secs are out of range, the error message prints
buf, which points to the value of option "if".  Bogus, may even be
null.  Drop that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoFix block migration when the device size is not a multiple of 1 MB
Pierre Riteau [Fri, 21 Jan 2011 11:42:30 +0000 (12:42 +0100)]
Fix block migration when the device size is not a multiple of 1 MB

b02bea3a85cc939f09aa674a3f1e4f36d418c007 added a check on the return
value of bdrv_write and aborts migration when it fails. However, if the
size of the block device to migrate is not a multiple of BLOCK_SIZE
(currently 1 MB), the last bdrv_write will fail with -EIO.

Fixed by calling bdrv_write with the correct size of the last block.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Refuse to create images on block devices
Stefan Hajnoczi [Fri, 14 Jan 2011 22:44:33 +0000 (22:44 +0000)]
qed: Refuse to create images on block devices

QED relies on the underlying filesystem to extend the file and maintain
its size.  Check that images are not created on a block device.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoDocumentation: Add qemu-img check/rebase
Kevin Wolf [Mon, 17 Jan 2011 14:35:28 +0000 (15:35 +0100)]
Documentation: Add qemu-img check/rebase

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Remove unneeded null pointer check
Stefan Weil [Sat, 15 Jan 2011 18:01:03 +0000 (19:01 +0100)]
ide: Remove unneeded null pointer check

With bm == NULL, other code in the same function would crash.

This bug was reported by cppcheck:
hw/ide/pci.c:280: error: Possible null pointer dereference: bm

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Batch flushes for COW
Kevin Wolf [Fri, 14 Jan 2011 14:55:38 +0000 (15:55 +0100)]
qcow2: Batch flushes for COW

qcow2 calls bdrv_flush() after performing COW in order to ensure that the
L2 table change is never written before the copy is safe on disk. Now that the
L2 table is cached, we can wait with flushing until we write out the next L2
table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Use QcowCache
Kevin Wolf [Mon, 10 Jan 2011 16:17:28 +0000 (17:17 +0100)]
qcow2: Use QcowCache

Use the new functions of qcow2-cache.c for everything that works on refcount
block and L2 tables.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agospice: add chardev (v5)
Alon Levy [Wed, 19 Jan 2011 08:49:50 +0000 (10:49 +0200)]
spice: add chardev (v5)

Adding a chardev backend for spice, where spice determines what
to do with it based on the name attribute given during chardev creation.
For usage by spice vdagent in conjunction with a properly named
virtio-serial device, and future smartcard channel usage.

Example usage:
 qemu -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent \
 -device virtserialport,chardev=vdagent,name=com.redhat.spice.0

v4->v5:
 * add tracing events
 * fix missing comma
 * fix help string to show debug is optional

v3->v4:
 * updated commit message

v1->v3 changes: (v2 had a wrong commit message)
 * removed spice-qemu-char.h, folded into ui/qemu-spice.h
 * removed dead IOCTL code
 * removed comment
 * removed ifdef CONFIG_SPICE from qemu-config.c and qemu-options.hx help.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoconfigure: Fix spice probe
Jiri Denemark [Mon, 24 Jan 2011 12:20:29 +0000 (13:20 +0100)]
configure: Fix spice probe

Non-existent $pkgconfig instead of $pkg_config was used when configure
probes for spice availability.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
13 years agoqxl: locking fix
Gerd Hoffmann [Fri, 21 Jan 2011 09:32:03 +0000 (10:32 +0100)]
qxl: locking fix

One spice worker call lacks the unlock/relock calls,
which may lead to deadlocks, add them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agospice/qxl: zap spice 0.4 migration compatibility bits
Gerd Hoffmann [Wed, 5 Jan 2011 17:05:52 +0000 (18:05 +0100)]
spice/qxl: zap spice 0.4 migration compatibility bits

Live migration from and to spice 0.4 qxl devices isn't going to work.
Rip out the bits which attempt to support that.  Zap the subsection
logic which is obsolete now.  Bumb the version to make a clean cut.
This should obviously go in before 0.14 is released.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agovnc/spice: fix "never" and "now" expire_time
Marc-André Lureau [Thu, 6 Jan 2011 10:43:17 +0000 (11:43 +0100)]
vnc/spice: fix "never" and "now" expire_time

13 years agospice: MAINTAINERS update
Gerd Hoffmann [Mon, 13 Dec 2010 20:30:37 +0000 (21:30 +0100)]
spice: MAINTAINERS update

13 years agospice/vnc: client migration.
Gerd Hoffmann [Fri, 23 Apr 2010 11:28:21 +0000 (13:28 +0200)]
spice/vnc: client migration.

Handle spice client migration, i.e. inform a spice client connected
about the new host and connection parameters, so it can move over the
connection automatically.

The monitor command has a not-yet used protocol argument simliar to
set_password and expire_password commands.  This allows to add a simliar
feature to vnc in the future.  Daniel Berrange plans to work on this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoadd migration state change notifiers
Gerd Hoffmann [Mon, 13 Dec 2010 16:30:12 +0000 (17:30 +0100)]
add migration state change notifiers

This patch adds functions to register and unregister notifiers for
migration state changes and a function to query the migration state.
The notifier is called on every state change.  Once after establishing a
new migration object (which is in active state then) and once when the
state changes from active to completed, canceled or error.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agopci: memory leak of PCIDevice::rom_file
Isaku Yamahata [Mon, 24 Jan 2011 10:00:47 +0000 (19:00 +0900)]
pci: memory leak of PCIDevice::rom_file

PCIDevice::rom_file is leaked.
PCIDevice::rom_file is allocated in pci_qdev_init(), but not freed anywhere.
free it in qemu_unregister_device().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoqcow2: Add QcowCache
Kevin Wolf [Mon, 10 Jan 2011 16:15:10 +0000 (17:15 +0100)]
qcow2: Add QcowCache

This adds some new cache functions to qcow2 which can be used for caching
refcount blocks and L2 tables. When used with cache=writethrough they work
like the old caching code which is spread all over qcow2, so for this case we
have merely a cleanup.

The interesting case is with writeback caching (this includes cache=none) where
data isn't written to disk immediately but only kept in cache initially. This
leads to some form of metadata write batching which avoids the current "write
to refcount block, flush, write to L2 table" pattern for each single request
when a lot of cluster allocations happen. Instead, cache entries are only
written out if its required to maintain the right order. In the pure cluster
allocation case this means that all metadata updates for requests are done in
memory initially and on sync, first the refcount blocks are written to disk,
then fsync, then L2 tables.

This improves performance of scenarios with lots of cluster allocations
noticably (e.g. installation or after taking a snapshot).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: kill ide_dma_submit_check
Christoph Hellwig [Mon, 20 Dec 2010 12:46:09 +0000 (13:46 +0100)]
ide: kill ide_dma_submit_check

Merge ide_dma_submit_check into it's only caller.  Also use tail recursion
using a goto instead of a real recursion - this avoid overflowing the
stack in the pathological situation of an recurring error that is ignored.
We'll still be busy looping in ide_dma_cb, but at least won't eat up
all stack space after this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: also reset io_buffer_index for writes
Christoph Hellwig [Mon, 20 Dec 2010 12:45:58 +0000 (13:45 +0100)]
ide: also reset io_buffer_index for writes

Currenly the code only resets the io_buffer_index field for reads,
but the code seems to expect this for all types of I/O.  I guess
we simply don't hit large enough transfers that would require this
often enough.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: factor dma handling helpers
Christoph Hellwig [Mon, 20 Dec 2010 12:45:48 +0000 (13:45 +0100)]
ide: factor dma handling helpers

Factor the DMA I/O path that is duplicated between read and write
commands, into common helpers using the s->is_read flag added for
the macio ATA controller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoAvoid divide by zero when there is no block device to migrate
Pierre Riteau [Wed, 12 Jan 2011 13:41:00 +0000 (14:41 +0100)]
Avoid divide by zero when there is no block device to migrate

When block migration is requested and no read-write block device is
present, a divide by zero exception is triggered because
total_sector_sum equals zero.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoMake strtosz() return int64_t instead of ssize_t
Jes Sorensen [Wed, 5 Jan 2011 10:41:02 +0000 (11:41 +0100)]
Make strtosz() return int64_t instead of ssize_t

strtosz() needs to return a 64 bit type even on 32 bit
architectures. Otherwise qemu-img will fail to create disk
images >= 2GB

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agodo_snapshot_blkdev() error on missing snapshot_file argument
Jes Sorensen [Thu, 6 Jan 2011 16:02:23 +0000 (17:02 +0100)]
do_snapshot_blkdev() error on missing snapshot_file argument

Current code does not support snapshot internally to the running
image. Error in case no snapshot_file is specified.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img snapshot: Use writeback caching
Kevin Wolf [Mon, 10 Jan 2011 11:33:02 +0000 (12:33 +0100)]
qemu-img snapshot: Use writeback caching

None of the other qemu-img subcommands uses writethrough, and there's no reason
why snapshot should be special.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoqcow2: fix unaligned access
Aurelien Jarno [Sat, 1 Jan 2011 20:50:34 +0000 (21:50 +0100)]
qcow2: fix unaligned access

cpu_to_be64w() is called with an obviously non-aligned pointer. Use
cpu_to_be64wu() instead. It fixes unaligned accesses errors on IA64
hosts.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agomultiboot: Fix upper memory size in multiboot info
Kevin Wolf [Tue, 4 Jan 2011 13:03:30 +0000 (14:03 +0100)]
multiboot: Fix upper memory size in multiboot info

The upper memory size field should exclude the first MB of RAM.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoDelete useless 'extern' qualifiers for functions
Blue Swirl [Sun, 23 Jan 2011 16:21:20 +0000 (16:21 +0000)]
Delete useless 'extern' qualifiers for functions

'extern' qualifier is useless for function declarations. Delete
them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agogdbstub-xml: avoid a warning from sparse
Blue Swirl [Sun, 23 Jan 2011 11:43:25 +0000 (11:43 +0000)]
gdbstub-xml: avoid a warning from sparse

Include a header to get the declaration for xml_builtin. This
avoids a warning from sparse:
  CC    m68k-softmmu/gdbstub-xml.o
gdbstub-xml.c:244:12: warning: symbol 'xml_builtin' was not declared. Should it be static?

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agokvm: x86: Only read/write MSR_KVM_ASYNC_PF_EN if supported
Jan Kiszka [Fri, 21 Jan 2011 20:48:22 +0000 (21:48 +0100)]
kvm: x86: Only read/write MSR_KVM_ASYNC_PF_EN if supported

If the kernel does not support KVM_CAP_ASYNC_PF, it also does not know
about the related MSR. So skip it during state synchronization in that
case. Fixes annoying kernel warnings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Implicitly clear nmi_injected/pending on reset
Jan Kiszka [Fri, 21 Jan 2011 20:48:21 +0000 (21:48 +0100)]
kvm: x86: Implicitly clear nmi_injected/pending on reset

All CPUX86State variables before CPU_COMMON are automatically cleared on
reset. Reorder nmi_injected and nmi_pending to avoid having to touch
them explicitly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Do not use qemu_fair_mutex
Jan Kiszka [Fri, 21 Jan 2011 20:48:20 +0000 (21:48 +0100)]
kvm: Do not use qemu_fair_mutex

The imbalance in the hold time of qemu_global_mutex only exists in TCG
mode. In contrast to TCG VCPUs, KVM drops the global lock during guest
execution. We already avoid touching the fairness lock from the
IO-thread in KVM mode, so also stop using it from the VCPU threads.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Flush coalesced mmio buffer on IO window exits
Jan Kiszka [Fri, 21 Jan 2011 20:48:19 +0000 (21:48 +0100)]
kvm: Flush coalesced mmio buffer on IO window exits

We must flush pending mmio writes if we leave kvm_cpu_exec for an IO
window. Otherwise we risk to loose those requests when migrating to a
different host during that window.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Rework identity map and TSS setup for larger BIOS sizes
Jan Kiszka [Fri, 21 Jan 2011 20:48:18 +0000 (21:48 +0100)]
kvm: x86: Rework identity map and TSS setup for larger BIOS sizes

In order to support loading BIOSes > 256K, reorder the code, adjusting
the base if the kernel supports moving the identity map.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Consolidate must-have capability checks
Jan Kiszka [Fri, 21 Jan 2011 20:48:17 +0000 (21:48 +0100)]
kvm: Consolidate must-have capability checks

Instead of splattering the code with #ifdefs and runtime checks for
capabilities we cannot work without anyway, provide central test
infrastructure for verifying their availability both at build and
runtime.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Drop smp_cpus argument from init functions
Jan Kiszka [Fri, 21 Jan 2011 20:48:16 +0000 (21:48 +0100)]
kvm: Drop smp_cpus argument from init functions

No longer used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Fix !CONFIG_KVM_PARA build
Jan Kiszka [Fri, 21 Jan 2011 20:48:15 +0000 (21:48 +0100)]
kvm: x86: Fix !CONFIG_KVM_PARA build

If we lack kvm_para.h, MSR_KVM_ASYNC_PF_EN is not defined. The change in
kvm_arch_init_vcpu is just for consistency reasons.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Reset paravirtual MSRs
Jan Kiszka [Fri, 21 Jan 2011 20:48:14 +0000 (21:48 +0100)]
kvm: x86: Reset paravirtual MSRs

Make sure to write the cleared MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
and MSR_KVM_ASYNC_PF_EN to the kernel state so that a freshly booted
guest cannot be disturbed by old values.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Glauber Costa <glommer@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Refactor msr_star/hsave_pa setup and checks
Jan Kiszka [Fri, 21 Jan 2011 20:48:13 +0000 (21:48 +0100)]
kvm: x86: Refactor msr_star/hsave_pa setup and checks

Simplify kvm_has_msr_star/hsave_pa to booleans and push their one-time
initialization into kvm_arch_init. Also handle potential errors of that
setup procedure.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Fix xcr0 reset mismerge
Jan Kiszka [Fri, 21 Jan 2011 20:48:12 +0000 (21:48 +0100)]
kvm: x86: Fix xcr0 reset mismerge

For unknown reasons, xcr0 reset ended up in kvm_arch_update_guest_debug
on upstream merge. Fix this and also remove the misleading comment (1 is
THE reset value).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Remove redundant mp_state initialization
Jan Kiszka [Fri, 21 Jan 2011 20:48:11 +0000 (21:48 +0100)]
kvm: x86: Remove redundant mp_state initialization

kvm_arch_reset_vcpu initializes mp_state, and that function is invoked
right after kvm_arch_init_vcpu.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Prepare kvm_get_mp_state for in-kernel irqchip
Jan Kiszka [Fri, 21 Jan 2011 20:48:10 +0000 (21:48 +0100)]
kvm: x86: Prepare kvm_get_mp_state for in-kernel irqchip

This code path will not yet be taken as we still lack in-kernel irqchip
support. But qemu-kvm can already make use of it and drop its own
mp_state access services.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Align kvm_arch_put_registers code with comment
Jan Kiszka [Fri, 21 Jan 2011 20:48:09 +0000 (21:48 +0100)]
kvm: x86: Align kvm_arch_put_registers code with comment

The ordering doesn't matter in this case, but better keep it consistent.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agox86: Optionally dump code bytes on cpu_dump_state
Jan Kiszka [Fri, 21 Jan 2011 20:48:08 +0000 (21:48 +0100)]
x86: Optionally dump code bytes on cpu_dump_state

Introduce the cpu_dump_state flag CPU_DUMP_CODE and implement it for
x86. This writes out the code bytes around the current instruction
pointer. Make use of this feature in KVM to help debugging fatal vm
exits.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Improve reporting of fatal errors
Jan Kiszka [Fri, 21 Jan 2011 20:48:07 +0000 (21:48 +0100)]
kvm: Improve reporting of fatal errors

Report KVM_EXIT_UNKNOWN, KVM_EXIT_FAIL_ENTRY, and KVM_EXIT_EXCEPTION
with more details to stderr. The latter two are so far x86-only, so move
them into the arch-specific handler. Integrate the Intel real mode
warning on KVM_EXIT_FAIL_ENTRY that qemu-kvm carries, but actually
restrict it to Intel CPUs. Moreover, always dump the CPU state in case
we fail.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: Stop on all fatal exit reasons
Jan Kiszka [Fri, 21 Jan 2011 20:48:06 +0000 (21:48 +0100)]
kvm: Stop on all fatal exit reasons

Ensure that we stop the guest whenever we face a fatal or unknown exit
reason. If we stop, we also have to enforce a cpu loop exit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Swallow KVM_EXIT_SET_TPR
Jan Kiszka [Fri, 21 Jan 2011 20:48:05 +0000 (21:48 +0100)]
kvm: x86: Swallow KVM_EXIT_SET_TPR

This exit only triggers activity in the common exit path, but we should
accept it in order to be able to detect unknown exit types.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoAvoid deadlock whith iothread and icount
Edgar E. Iglesias [Sun, 23 Jan 2011 03:44:51 +0000 (04:44 +0100)]
Avoid deadlock whith iothread and icount

When using the iothread together with icount, make sure the
qemu_icount counter makes forward progress when the vcpu is
idle to avoid deadlocks.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: cleanup helper_addkc
Edgar E. Iglesias [Sun, 23 Jan 2011 02:52:20 +0000 (03:52 +0100)]
microblaze: cleanup helper_addkc

Remove unused addition and rename to helper_carry.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Improve subkc
Edgar E. Iglesias [Sat, 22 Jan 2011 11:39:16 +0000 (12:39 +0100)]
microblaze: Improve subkc

Move code from the helper into the translator. The remaining
helper parts can reuse helper_addkc, making it possible to
remove helper_subkc entirely.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Fix 3rd addkc arg when rd is r0
Edgar E. Iglesias [Sat, 22 Jan 2011 11:35:48 +0000 (12:35 +0100)]
microblaze: Fix 3rd addkc arg when rd is r0

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Improve addkc
Edgar E. Iglesias [Sat, 22 Jan 2011 11:02:53 +0000 (12:02 +0100)]
microblaze: Improve addkc

* Optimize handling when carry is not updated.
* Optimize handling for adds with nop semantics.
* Move code from helper_addkc to the translator making
  helper_addkc PURE and CONST.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Remove debug leftovers.
Edgar E. Iglesias [Sat, 22 Jan 2011 11:00:12 +0000 (12:00 +0100)]
microblaze: Remove debug leftovers.

No functional changes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Reorganize for future patches
Edgar E. Iglesias [Sat, 22 Jan 2011 10:57:19 +0000 (11:57 +0100)]
microblaze: Reorganize for future patches

No functional changes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoppc: Correct BookE tlb reads
Edgar E. Iglesias [Fri, 21 Jan 2011 22:12:42 +0000 (23:12 +0100)]
ppc: Correct BookE tlb reads

Call the tlb read helper (and not the write helper) for tlb
reads.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agocheckpatch: Fix bracing false positives on #else
Jan Kiszka [Fri, 21 Jan 2011 17:19:40 +0000 (18:19 +0100)]
checkpatch: Fix bracing false positives on #else

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge branch 'usb.4' of git://anongit.freedesktop.org/spice/qemu
Aurelien Jarno [Fri, 21 Jan 2011 16:56:50 +0000 (17:56 +0100)]
Merge branch 'usb.4' of git://anongit.freedesktop.org/spice/qemu

* 'usb.4' of git://anongit.freedesktop.org/spice/qemu: (32 commits)
  usb: zap pdev from usbport
  usb: rewrite fw path, fix numbering
  usb: add port property.
  usb: keep track of physical port address.
  usb storage: handle long responses
  usb storage: fix status reporting
  usb storage: high speed support
  usb: add device qualifier support
  usb: add usb_desc_attach
  usb: add attach callback
  usb: add speed mask to ports
  usb: hid: change serial number to "42".
  usb: hid: remote wakeup support.
  usb: hub: remote wakeup support.
  usb: uhci: remote wakeup support.
  usb: add usb_wakeup() + wakeup callback to port ops
  usb: rework attach/detach workflow
  usb: create USBPortOps, move attach there.
  usb: move remote wakeup handling to common code
  usb: move USB_REQ_{GET,SET}_CONFIGURATION handling to common code
  ...

13 years agosm501: fix screen redraw
Aurelien Jarno [Fri, 21 Jan 2011 16:56:32 +0000 (17:56 +0100)]
sm501: fix screen redraw

Due to signed/unsigned comparison, the dirty bits are never reset, and
the screen redrawn each time. Fix that by only using ram_addr_t types,
and looking for page_min != addr_max instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agokvm: Fix coding style violations
Jan Kiszka [Tue, 4 Jan 2011 08:32:13 +0000 (09:32 +0100)]
kvm: Fix coding style violations

No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: x86: Fix a few coding style violations
Jan Kiszka [Mon, 27 Dec 2010 15:19:29 +0000 (16:19 +0100)]
kvm: x86: Fix a few coding style violations

No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agokvm: x86: Prevent sign extension of DR7 in guest debugging mode
Jan Kiszka [Mon, 27 Dec 2010 14:58:23 +0000 (15:58 +0100)]
kvm: x86: Prevent sign extension of DR7 in guest debugging mode

This unbreaks guest debugging when the 4th hardware breakpoint used for
guest debugging is a watchpoint of 4 or 8 byte lenght. The 31st bit of
DR7 is set in that case and used to cause a sign extension to the high
word which was breaking the guest state (vm entry failure).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agokvm: x86: Remove obsolete SS.RPL/DPL aligment
Jan Kiszka [Mon, 27 Dec 2010 14:57:35 +0000 (15:57 +0100)]
kvm: x86: Remove obsolete SS.RPL/DPL aligment

This seems to date back to the days KVM didn't support real mode. The
check is no longer needed and, even worse, is corrupting the guest state
in case SS.RPL != DPL.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agokvm: x86: Fix DPL write back of segment registers
Jan Kiszka [Mon, 27 Dec 2010 14:56:44 +0000 (15:56 +0100)]
kvm: x86: Fix DPL write back of segment registers

The DPL is stored in the flags and not in the selector. In fact, the RPL
may differ from the DPL at some point in time, and so we were corrupting
the guest state so far.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agokvm: introduce kvm_inject_x86_mce_on
Jin Dongming [Wed, 22 Dec 2010 03:24:51 +0000 (12:24 +0900)]
kvm: introduce kvm_inject_x86_mce_on

Pass a table instead of multiple args.

Note:

    kvm_inject_x86_mce(env, bank, status, mcg_status, addr, misc,
                       abort_on_error);

is equal to:

    struct kvm_x86_mce mce = {
        .bank = bank,
        .status = status,
        .mcg_status = mcg_status,
        .addr = addr,
        .misc = misc,
    };
    kvm_inject_x86_mce_on(env, &mce, abort_on_error);

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: kvm_mce_inj_* subroutines for templated error injections
Jin Dongming [Wed, 22 Dec 2010 03:24:38 +0000 (12:24 +0900)]
kvm: kvm_mce_inj_* subroutines for templated error injections

Refactor codes for maintainability.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: introduce kvm_mce_in_progress
Jin Dongming [Wed, 22 Dec 2010 03:24:22 +0000 (12:24 +0900)]
kvm: introduce kvm_mce_in_progress

Share same error handing, and rename this function after
MCIP (Machine Check In Progress) flag.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoAdd function for checking mca broadcast of CPU
Jin Dongming [Fri, 10 Dec 2010 08:21:14 +0000 (17:21 +0900)]
Add function for checking mca broadcast of CPU

Add function for checking whether current CPU support mca broadcast.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoAdd "broadcast" option for mce command
Jin Dongming [Fri, 10 Dec 2010 08:21:02 +0000 (17:21 +0900)]
Add "broadcast" option for mce command

When the following test case is injected with mce command, maybe user could not
get the expected result.
    DATA
               command cpu bank status             mcg_status  addr   misc
        (qemu) mce     1   1    0xbd00000000000000 0x05        0x1234 0x8c

    Expected Result
           panic type: "Fatal Machine check"

That is because each mce command can only inject the given cpu and could not
inject mce interrupt to other cpus. So user will get the following result:
    panic type: "Fatal machine check on current CPU"

"broadcast" option is used for injecting dummy data into other cpus. Injecting
mce with this option the expected result could be gotten.

Usage:
    Broadcast[on]
           command broadcast cpu bank status             mcg_status  addr   misc
    (qemu) mce     -b        1   1    0xbd00000000000000 0x05        0x1234 0x8c

    Broadcast[off]
           command cpu bank status             mcg_status  addr   misc
    (qemu) mce     1   1    0xbd00000000000000 0x05        0x1234 0x8c

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoClean up cpu_inject_x86_mce()
Jin Dongming [Fri, 10 Dec 2010 08:20:44 +0000 (17:20 +0900)]
Clean up cpu_inject_x86_mce()

Clean up cpu_inject_x86_mce() for later patch.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agokvm: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension()
Lai Jiangshan [Fri, 10 Dec 2010 07:52:36 +0000 (15:52 +0800)]
kvm: convert kvm_ioctl(KVM_CHECK_EXTENSION) to kvm_check_extension()

simple cleanup and use existing helper: kvm_check_extension().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>