]> git.proxmox.com Git - qemu.git/log
qemu.git
14 years agoqdev: Don't leak string property value on hot unplug
Markus Armbruster [Tue, 1 Jun 2010 18:32:31 +0000 (20:32 +0200)]
qdev: Don't leak string property value on hot unplug

parse_string() qemu_strdup()s the property value.  It is never freed.
It needs to be freed along with the device.  Otherwise, the value of
scsi-disk property "ver" gets leaked when hot-unplugging the disk, for
instance.

Call new PropertyInfo method free() from qdev_free().  Implement it
for qdev_prop_string.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqdev: New qdev_prop_set_string()
Markus Armbruster [Tue, 1 Jun 2010 18:32:30 +0000 (20:32 +0200)]
qdev: New qdev_prop_set_string()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoide: Split non-qdev code off ide_init2()
Markus Armbruster [Tue, 1 Jun 2010 18:32:29 +0000 (20:32 +0200)]
ide: Split non-qdev code off ide_init2()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoide: Change ide_init_drive() to require valid dinfo argument
Markus Armbruster [Tue, 1 Jun 2010 18:32:28 +0000 (20:32 +0200)]
ide: Change ide_init_drive() to require valid dinfo argument

IDEState members drive_serial_str and version are now left empty until
an actual drive is connected.  Before, they got a default value that
was overwritten when a drive got connected.  Doesn't matter, because
they're used only while a drive is connected.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoide: Split ide_init1() off ide_init2()
Markus Armbruster [Fri, 28 May 2010 13:38:47 +0000 (15:38 +0200)]
ide: Split ide_init1() off ide_init2()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoide: Remove redundant IDEState member conf
Markus Armbruster [Fri, 28 May 2010 13:38:46 +0000 (15:38 +0200)]
ide: Remove redundant IDEState member conf

Commit 428c149b added IDEState member conf to let commit 0009baf1 find
the BlockConf from there.  It exists only for qdev drives, created via
ide_drive_initfn(), not for drives created via ide_init2().

But for a qdev drive, we can just as well reach its IDEDevice, which
contains the BlockConf.  Do that, and revert the parts of commit
428c149b that add IDEState member conf.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoide: Remove useless IDEDeviceInfo members unit, drive
Markus Armbruster [Fri, 28 May 2010 13:38:45 +0000 (15:38 +0200)]
ide: Remove useless IDEDeviceInfo members unit, drive

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agousb: Remove unused usb_device_add() parameter is_hotplug
Markus Armbruster [Fri, 28 May 2010 13:38:44 +0000 (15:38 +0200)]
usb: Remove unused usb_device_add() parameter is_hotplug

Unused since commit b3e461d3.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblockdev: Belatedly remove driveopts
Markus Armbruster [Fri, 28 May 2010 13:38:43 +0000 (15:38 +0200)]
blockdev: Belatedly remove driveopts

Unused since commit 9dfd7c7a.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblockdev: Belatedly remove MAX_DRIVES
Markus Armbruster [Fri, 28 May 2010 13:38:42 +0000 (15:38 +0200)]
blockdev: Belatedly remove MAX_DRIVES

Unused since commit 751c6a17.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-io: Fix error messages
Kevin Wolf [Fri, 28 May 2010 18:10:48 +0000 (20:10 +0200)]
qemu-io: Fix error messages

The truncate and getlength commands passed a negative error number to strerror.
They also happen to be the two functions that are lacking a newline at the end
of their error message.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoCleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead
Jes Sorensen [Thu, 27 May 2010 14:20:33 +0000 (16:20 +0200)]
Cleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead

Clean up virtio-blk.c to be more consistent using BDRV_SECTOR_SIZE
instead of hard coded 512 values.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoCleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512
Jes Sorensen [Thu, 27 May 2010 14:20:32 +0000 (16:20 +0200)]
Cleanup: raw-posix.c: Be more consistent using BDRV_SECTOR_SIZE instead of 512

Clean up raw-posix.c to be more consistent using BDRV_SECTOR_SIZE
instead of hard coded 512 values.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoCleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512
Jes Sorensen [Thu, 27 May 2010 14:20:31 +0000 (16:20 +0200)]
Cleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512

Clean up block.c and use BDRV_SECTOR_SIZE rather than hard coded
numbers (512) when referring to sector size throughout the code.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoCleanup: bdrv_open() no need to shift total_size just to shift back.
Jes Sorensen [Thu, 27 May 2010 14:20:30 +0000 (16:20 +0200)]
Cleanup: bdrv_open() no need to shift total_size just to shift back.

In bdrv_open() there is no need to shift total_size >> 9 just to
multiply it by 512 again just a few lines later, since this is the
only place the variable is used.

Mask with BDRV_SECTOR_MASK to protect against case where we are
passed a corrupted image.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 3 Jun 2010 19:55:49 +0000 (14:55 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

14 years agomigration: respect exit status with exec:
Anthony Liguori [Wed, 2 Jun 2010 19:55:25 +0000 (14:55 -0500)]
migration: respect exit status with exec:

This patch makes sure that if the exec: process exits with a non-zero return
status, we treat the migration as failed.

This fixes https://bugs.launchpad.net/qemu/+bug/391879

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotcg-i386: fix a typo
Aurelien Jarno [Wed, 2 Jun 2010 22:02:30 +0000 (00:02 +0200)]
tcg-i386: fix a typo

Fix a typo introduced by c28b14c694d759f39fe3ae4f8d03b567da5b93f8.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: declare tcg_out_tlb_load() inline
Aurelien Jarno [Tue, 1 Jun 2010 11:55:18 +0000 (13:55 +0200)]
tcg-i386: declare tcg_out_tlb_load() inline

Declare tcg_out_tlb_load() inline so that we don't loose optimisations
with commit 8516a04467cb7954cdc32e8b79b4b7df56dccb16.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: Remove some ifdefs in qemu_ld/st.
Richard Henderson [Fri, 21 May 2010 16:03:04 +0000 (09:03 -0700)]
tcg-i386: Remove some ifdefs in qemu_ld/st.

Tidy some code by replacing ifdefs by C ifs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: Split out tlb load function.
Richard Henderson [Fri, 21 May 2010 16:03:03 +0000 (09:03 -0700)]
tcg-i386: Split out tlb load function.

Share some code between qemu_ld and qemu_st.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: Swap order of TLB hit and miss paths.
Richard Henderson [Fri, 21 May 2010 16:03:02 +0000 (09:03 -0700)]
tcg-i386: Swap order of TLB hit and miss paths.

Make fallthru be TLB hit and branch be TLB miss.  Doing this
both improves branch prediction and will allow further cleanup.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: Split out TLB Hit path from qemu_ld/st.
Richard Henderson [Fri, 21 May 2010 16:03:01 +0000 (09:03 -0700)]
tcg-i386: Split out TLB Hit path from qemu_ld/st.

Splitting out these functions will allow further cleanups.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-i386: Tidy data16 prefixes.
Richard Henderson [Fri, 21 May 2010 16:03:00 +0000 (09:03 -0700)]
tcg-i386: Tidy data16 prefixes.

Include it in the opcode as an extension, as with P_EXT
or the REX bits in the x86-64 port.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosparc64: fix umul and smul insns
Igor V. Kovalenko [Tue, 1 Jun 2010 20:12:58 +0000 (00:12 +0400)]
sparc64: fix umul and smul insns

- truncate and sign or zero extend operands before multiplication
- factor out common code to gen_op_multiply() with parameter to sign/zero extend
- call gen_op_multiply from gen_op_umul and gen_op_smul

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix udiv and sdiv insns
Igor V. Kovalenko [Tue, 1 Jun 2010 20:12:53 +0000 (00:12 +0400)]
sparc64: fix udiv and sdiv insns

- truncate second operand to 32bit

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: improve ldf and stf insns
Igor V. Kovalenko [Tue, 1 Jun 2010 20:12:48 +0000 (00:12 +0400)]
sparc64: improve ldf and stf insns

- implemented block load/store primary/secondary with user privilege

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: use symbolic name for MMU index v1
Igor V. Kovalenko [Wed, 2 Jun 2010 19:39:09 +0000 (23:39 +0400)]
sparc64: use symbolic name for MMU index v1

- use symbolic name for MMU index
v0->v1:
- change debug traces to DPRINTF_MMU
- fix debug trace function names

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix ldxfsr insn
Igor V. Kovalenko [Tue, 1 Jun 2010 20:12:37 +0000 (00:12 +0400)]
sparc64: fix ldxfsr insn

- rearrange code to break from switch when appropriate
- allow deprecated ldfsr insn

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix 32bit load sign extension
Igor V. Kovalenko [Tue, 1 Jun 2010 20:12:32 +0000 (00:12 +0400)]
sparc64: fix 32bit load sign extension

- change return type of ldl_* to uint32_t to prevent unwanted sign extension
  visible in sparc64 load alternate address space methods
- note this change makes ldl_* softmmu implementations match ldl_phys one
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix missing address masking v1
Igor V. Kovalenko [Wed, 2 Jun 2010 19:38:45 +0000 (23:38 +0400)]
sparc64: fix missing address masking v1

- address masking for ldqf and stqf insns
- address masking for lddf and stdf insns
- address masking for translating ASI (Ultrasparc IIi)
v0->v1:
- move arch-specific code to helpers and drop more ifdefs at call sites
  using new helper asi_address_mask()
- change user emulation to use asi_address_mask()

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix tag access register on mmu traps
Igor V. Kovalenko [Tue, 1 Jun 2010 20:12:22 +0000 (00:12 +0400)]
sparc64: fix tag access register on mmu traps

- set mmu tag access register on FAULT and PROT traps as well

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovnc: add missing target for vnc-encodings-*.o
Corentin Chary [Tue, 1 Jun 2010 21:05:44 +0000 (23:05 +0200)]
vnc: add missing target for vnc-encodings-*.o

vnc-encodings-*.c dependencies where missing.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: don't forget the third color
Corentin Chary [Tue, 1 Jun 2010 21:05:43 +0000 (23:05 +0200)]
vnc: tight: don't forget the third color

While couting color, if the third color was only present one
time it wasn't added to the palette.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: don't forget last pixel in tight_encode_indexed_rect
Corentin Chary [Tue, 1 Jun 2010 21:05:42 +0000 (23:05 +0200)]
vnc: tight: don't forget last pixel in tight_encode_indexed_rect

A simple patch would have been to just remove count -= 1, but this
one also replace the while (count--) with a for(i = 0; i < count; i++)
which I believe is more easy to understand.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Drop QMP documentation from code
Luiz Capitulino [Mon, 31 May 2010 17:43:32 +0000 (14:43 -0300)]
Monitor: Drop QMP documentation from code

Previous commit added QMP documentation to the qemu-monitor.hx
file, it's is a copy of this information.

While it's good to keep it near code, maintaining two copies of
the same information is too hard and has little benefit as we
don't expect client writers to consult the code to find how to
use a QMP command.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce commands documentation
Jan Kiszka [Mon, 31 May 2010 17:43:31 +0000 (14:43 -0300)]
QMP: Introduce commands documentation

One of the most important missing feature in QMP today is its
supported commands documentation.

The plan is to make it part of self-description support, however
self-description is a big task we have been postponing for a
long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier,
this commit adds a simple text documentation which fully describes
all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain,
text-only, etc) but does improve the current situation. To avoid at
least divering from the user monitor help and texi snippets, QMP bits
are also maintained inside qemu-monitor.hx, and hxtool is extended to
generate a single text file from them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomonitor: Reorder info documentation
Jan Kiszka [Mon, 31 May 2010 17:43:30 +0000 (14:43 -0300)]
monitor: Reorder info documentation

Push the doc fragments for the info command to the end of
qemu-monitor.hx. This helps to establish a proper layout in the upcoming
QMP documentation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'mst/for_anthony' into HEAD
Anthony Liguori [Tue, 1 Jun 2010 18:34:20 +0000 (13:34 -0500)]
Merge remote branch 'mst/for_anthony' into HEAD

14 years agovnc: move size-changed check into the vnc_desktop_resize function.
Gerd Hoffmann [Tue, 25 May 2010 16:25:20 +0000 (18:25 +0200)]
vnc: move size-changed check into the vnc_desktop_resize function.

This make sure we send a desktop resize message only in case we actually
have to, using the new variables which track the clients desktop size.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: don't send invalid screen updates.
Gerd Hoffmann [Tue, 25 May 2010 16:25:19 +0000 (18:25 +0200)]
vnc: don't send invalid screen updates.

Don't send updates for screen areas which are outside the clients
desktop.  May happed with vnc clients which don't support the desktop
resize message.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: keep track of client desktop size
Gerd Hoffmann [Tue, 25 May 2010 16:25:18 +0000 (18:25 +0200)]
vnc: keep track of client desktop size

Add two new variables to keep track of the vnc clients desktop size.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: send desktopresize event as reply to set encodings
Gerd Hoffmann [Tue, 25 May 2010 16:25:17 +0000 (18:25 +0200)]
vnc: send desktopresize event as reply to set encodings

In case the desktop did resize while the vnc connection setup was still
in progress the client isn't informed about it.  Send a desktop resize
event as soon as the client told us it can handle deskop resize via set
encodings message to make sure the client us up to date.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: factor out vnc_desktop_resize()
Gerd Hoffmann [Tue, 25 May 2010 16:25:16 +0000 (18:25 +0200)]
vnc: factor out vnc_desktop_resize()

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd support for depth 15 to qemu_default_pixelformat()
Gerd Hoffmann [Fri, 21 May 2010 09:59:14 +0000 (11:59 +0200)]
Add support for depth 15 to qemu_default_pixelformat()

Makes qemu_default_pixelformat(15) return pixelformat filled for 15 bit
color depth (16 bpp, 5 bits for red,green,blue each, 1 bit unused).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agocheck for active_console before using it
Gerd Hoffmann [Thu, 20 May 2010 13:23:06 +0000 (15:23 +0200)]
check for active_console before using it

Other vga_hw_* functions do the same.
Fixes a segmentation fault.  Trigger: boot with -nodefaults,
then connect via vnc.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd dependency of JSON unit tests on config-host.h
Jan Kiszka [Thu, 20 May 2010 07:18:52 +0000 (09:18 +0200)]
Add dependency of JSON unit tests on config-host.h

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomigration: Fix calculation of bytes_transferred
Pierre Riteau [Wed, 12 May 2010 13:12:44 +0000 (15:12 +0200)]
migration: Fix calculation of bytes_transferred

When a page with all identical bytes is transferred, it is counted
as a full page (TARGET_PAGE_SIZE) although only one byte is actually
sent. Fix this by changing ram_save_block() to return the number of
bytes sent instead of a boolean value. This makes bandwidth
estimation, and consequently downtime estimation, more precise.

Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial-bus: fix ports_map allocation on init
Alon Levy [Wed, 19 May 2010 09:31:38 +0000 (15:01 +0530)]
virtio-serial-bus: fix ports_map allocation on init

Fix for too small allocation to ports_map

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoresent: x86/cpuid: Add kvm32 CPU model
Andre Przywara [Fri, 21 May 2010 07:50:51 +0000 (09:50 +0200)]
resent: x86/cpuid: Add kvm32 CPU model

Create a kvm32 CPU model that describes a least common denominator
for KVM capable guest CPUs. Useful for migration purposes.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: add palette encoding
Corentin Chary [Wed, 19 May 2010 07:24:12 +0000 (09:24 +0200)]
vnc: tight: add palette encoding

Add palette tight encoding. Palette encoding will try to count the number
of colors for a given rectangle, and if this number is low enough
(< 256) it will send the palette + the rectangle with indexed colors.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: add support for tight fill encoding
Corentin Chary [Wed, 19 May 2010 07:24:11 +0000 (09:24 +0200)]
vnc: add support for tight fill encoding

Fill encoding detects rectangles using only one color and send only
one pixel value.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: add basic tight support
Corentin Chary [Wed, 19 May 2010 07:24:10 +0000 (09:24 +0200)]
vnc: add basic tight support

Add support for tight encoding [1]. This patch only add support
for "basic" tight compression without any filter.

[1] http://tigervnc.org/cgi-bin/rfbproto#tight-encoding.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: return the number of rectangles
Corentin Chary [Wed, 19 May 2010 07:24:09 +0000 (09:24 +0200)]
vnc: return the number of rectangles

Some encodings like tight supports tiling (spliting in
multiple sub-rectangles). So we needed a way to tell
vnc_update_client() how much rectangles are in the buffer.

zlib, raw and hextile always send a full rectangle.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: remove a memory leak in zlib
Corentin Chary [Wed, 19 May 2010 07:24:08 +0000 (09:24 +0200)]
vnc: remove a memory leak in zlib

Makes sure we free all ressources used in zlib encoding (zlib stream
and buffer).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: add buffer_free()
Corentin Chary [Wed, 19 May 2010 07:24:07 +0000 (09:24 +0200)]
vnc: add buffer_free()

Add a buffer_free() helper to free vnc buffers and
remove some duplicated code in vnc_disconnect_finish().

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: don't clear zlib stream on set_encoding
Corentin Chary [Wed, 19 May 2010 07:24:06 +0000 (09:24 +0200)]
vnc: don't clear zlib stream on set_encoding

On init, values are already NULL, but we shouldn't try
to reset them each time a client send a set encoding
command because this break everything. For example,
libvncclient re-send a set encoding command if the
framebuffer is resized.

This fix framebuffer resizing for zlib encoding.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: adjust compression zstream level
Corentin Chary [Wed, 19 May 2010 07:24:05 +0000 (09:24 +0200)]
vnc: adjust compression zstream level

Adjust zlib compression level if needed by calling deflateParams.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: only use a single zlib stream
Corentin Chary [Wed, 19 May 2010 07:24:04 +0000 (09:24 +0200)]
vnc: only use a single zlib stream

According to http://tigervnc.org/cgi-bin/rfbproto#zlib-encoding
zlib encoding only uses a single stream. Current implementation defines
4 streams but only uses the first one. Remove them and only use a single
stream.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: really call zlib if we want zlib
Corentin Chary [Wed, 19 May 2010 07:24:03 +0000 (09:24 +0200)]
vnc: really call zlib if we want zlib

send_framebuffer_update() was calling hextile instead of zlib
since commit 70a4568fe0c5a64adaa3da5030b7109e5199e692.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: explain why set_encodings loop is reversed
Corentin Chary [Wed, 19 May 2010 07:24:02 +0000 (09:24 +0200)]
vnc: explain why set_encodings loop is reversed

Add a small comment to explain why we need to start from
the end of the array to set the right prefered encoding.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "vnc: set the right prefered encoding"
Corentin Chary [Wed, 19 May 2010 07:24:01 +0000 (09:24 +0200)]
Revert "vnc: set the right prefered encoding"

This patch was wrong, because the loop was already reversed,
so the first encoding was correctly set at the end of the loopp.

This reverts commit 14eb8b6829ad9dee7035de729e083844a425f274.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoioapic: improve debugging
Blue Swirl [Mon, 31 May 2010 18:59:45 +0000 (18:59 +0000)]
ioapic: improve debugging

Add a DPRINTF macro, use it also to see irq deliveries.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix leul_to_cpu on big endian hosts
Alexander Graf [Tue, 11 May 2010 15:38:17 +0000 (17:38 +0200)]
Fix leul_to_cpu on big endian hosts

Commit 213acd2e introduced leul_to_cpu with a special code path for big endian
hosts. Unfortunately that code used preprocessor magic that didn't work.

This patch replaces the explicit ##s by glue() which is proven to work reliably,
enabling me to compile qemu on ppc again.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoarm: fix arm kernel boot for non zero start addr
Lars Munch [Sat, 8 May 2010 20:43:35 +0000 (22:43 +0200)]
arm: fix arm kernel boot for non zero start addr

Booting an arm kernel has been broken a while when booting from non zero start
address. This is due to the order of events: board init loads the kernel and
sets register 15 to the start address and then qemu_system_reset reset the cpu
making register 15 zero again.

This patch fixes the usage of the register 15 start address trick in
combination with arm_load_kernel.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: remove useless line
Thomas Monjalon [Fri, 28 May 2010 19:00:45 +0000 (21:00 +0200)]
target-ppc: remove useless line

This line was a bit clear.
The next lines set or reset this bit (LE) depending of another bit (ILE).
So the first line is useless.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: fix RFI by clearing some bits of MSR
Thomas Monjalon [Fri, 28 May 2010 19:07:32 +0000 (21:07 +0200)]
target-ppc: fix RFI by clearing some bits of MSR

Since commit 2ada0ed, "Return From Interrupt" is broken for PPC processors
because some interrupt specifics bits of SRR1 are copied to MSR.

SRR1 is a save of MSR during interrupt.
During RFI, MSR must be restored from SRR1.
But some bits of SRR1 are interrupt-specific and are not used for MSR saving.

This is the specification (ISA 2.06) at chapter 6.4.3 (Interrupt Processing):
"2. Bits 33:36 and 42:47 of SRR1 or HSRR1 are loaded with information specific
    to the interrupt type.
 3. Bits 0:32, 37:41, and 48:63 of SRR1 or HSRR1 are loaded with a copy of the
    corresponding bits of the MSR."

Below is a representation of MSR bits which are not saved:
0:15 16:31 32  33:36    37:41      42:47     48:63
——— | ——— | — X X X X — — — — — X X X X X X | ————
0000 0000 |    7   |   8   |   3   |   F    | 0000

History:
In the initial Qemu implementation (e1833e1), the mask 0x783F0000 was used for
saving MSR in SRR1. But all the bits 32:47 were cleared during RFI restoring.
This was wrong. The commit 2ada0ed explains that this breaks Altivec.
Indeed, bit 38 (for Altivec support) must be saved and restored.
The change of 2ada0ed was to restore all the bits of SRR1 to MSR.
But it's also wrong.

Explanation:
As an example, let's see what's happening after a TLB miss.
According to the e300 manual (E300CORERM table 5-6), the TLB miss interrupts
set the bits 44-47 for KEY, I/D, WAY and S/L. These bits are specifics to the
interrupt and must not be copied into MSR at the end of the interrupt.
With the current implementation, a TLB miss overwrite bits POW, TGPR and ILE.

Fix:
It shouldn't be needed to filter-out bits on MSR saving when interrupt occurs.
Specific bits overwrite MSR ones in SRR1.
But at the end of interrupt (RFI), specifics bits must be cleared before
restoring MSR from SRR1. The mask 0x783F0000 apply here.

Discussion:
The bits of the mask 0x783F0000 are cleared after an interrupt.
I cannot find a specification which talks about this
but I assume it is the truth since Linux can run this way.
Maybe it's not perfect but it's better (works for e300).

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agopci-hotplug: make them aware of pci domain.
Isaku Yamahata [Fri, 28 May 2010 09:30:46 +0000 (18:30 +0900)]
pci-hotplug: make them aware of pci domain.

add helper function which converts root bus to pci domain.
make them aware of pci domain.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agomsix: remove duplicated defines.
Isaku Yamahata [Thu, 27 May 2010 05:40:37 +0000 (14:40 +0900)]
msix: remove duplicated defines.

remove defines which are already defined in pci_regs.h

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agopci.h: remove unused constants.
Isaku Yamahata [Thu, 27 May 2010 05:40:02 +0000 (14:40 +0900)]
pci.h: remove unused constants.

So remove unused constants,
PCI_STATUS_RESERVED_MASK_LO, PCI_STATUS_RESERVED_MASK_HI,
PCI_COMMAND_RESERVED, PCI_COMMAND_RESERVED_MASK_HI.
They were used once, but they aren't used anymore.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agopci: add const to pci_is_express(), pci_config_size().
Isaku Yamahata [Thu, 27 May 2010 05:42:37 +0000 (14:42 +0900)]
pci: add const to pci_is_express(), pci_config_size().

add const to pci_is_express(), pci_config_size().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agopci: clean up of pci_set_default_subsystem_id().
Isaku Yamahata [Thu, 27 May 2010 05:42:06 +0000 (14:42 +0900)]
pci: clean up of pci_set_default_subsystem_id().

Use pci accessor function.
don't return value because it always return 0 and
the caller doesn't check the return value.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agomc146818rtc: improve debugging
Blue Swirl [Sun, 30 May 2010 19:20:07 +0000 (19:20 +0000)]
mc146818rtc: improve debugging

Add a separate flag for debugging coalesced interrupts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc32 SuperSPARC MMU Breakpoint Action register (SS-20 OBP fix)
Artyom Tarasenko [Sat, 29 May 2010 20:48:25 +0000 (22:48 +0200)]
sparc32 SuperSPARC MMU Breakpoint Action register (SS-20 OBP fix)

SuperSPARC MMU Breakpoint Action register is used by OBP at boot

The patch allows booting Solaris and some other OS with
SPARCStation-20 OBP.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agopc: improve debugging
Blue Swirl [Sat, 29 May 2010 20:23:49 +0000 (20:23 +0000)]
pc: improve debugging

Add a DPRINTF macro and use it for ISA and PIC interrupts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoapic: improve debugging
Blue Swirl [Sat, 29 May 2010 20:23:48 +0000 (20:23 +0000)]
apic: improve debugging

Add a DPRINTF macro. Use TARGET_FMT_plx for printing target_phys_addr_t
items. Add a separate flag for debugging coalescing interrupts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoi8259: improve debugging
Blue Swirl [Sat, 29 May 2010 20:23:19 +0000 (20:23 +0000)]
i8259: improve debugging

Add a DPRINTF macro.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix user emulator build
Blue Swirl [Sat, 29 May 2010 10:20:44 +0000 (10:20 +0000)]
sparc64: fix user emulator build

Accesses with _nucleus prefix are not available when building user
emulators:
  CC    sparc64-linux-user/op_helper.o
cc1: warnings being treated as errors
/src/qemu/target-sparc/op_helper.c: In function 'helper_ldda_asi':
/src/qemu/target-sparc/op_helper.c:3063: error: implicit declaration of function 'ldq_nucleus'

Avoid making such accesses. Fixes breakage by 54a3c0f032abf93d1cedc75456af75401ac10360.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPad iommu with an empty slot (necessary for SunOS 4.1.4)
Artyom Tarasenko [Sat, 8 May 2010 14:10:14 +0000 (16:10 +0200)]
Pad iommu with an empty slot (necessary for SunOS 4.1.4)

On the real hardware (SS-5, LX) the MMU is not padded, but aliased.
Software shouldn't use aliased addresses, neither should it crash
when it uses (on the real hardware it wouldn't). Using empty_slot
instead of aliasing can help with debugging such accesses.

Signed-off-by: Artyom Tarasenko <atar4qemu@googlemail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix 128-bit atomic load from nucleus context v1
Igor V. Kovalenko [Fri, 28 May 2010 21:05:46 +0000 (01:05 +0400)]
sparc64: fix 128-bit atomic load from nucleus context v1

- change 128-bit atomic loads to reference nucleus context
v0->v1: dropped disassembler change
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPre-allocate guest address space
Paul Brook [Sat, 29 May 2010 01:27:35 +0000 (02:27 +0100)]
Pre-allocate guest address space

Allow pre-allocation of the guest virtual address space in usermode emulation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoalpha-linux-user: Fill in SI_CODE for SIGSEGV.
Richard Henderson [Fri, 21 May 2010 17:03:33 +0000 (10:03 -0700)]
alpha-linux-user: Fill in SI_CODE for SIGSEGV.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: Use qemu-malloc.c.
Richard Henderson [Fri, 21 May 2010 17:37:52 +0000 (10:37 -0700)]
linux-user: Use qemu-malloc.c.

Since we're no longer setting PAGE_RESERVED, there's no need to
implement qemu_malloc via mmap.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoUse calloc in qemu_mallocz.
Richard Henderson [Fri, 21 May 2010 17:37:51 +0000 (10:37 -0700)]
Use calloc in qemu_mallocz.

Avoids the memset if the allocator has gotten new zeroed
storage from the operating system.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: Fix compilation with DEBUG defined
Riccardo Magliocchetti [Wed, 19 May 2010 19:49:21 +0000 (21:49 +0200)]
linux-user: Fix compilation with DEBUG defined

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix hw/gt64xxx.c compilation with DEBUG defined
Riccardo Magliocchetti [Wed, 19 May 2010 16:49:30 +0000 (18:49 +0200)]
Fix hw/gt64xxx.c compilation with DEBUG defined

Use TARGET_FMT_plx as format placeholder for target_phys_addr_t

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix typo in balloon help
Riccardo Magliocchetti [Wed, 19 May 2010 16:49:28 +0000 (18:49 +0200)]
Fix typo in balloon help

Fix launchpad #563883

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomusicpal: Drop redundant reset call
Jan Kiszka [Thu, 13 May 2010 13:09:58 +0000 (15:09 +0200)]
musicpal: Drop redundant reset call

Reset is now triggered after init, no need for explicit calls anymore.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agodoc: Update monitor info subcommands
Stefan Hajnoczi [Wed, 12 May 2010 14:10:56 +0000 (15:10 +0100)]
doc: Update monitor info subcommands

The "info blockstats" documentation was copy-pasted as "info block"
instead of "info blockstats".  The documentation for "commands", "jit",
"numa", "qdm", and "roms" is missing.  This patch resolves these issues
in qemu-monitor.hx.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix overflow in i440fx_init()
Avi Kivity [Sun, 9 May 2010 11:51:13 +0000 (14:51 +0300)]
Fix overflow in i440fx_init()

The ram_size parameter can be larger than an int, so it may be truncated.

Fix by using the correct type.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoarm: prevent coprocessor IO reset
Lars Munch [Sat, 8 May 2010 20:42:43 +0000 (22:42 +0200)]
arm: prevent coprocessor IO reset

This prevent coprocessor IO structure from being reset on cpu reset. This was
a problem for PXA which uses coprocessor 6 and 14.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg: Use INDEX_op_qemu_ld32 for 32-bit results.
Richard Henderson [Mon, 3 May 2010 23:30:48 +0000 (16:30 -0700)]
tcg: Use INDEX_op_qemu_ld32 for 32-bit results.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoblock: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format()
Nicholas A. Bellinger [Thu, 27 May 2010 15:56:28 +0000 (08:56 -0700)]
block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format()

This patch adds a missing bdrv_delete() call in find_image_format() so that a
SG_IO BlockDriver properly releases the temporary BlockDriverState *bs created
from bdrv_file_open()

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Reported-by: Chris Krumme <chris.krumme@windriver.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Fix corruption after error in update_refcount
Kevin Wolf [Fri, 28 May 2010 10:21:27 +0000 (12:21 +0200)]
qcow2: Fix corruption after error in update_refcount

After it is done with updating refcounts in the cache, update_refcount writes
all changed entries to disk. If a refcount block allocation fails, however,
there was no change yet and therefore first_index = last_index = -1. Don't
treat -1 as a normal sector index (resulting in a 512 byte write!) but return
without updating anything in this case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Fix corruption after refblock allocation
Kevin Wolf [Fri, 28 May 2010 10:05:45 +0000 (12:05 +0200)]
qcow2: Fix corruption after refblock allocation

Refblock allocation code needs to take into consideration that update_refcount
will load a different refcount block into the cache, so it must initialize the
cache for a new refcount block only afterwards. Not doing this means that not
only the refcount in the wrong block is updated, but also that the caller will
work on the wrong block.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Return right error code in write_refcount_block_entries
Kevin Wolf [Fri, 28 May 2010 07:47:44 +0000 (09:47 +0200)]
qcow2: Return right error code in write_refcount_block_entries

write_refcount_block_entries used to return -EIO for any errors. Change this to
return the real error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Change l2_load to return 0/-errno
Kevin Wolf [Fri, 21 May 2010 16:25:20 +0000 (18:25 +0200)]
qcow2: Change l2_load to return 0/-errno

Provide the error code to the caller instead of just indicating success/error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Allow qcow2_get_cluster_offset to return errors
Kevin Wolf [Fri, 21 May 2010 15:59:36 +0000 (17:59 +0200)]
qcow2: Allow qcow2_get_cluster_offset to return errors

qcow2_get_cluster_offset() looks up a given virtual disk offset and returns the
offset of the corresponding cluster in the image file. Errors (e.g. L2 table
can't be read) are currenctly indicated by a return value of 0, which is
unfortuately the same as for any unallocated cluster. So in effect we can't
check for errors.

This makes the old return value a by-reference parameter and returns the usual
0/-errno error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock.h: Make BDRV_SECTOR_SIZE 64 bit safe
Jes Sorensen [Thu, 27 May 2010 13:46:55 +0000 (15:46 +0200)]
block.h: Make BDRV_SECTOR_SIZE 64 bit safe

C defaults to int, so make definition of BDRV_SECTOR_SIZE 64 bit
safe as it and BDRV_SECTOR_MASK may be used against 64 bit addresses.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoposix-aio-compat: Expand tabs that have crept in
Stefan Hajnoczi [Thu, 27 May 2010 11:52:08 +0000 (12:52 +0100)]
posix-aio-compat: Expand tabs that have crept in

This patch expands tabs on a few lines so the code formats nicely and
follows the QEMU coding style.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>