sdk/emulator/qemu.git
14 years agoe1000: make some tables 'const'
Blue Swirl [Fri, 14 May 2010 19:32:18 +0000 (19:32 +0000)]
e1000: make some tables 'const'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoide: make a table 'const'
Blue Swirl [Fri, 14 May 2010 19:32:14 +0000 (19:32 +0000)]
ide: make a table 'const'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovga: make some tables 'const'
Blue Swirl [Fri, 14 May 2010 19:32:11 +0000 (19:32 +0000)]
vga: make some tables 'const'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile virtio-9p-debug and virtio-9p-local once
Blue Swirl [Fri, 14 May 2010 19:31:53 +0000 (19:31 +0000)]
Compile virtio-9p-debug and virtio-9p-local once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMerge remote branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Fri, 14 May 2010 15:56:56 +0000 (10:56 -0500)]
Merge remote branch 'qemu-kvm/uq/master' into staging

14 years agoUpdate SeaBIOS
Anthony Liguori [Tue, 11 May 2010 12:56:30 +0000 (07:56 -0500)]
Update SeaBIOS

 - 7d09d0e Fix virtio compile errors on various gcc versions.
 - 89acfa3 Support for booting from virtio disks
 - 6d66316 smbios: avoid counting io hole as ram
 - e5cd945 Fix error causing USB HID "boot" protocol to not be enabled.
 - 0e88576 Add support for USB mice.
 - dd5a8a6 When USB keyboard active, don't send keyboard commands to ps2 port.
 - 5718d56 Document usb-hid.c functions.
 - e438b0c Further parallelize init when using CONFIG_THREAD_OPTIONROMS.
 - f59b5ac Handle unknown function addresses in tools/checkstack.py.
 - 9ba1dea Simplify build by manually resolving external symbols in layoutrom.py.
 - 698d3f9 USB EHCI should yield() whil waiting for controller to ack reset.
 - f9a774c Add __attribute__((__malloc__)) declaration to internal malloc funcs.
 - b7045ce Minor - remove redundant check from ata_try_dma.
 - 67f6d37 Fix possible unitialized variable issue in usb msc.
 - a7eb8fc Some improvements to optionrom preemption support.
 - d28b0fe Refactor USB hub code.
 - ba28541 Prep version for next release.
 - 12bffd5 Update version to 0.6.0.
 - 87ab2fb Improve USB EHCI timing.
 - d705e5a Disable inlining on old compilers.
 - bca0736 Force use of indirect function calls in inline assembler.
 - d7eb27e Don't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).
 - 7415270 Call to int1552 (from int1346) should set regs->dl.
 - 9dc243e Adjust debug levels of device discovery.
 - d9c9361 Default CONFIG_COREBOOT_FLASH on; make depend on CONFIG_COREBOOT.
 - c35e1e5 Restore segment limits in handle_1589 code.
 - 11cc662 Extend time for rtc to be ready.
 - 4ed378a Backup and restore registers when calling out to user funcs.
 - 68c5139 Enable irqs in kbd/clock calls that caller might "spin" on.
 - f628244 Process event on ps2 keyboard irq even if event already read.
 - a5d8458 Revert "Unify ps2 port data processing."
 - b9ed5e2 Handle variable length return of ps2 port GETID command.
 - 67a9eec Prevent ps2 irqs from messing up ps2 init.
 - 6704cf9 Revert "Rework disabling of ps2 port irqs."
 - 808939c Fix smp cpu detect on gcc 4.5.
 - a979c1c Improvements to tools/checkstack.py.
 - 190cc62 Add USB EHCI controller support.
 - 0770d67 Some USB UHCI and OHCI fixes and cleanups.
 - bfe7ca7 Minor - USB OHCI interrupt queue should be one larger.
 - 09e2f7c Reduce size of USB 'struct uhci_td'.
 - 406fad6 Dynamically allocate USB controller structures.
 - 4547eb9 Replace USB encoded 'u32 endp' scheme with explicit struct fields.
 - 8ebcac0 Further parallelize USB init by launching a thread per usb port.
 - e908665 Introduce simple "mutex" locking code.
 - 3b79f8b Only compile usb-hub.c and paravirt.c with 32bit code.
 - 357bdfa Prefer passing a USB "pipe" structure over a USB endp encoding.
 - 7fb8ba8 Add a generic "internal error" warning function.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopckbd: don't use any static state
Blue Swirl [Wed, 12 May 2010 19:27:23 +0000 (19:27 +0000)]
pckbd: don't use any static state

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoapb: don't use any static state
Blue Swirl [Wed, 12 May 2010 19:27:23 +0000 (19:27 +0000)]
apb: don't use any static state

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-sparc: Fix wrong printf argument
Stefan Weil [Wed, 12 May 2010 18:34:39 +0000 (20:34 +0200)]
target-sparc: Fix wrong printf argument

cpu_get_ccr() returns a target_ulong, so a type cast is needed to avoid
wrong output on big endian hosts. We could also use TARGET_FMT_lx,
but that would print 8 instead of 2 digits.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoUpdate OpenBIOS images to r771
Blue Swirl [Wed, 12 May 2010 18:57:14 +0000 (18:57 +0000)]
Update OpenBIOS images to r771

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agokvm: fix 80000001.EDX supported bit filtering
Gleb Natapov [Tue, 11 May 2010 06:41:25 +0000 (09:41 +0300)]
kvm: fix 80000001.EDX supported bit filtering

On AMD some bits from 1.EDX are reported in 80000001.EDX. The mask used
to copy bits from 1.EDX to 80000001.EDX is incorrect resulting in
unsupported features passed into a guest.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agoDo not stop VM if emulation failed in userspace.
Gleb Natapov [Mon, 10 May 2010 08:21:34 +0000 (11:21 +0300)]
Do not stop VM if emulation failed in userspace.

Continue vcpu execution in case emulation failure happened while vcpu
was in userspace. In this case #UD will be injected into the guest
allowing guest OS to kill offending process and continue.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agokvm: enable smp > 1
Marcelo Tosatti [Tue, 4 May 2010 12:45:27 +0000 (09:45 -0300)]
kvm: enable smp > 1

Process INIT/SIPI requests and enable -smp > 1.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agokvm: validate context for kvm cpu get/put operations
Jan Kiszka [Tue, 4 May 2010 12:45:26 +0000 (09:45 -0300)]
kvm: validate context for kvm cpu get/put operations

Validate that KVM vcpu state is only read/written from cpu thread itself
or that cpu is stopped.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agomove stop/stopped CPU_COMMON fields after area zeroed by reset
Marcelo Tosatti [Tue, 4 May 2010 12:45:25 +0000 (09:45 -0300)]
move stop/stopped CPU_COMMON fields after area zeroed by reset

cpu_reset zeroes CPUState upto breakpoints member. Contents of
stop/stopped should not be zeroed on cpu_reset.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agoadd cpu_is_stopped helper
Marcelo Tosatti [Tue, 4 May 2010 12:45:24 +0000 (09:45 -0300)]
add cpu_is_stopped helper

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agokvm: synchronize state from cpu context
Jan Kiszka [Tue, 4 May 2010 12:45:23 +0000 (09:45 -0300)]
kvm: synchronize state from cpu context

It is not safe to retrieve the KVM internal state of a given cpu
while its potentially modifying it.

Queue the request to run on cpu context, similarly to qemu-kvm.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agoport qemu-kvm's on_vcpu code
Marcelo Tosatti [Tue, 4 May 2010 12:45:22 +0000 (09:45 -0300)]
port qemu-kvm's on_vcpu code

run_on_cpu allows to execute work on a given CPUState context.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agostandardize on qemu_cpu_kick for signalling cpu thread(s)
Marcelo Tosatti [Tue, 4 May 2010 12:45:21 +0000 (09:45 -0300)]
standardize on qemu_cpu_kick for signalling cpu thread(s)

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agomake SIG_IPI to tcg vcpu thread reliable
Marcelo Tosatti [Tue, 4 May 2010 12:45:20 +0000 (09:45 -0300)]
make SIG_IPI to tcg vcpu thread reliable

Store tcg loop exit request on a global variable, and transfer it to
per-CPUState exit_request after assignment of cpu_single_env.

This makes exit request signal from robust. Drop the timedlock hack.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agokvm: set cpu_single_env around KVM_RUN ioctl
Marcelo Tosatti [Tue, 4 May 2010 12:45:19 +0000 (09:45 -0300)]
kvm: set cpu_single_env around KVM_RUN ioctl

Zero cpu_single_env before leaving global lock protection, and
restore on return.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agoFix -mem-path with hugetlbfs
Marcelo Tosatti [Mon, 3 May 2010 21:12:23 +0000 (18:12 -0300)]
Fix -mem-path with hugetlbfs

Fallback to qemu_vmalloc in case file_ram_alloc fails.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agodoc: Clean up monitor command function index
Markus Armbruster [Tue, 4 May 2010 11:20:33 +0000 (13:20 +0200)]
doc: Clean up monitor command function index

Remove bogus entries "count", "format" and "size".  Accidentally added
in commit 70fcbbe7.

Add missing entry "qmp_capabilities".  Was forgotten in commit
4a7e1190.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodoc: Heading for monitor command cpu got lost, restore it
Markus Armbruster [Tue, 4 May 2010 11:20:32 +0000 (13:20 +0200)]
doc: Heading for monitor command cpu got lost, restore it

Broken in commit 2313086a.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodoc: Fix acl monitor command documentation
Markus Armbruster [Tue, 4 May 2010 11:20:31 +0000 (13:20 +0200)]
doc: Fix acl monitor command documentation

Commit 15dfcd45 added acl_add and acl_reset, but fat-fingered their
documentation to read acl_allow and acl_remove.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodoc: Fix host forwarding monitor command documentation
Markus Armbruster [Tue, 4 May 2010 11:20:30 +0000 (13:20 +0200)]
doc: Fix host forwarding monitor command documentation

Commit f3546deb replaced host_net_redir by hostfwd_add,
hostfwd_remove, but neglected to update documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Handle removal of selected devices
Jan Kiszka [Tue, 4 May 2010 12:21:03 +0000 (14:21 +0200)]
lsi: Handle removal of selected devices

We must not store references to selected devices as they may be
hot-removed. Instead, look up the device based on its tag right before
using it. If the device disappeared, throw an interrupt and disconnect.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Adjust some register reset values
Jan Kiszka [Tue, 4 May 2010 12:21:02 +0000 (14:21 +0200)]
lsi: Adjust some register reset values

According to the LSI spec, the reset value of dcmd, dstat, and ctest2
were wrong, and sdid as well as ssid require zero initialization. There
are surely more discrepancies, this is just another increment.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Purge message queue on reset
Jan Kiszka [Tue, 4 May 2010 12:21:01 +0000 (14:21 +0200)]
lsi: Purge message queue on reset

Declare the input message queue empty and initialize the related state
machine properly on controller reset. This fixes unrecoverable errors
when the controller was reset during ongoing requests.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: Clear aiocb on read completion
Jan Kiszka [Tue, 4 May 2010 12:21:00 +0000 (14:21 +0200)]
scsi-disk: Clear aiocb on read completion

Once the I/O completion callback returned, aiocb will be released by the
controller. So we have to clear the reference not only in
scsi_write_complete, but also in scsi_read_complete. Otherwise we risk
inconsistencies when a reset hits us before the related request is
released.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoSCSI: Add disk reset handler
Jan Kiszka [Tue, 4 May 2010 12:20:59 +0000 (14:20 +0200)]
SCSI: Add disk reset handler

Ensure that pending requests of an SCSI disk are purged on system reset
and also restore max_lba. The latter is no only present in the reset
handler as that one is called after init as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoiov: Move from hw/ to topdir
Amit Shah [Tue, 4 May 2010 11:09:07 +0000 (16:39 +0530)]
iov: Move from hw/ to topdir

The iov functions can be useful to other code as well.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: set the right prefered encoding
Corentin Chary [Tue, 4 May 2010 12:01:58 +0000 (14:01 +0200)]
vnc: set the right prefered encoding

message is a hint by the client as to its preference (the first
encoding specified being most preferred)"

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosparc: Fix lazy flag calculation on interrupts, refactor
Blue Swirl [Sun, 9 May 2010 20:19:04 +0000 (20:19 +0000)]
sparc: Fix lazy flag calculation on interrupts, refactor

Recalculate Sparc64 CPU flags on interrupts, otherwise some earlier
flags could be stored to pstate.

Refactor PSR/CCR/CWP handling: concentrate the actual
functions to op_helper.c.

Thanks to Igor Kovalenko for reporting.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc: lazy C flag calculation
Blue Swirl [Sun, 9 May 2010 15:40:24 +0000 (15:40 +0000)]
sparc: lazy C flag calculation

Calculate only the carry flag for ADDX/SUBX instead of full
set of flags.

Thanks to Igor Kovalenko for spotting a bug with an earlier
version.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agomips-dis: Add missing static attributes
Stefan Weil [Fri, 7 May 2010 21:20:56 +0000 (23:20 +0200)]
mips-dis: Add missing static attributes

mips_abi_choices and mips_arch_choices are only used locally.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Add missing 'static' attribute
Stefan Weil [Fri, 7 May 2010 17:47:31 +0000 (19:47 +0200)]
tcg: Add missing 'static' attribute

tcg_out_reloc is only used locally (in */target.c which is
included in tcg.c).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoqcow2: Remove static forward declaration
Kevin Wolf [Fri, 7 May 2010 10:43:46 +0000 (12:43 +0200)]
qcow2: Remove static forward declaration

OpenBSDs gcc is said to generate warnings for this declaration, so don't
reference bdrv_qcow2 directly, but look it up using bdrv_find_format.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRevert "Fix OpenBSD build"
Kevin Wolf [Fri, 7 May 2010 10:43:45 +0000 (12:43 +0200)]
Revert "Fix OpenBSD build"

This reverts commit 20d97356c9df6d68fbd37d6334fdb7063f24eab6.
The BlockDriver definition should stay at the end of source files.

Conflicts:

block/qcow2.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFill in unassigned mem read/write callbacks.
Richard Henderson [Fri, 7 May 2010 16:52:51 +0000 (09:52 -0700)]
Fill in unassigned mem read/write callbacks.

Implement the "functions may be omitted with NULL pointer"
interface mentioned in the function block comment by transforming
NULL entries in the read/write arrays into calls to the
unassigned_mem family of functions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agodarwin-user: Add missing static attribute
Stefan Weil [Thu, 6 May 2010 20:19:20 +0000 (22:19 +0200)]
darwin-user: Add missing static attribute

Function usage is only used locally, so add "static".

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoAdd missing 'static' attribute
Stefan Weil [Thu, 6 May 2010 20:17:54 +0000 (22:17 +0200)]
Add missing 'static' attribute

Function usage() is only used locally.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: fix build with older gccs
Blue Swirl [Fri, 7 May 2010 16:14:59 +0000 (16:14 +0000)]
sparc64: fix build with older gccs

Fix errors missed in 2065061ede22d401aae2ce995c3af54db9d28639:
 CC    sparc64-softmmu/helper.o
cc1: warnings being treated as errors
/src/qemu/target-sparc/helper.c: In function 'get_physical_address':
/src/qemu/target-sparc/helper.c:426: warning: 'context' may be used uninitialized in this function
/src/qemu/target-sparc/helper.c:426: note: 'context' was declared here

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: handle asi referencing nucleus and secondary MMU contexts
Igor V. Kovalenko [Mon, 3 May 2010 07:29:44 +0000 (11:29 +0400)]
sparc64: handle asi referencing nucleus and secondary MMU contexts

- increase max supported MMU modes to 6
- handle nucleus context asi
- handle secondary context asi
- handle non-faulting loads from secondary context

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: implement global translation table entries v1
Igor V. Kovalenko [Tue, 4 May 2010 19:15:41 +0000 (23:15 +0400)]
sparc64: implement global translation table entries v1

- match global tte against any context
- show global tte in MMU dump

v0->v1: added default case to switch statement in demap_tlb
- should fix gcc warning about uninitialized context variable

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc64: more ultrasparc asi extensions for disassembler
Igor V. Kovalenko [Mon, 3 May 2010 07:29:34 +0000 (11:29 +0400)]
sparc64: more ultrasparc asi extensions for disassembler

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoqemu: address todo comment in exec.c
Michael S. Tsirkin [Tue, 6 Apr 2010 11:18:19 +0000 (14:18 +0300)]
qemu: address todo comment in exec.c

exec.c has a comment 'XXX: optimize' for lduw_phys/stw_phys,
so let's do it, along the lines of stl_phys.

The reason to address 16 bit accesses specifically is that virtio relies
on these accesses to be done atomically, using memset as we do now
breaks this assumption, which is reported to cause qemu with kvm
to read wrong index values under stress.

https://bugzilla.redhat.com/show_bug.cgi?id=525323

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix zero-length write(2).
Richard Henderson [Mon, 29 Mar 2010 17:54:42 +0000 (10:54 -0700)]
Fix zero-length write(2).

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoBetter default guest_base
Paul Brook [Wed, 5 May 2010 15:32:59 +0000 (16:32 +0100)]
Better default guest_base

Avoid loading linux-user applications in address space already used/reserved
by the host.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoRemove PAGE_RESERVED
Paul Brook [Wed, 5 May 2010 15:32:59 +0000 (16:32 +0100)]
Remove PAGE_RESERVED

The usermode PAGE_RESERVED code is not required by the current mmap
implementation, and is already broken when guest_base != 0.
Unfortunately the bsd emulation still uses the old mmap implementation,
so we can't rip it out altogether.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoAvoid libaio for usermode
Paul Brook [Wed, 5 May 2010 15:32:59 +0000 (16:32 +0100)]
Avoid libaio for usermode

Linux AIO is aonly used by system emulation, so should not be linked into
the userspace emulatior.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoEnable -d cpu logging by default.
Richard Henderson [Wed, 28 Apr 2010 23:07:57 +0000 (16:07 -0700)]
Enable -d cpu logging by default.

When -d cpu logging was handled by target-foo/translate.c,
it was controled by DEBUG_DISAS, which is enabled by default.
Use the same condition in cpu_exec.

At the same time, reduce the if-deffery by assuming no flags
update is required for the target.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-sh4: Remove duplicate CPU log.
Richard Henderson [Mon, 5 Apr 2010 22:58:20 +0000 (15:58 -0700)]
target-sh4: Remove duplicate CPU log.

Logging for -d cpu is done in generic code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: Remove duplicate cpu log.
Richard Henderson [Mon, 5 Apr 2010 22:57:41 +0000 (15:57 -0700)]
target-ppc: Remove duplicate cpu log.

Logging for -d cpu is done in generic code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: Remove duplicate CPU log.
Richard Henderson [Mon, 5 Apr 2010 22:56:51 +0000 (15:56 -0700)]
target-mips: Remove duplicate CPU log.

Logging for -d cpu is done in generic code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-i386: Remove duplicate CPU log.
Richard Henderson [Sun, 4 Apr 2010 18:40:44 +0000 (11:40 -0700)]
target-i386: Remove duplicate CPU log.

The proper logging for -d cpu is done in generic code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix cpu list("-cpu ?") breakage, spotted by TeLeMan
Blue Swirl [Tue, 4 May 2010 19:55:35 +0000 (19:55 +0000)]
Fix cpu list("-cpu ?") breakage, spotted by TeLeMan

Fix breakage by 04c9a0cbc2bf496889cef6da2d61bf00ef190a4f.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovnc: make sure to send pointer type change event on SetEncodings
Anthony Liguori [Tue, 4 May 2010 13:28:13 +0000 (08:28 -0500)]
vnc: make sure to send pointer type change event on SetEncodings

Commit 37c34d9d5d87ea9d51760310c8863b82cb8c055a introduced a regression when
using relative mouse mode with a client that understands the PointerTypeChange
pseudo-encoding.

Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agohw: better i440 emulation
Bernhard M. Wiedemann [Tue, 20 Apr 2010 18:48:06 +0000 (20:48 +0200)]
hw: better i440 emulation

updated version of an old patch
http://xenon.stanford.edu/~eswierk/misc/qemu-linuxbios/qemu-piix-ram-size.patch
that together with
http://www.mail-archive.com/linuxbios@linuxbios.org/msg02390.html
(which is already in coreboot trunk) allows coreboot to autodetect the amount of RAM within qemu/kvm from a register in i440 northbridge.

The message on the old patch states:
Unfortunately the current version of qemu does not set these
registers, but I have patched qemu so that it emulates the i440 more
faithfully in this regard.

Signed-off-by: Bernhard M. Wiedemann <qemudevbmw@lsmod.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: read-only: open cdrom as read-only when using monitor's change command
Naphtali Sprei [Sun, 25 Apr 2010 16:30:37 +0000 (19:30 +0300)]
block: read-only: open cdrom as read-only when using monitor's change command

Current code of monitor command: 'change', used to open file for read-write
uncoditionally. Change to open it as read-only for CDROM, and read-write for all others.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix whitespace bogon in some versions of make
Nathan Froyd [Mon, 26 Apr 2010 21:52:23 +0000 (14:52 -0700)]
fix whitespace bogon in some versions of make

With three different make binaries I have available, configuring a
pristine QEMU tree and attempting to make gives the cryptic:

Makefile:27: *** missing separator.  Stop.

This patch fixes it (presumably because it makes the output of
`set-vpath' be an empty string, rather than a bit of whitespace), but I
don't understand why this hasn't been a problem for other folks before.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoChanges to usb-linux to conform to coding style
David Ahern [Sat, 24 Apr 2010 16:26:22 +0000 (10:26 -0600)]
Changes to usb-linux to conform to coding style

Signed-off-by: David Ahern <daahern@cisco.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd KVM CFLAGS to vhost build
Jan Kiszka [Tue, 6 Apr 2010 11:31:29 +0000 (13:31 +0200)]
Add KVM CFLAGS to vhost build

The configure test of vhost uses KVM CFLAGS, so the build must use them
as well. Otherwise we specifically miss what --kerneldir provides.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Introduce RESUME event
Luiz Capitulino [Tue, 27 Apr 2010 23:35:59 +0000 (20:35 -0300)]
QMP: Introduce RESUME event

It's emitted when the Virtual Machine resumes execution.

We currently have the STOP event but don't have the matching
RESUME one, this means that clients are notified when the VM
is stopped but don't get anything when it resumes.

Let's fix that as it's already causing some trouble to libvirt.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Create a syntactic shortcut for the file-system pass-thru
Gautham R Shenoy [Thu, 29 Apr 2010 12:15:03 +0000 (17:45 +0530)]
virtio-9p: Create a syntactic shortcut for the file-system pass-thru

Currently the commandline to create a virtual-filesystem pass-through between
the guest and the host is as follows:
#qemu -fsdev fstype,id=ID,path=path/to/share \
      -device virtio-9p-pci,fsdev=ID,mount_tag=tag \

This patch provides a syntactic short-cut to achieve the same as follows:
#qemu -virtfs fstype,path=path/to/share,mount_tag=tag

This will be internally expanded as:
#qemu -fsdev fstype,id=tag,path=path/to/share, \
      -device virtio-9p-pci,fsdev=tag,mount_tag=tag \

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TFLUSH support
Anthony Liguori [Thu, 29 Apr 2010 12:15:02 +0000 (17:45 +0530)]
virtio-9p: Add P9_TFLUSH support

Don't do anything special for flush.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TREMOVE support.
Anthony Liguori [Thu, 29 Apr 2010 12:15:01 +0000 (17:45 +0530)]
virtio-9p: Add P9_TREMOVE support.

Implement P9_TREMOVE support.
This gets file deletion to work.

[mohan@in.ibm.com: Fix truncate to use the relative path]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TWSTAT support
Anthony Liguori [Thu, 29 Apr 2010 12:15:00 +0000 (17:45 +0530)]
virtio-9p: Add P9_TWSTAT support

Implement P9_TWSTAT support.
This gets file and directory creation to work.

[jvrao@linux.vnet.ibm.com: strdup to qemu_strdup conversion]
[aneesh.kumar@linux.vnet.ibm.com: v9fs_fix_path]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TCREATE support
Anthony Liguori [Thu, 29 Apr 2010 12:14:59 +0000 (17:44 +0530)]
virtio-9p: Add P9_TCREATE support

Implement P9_TCREATE support.
[jvrao@linux.vnet.ibm.com: strdup to qemu_strdup conversion]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TWRITE support
Anthony Liguori [Thu, 29 Apr 2010 12:14:58 +0000 (17:44 +0530)]
virtio-9p: Add P9_TWRITE support

Implement P9_TWRITE support.
This gets write to file to work

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TCLUNK support
Anthony Liguori [Thu, 29 Apr 2010 12:14:57 +0000 (17:44 +0530)]
virtio-9p: Add P9_TCLUNK support

Implement P9_TCLUNK support.
This patch gets `ls -al` to work.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TREAD support
Anthony Liguori [Thu, 29 Apr 2010 12:14:56 +0000 (17:44 +0530)]
virtio-9p: Add P9_TREAD support

Implement P9_TREAD support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TOPEN support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:55 +0000 (17:44 +0530)]
virtio-9p: Add P9_TOPEN support.

Implement P9_TOPEN support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TWALK support
Anthony Liguori [Thu, 29 Apr 2010 12:14:54 +0000 (17:44 +0530)]
virtio-9p: Add P9_TWALK support

Implement P9_TWALK support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TSTAT support
Anthony Liguori [Thu, 29 Apr 2010 12:14:53 +0000 (17:44 +0530)]
virtio-9p: Add P9_TSTAT support

Implement P9_TSTAT support. This get the mount to work on the guest.

[kiran@linux.vnet.ibm.com: malloc to qemu_malloc conversion]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TATTACH support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:52 +0000 (17:44 +0530)]
virtio-9p: Add P9_TATTACH support.

Implement P9_TATTACH support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add P9_TVERSION support
Anthony Liguori [Thu, 29 Apr 2010 12:14:51 +0000 (17:44 +0530)]
virtio-9p: Add P9_TVERSION support

Implement P9_TVERSION support.

[sripathik@in.ibm.com: Handle unknown 9P versions as per the standards]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add sg helper functions
Anthony Liguori [Thu, 29 Apr 2010 12:14:50 +0000 (17:44 +0530)]
virtio-9p: Add sg helper functions

Add scatter-gather helper functions.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add stat and mode related helper functions.
Anthony Liguori [Thu, 29 Apr 2010 12:14:49 +0000 (17:44 +0530)]
virtio-9p: Add stat and mode related helper functions.

Add helpers to obtain file stat and mode details.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add fid and qid management support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:48 +0000 (17:44 +0530)]
virtio-9p: Add fid and qid management support.

Helper APIs for FID and QID management.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add minimal set of FileOperations
Anthony Liguori [Thu, 29 Apr 2010 12:14:47 +0000 (17:44 +0530)]
virtio-9p: Add minimal set of FileOperations

Add minimal set of FileOperations and the corresponding implementations for
local fstype. These will be required for the FID management patches later on.

[aneesh.kumar@linux.vnet.ibm.com: rpath fix ]
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add string manipulation support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:46 +0000 (17:44 +0530)]
virtio-9p: Add string manipulation support.

Add helpers to do string manipulation.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: pdu processing support.
Anthony Liguori [Thu, 29 Apr 2010 12:14:45 +0000 (17:44 +0530)]
virtio-9p: pdu processing support.

Add helpers to process the PDUs.

[kiran@linux.vnet.ibm.com: malloc to qemu_malloc coversion]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Add a virtio 9p device to qemu
Anthony Liguori [Thu, 29 Apr 2010 12:14:44 +0000 (17:44 +0530)]
virtio-9p: Add a virtio 9p device to qemu

This patch doesn't implement the 9p protocol handling
code. It adds a simple device which dump the protocol data.

[jvrao@linux.vnet.ibm.com: Little-Endian to host format conversion]
[aneesh.kumar@linux.vnet.ibm.com: Multiple-mounts support]

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-9p: Create a commandline option -fsdev
Gautham R Shenoy [Thu, 29 Apr 2010 12:14:43 +0000 (17:44 +0530)]
virtio-9p: Create a commandline option -fsdev

This patch creates a new command line option named -fsdev to hold any file
system specific information.

The option will currently hold the following attributes:
-fsdev fstype id=id,path=path_to_share
where
fstype: Type of the file system.
id:     Identifier used to refer to this fsdev
path:   The path on the host that is identified by this fsdev.

[aneesh.kumar@linux.vnet.ibm.com: Abstraction using FsContext]
Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Fix check for 'assert'; prevent NULL derefs
Amit Shah [Fri, 30 Apr 2010 11:13:55 +0000 (16:43 +0530)]
virtio-serial: Fix check for 'assert'; prevent NULL derefs

In the flush_queued_data() function, we expect port to be valid. Assert
only for port and not port || discard.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix the RARP protocol ID
Stefan Berger [Sat, 24 Apr 2010 12:54:07 +0000 (08:54 -0400)]
Fix the RARP protocol ID

The packet(s) sent out after migration are supposed to be RAPR type of
packets. If they are supposed to go anywhere useful, the RAPR ethernet
identifier needs to be fix.

Also see http://www.iana.org/assignments/ethernet-numbers for 0x8035 for
RARP.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix tiny leak in qemu_opts_parse
Jan Kiszka [Thu, 29 Apr 2010 16:24:43 +0000 (18:24 +0200)]
Fix tiny leak in qemu_opts_parse

qemu_opts_create duplicates the id we pass in case it shall be stored in
the opts. So we do not need to dup it in qemu_opts_parse, leaking a few
bytes this way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Properly initialize controller state on reset
Jan Kiszka [Fri, 30 Apr 2010 12:06:13 +0000 (14:06 +0200)]
lsi: Properly initialize controller state on reset

The LSI controller was lacking a system reset handler. Simply invoke the
existing soft reset handler in this case. This also allows to drop its
explicit invocation during init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agolsi: Purge request queue on soft reset
Jan Kiszka [Fri, 30 Apr 2010 12:06:12 +0000 (14:06 +0200)]
lsi: Purge request queue on soft reset

Avoid keeping zombie requests across controller reset by purging the
queue and also dropping the currently active request.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix boot once option
Alex Williamson [Fri, 30 Apr 2010 21:21:11 +0000 (15:21 -0600)]
Fix boot once option

The boot once options seems to have gotten broken since it originally
went in.  We need to wait until the second time restore_boot_devices()
gets called before restoring the standard boot order and removing itself
from the reset list.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
--
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: split encoding in specific files
Corentin Chary [Mon, 3 May 2010 12:31:34 +0000 (14:31 +0200)]
vnc: split encoding in specific files

This will allow to implement new encodings (tight, zrle, ..)
in a cleaner way. This may hurt performances, because some
functions like vnc_convert_pixel are not static anymore, but
should not be a problem with gcc 4.5 and the new -flto.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: Fix compile error on x86_64 with -D_VNC_DEBUG=1
Corentin Chary [Mon, 3 May 2010 12:31:18 +0000 (14:31 +0200)]
vnc: Fix compile error on x86_64 with -D_VNC_DEBUG=1

cc1: warnings being treated as errors
vnc-auth-sasl.c: In function ‘vnc_client_write_sasl’:
vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’
vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’
make: *** [vnc-auth-sasl.o] Error 1

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'kwolf/for-anthony' into HEAD
Anthony Liguori [Mon, 3 May 2010 12:31:51 +0000 (07:31 -0500)]
Merge remote branch 'kwolf/for-anthony' into HEAD

14 years agoMerge remote branch 'qemu-kvm/uq/master' into HEAD
Anthony Liguori [Mon, 3 May 2010 12:31:37 +0000 (07:31 -0500)]
Merge remote branch 'qemu-kvm/uq/master' into HEAD

14 years agoblock: Release allocated options after bdrv_open
Jan Kiszka [Thu, 29 Apr 2010 16:24:50 +0000 (18:24 +0200)]
block: Release allocated options after bdrv_open

They aren't used afterwards nor supposed to be stored by a bdrv_create
handler.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-img rebase: Fix output image corruption
Kevin Wolf [Thu, 29 Apr 2010 12:47:48 +0000 (14:47 +0200)]
qemu-img rebase: Fix output image corruption

qemu-img rebase must always give clusters in the COW file priority over those
in the backing file. As it failed to use number of non-allocated clusters but
assumed the maximum, it was possible that allocated clusters were taken from
the backing file instead, leading to a corrupted output image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Add wr_highest_sector blockstat
Kevin Wolf [Wed, 28 Apr 2010 12:34:01 +0000 (14:34 +0200)]
block: Add wr_highest_sector blockstat

This adds the wr_highest_sector blockstat which implements what is generally
known as the high watermark. It is the highest offset of a sector written to
the respective BlockDriverState since it has been opened.

The query-blockstat QMP command is extended to add this value to the result,
and also to add the statistics of the underlying protocol in a new "parent"
field. Note that to get the "high watermark" of a qcow2 image, you need to look
into the wr_highest_sector field of the parent (which can be a file, a
host_device, ...). The wr_highest_sector of the qcow2 BlockDriverState itself
is the highest offset on the _virtual_ disk that the guest has written to.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Implement bdrv_truncate() for growing images
Stefan Hajnoczi [Wed, 28 Apr 2010 10:36:11 +0000 (11:36 +0100)]
qcow2: Implement bdrv_truncate() for growing images

This patch adds the ability to grow qcow2 images in-place using
bdrv_truncate().  This enables qemu-img resize command support for
qcow2.

Snapshots are not supported and bdrv_truncate() will return -ENOTSUP.
The notion of resizing an image with snapshots could lead to confusion:
users may expect snapshots to remain unchanged, but this is not possible
with the current qcow2 on-disk format where the header.size field is
global instead of per-snapshot.  Others may expect snapshots to change
size along with the current image data.  I think it is safest to not
support snapshots and perhaps add behavior later if there is a
consensus.

Backing images continue to work.  If the image is now larger than its
backing image, zeroes are read when accessing beyond the end of the
backing image.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Remove abort on free_clusters failure
Kevin Wolf [Wed, 21 Apr 2010 09:37:52 +0000 (11:37 +0200)]
qcow2: Remove abort on free_clusters failure

While it's true that during regular operation free_clusters failure would be a
bug, an I/O error can always happen. There's no need to kill the VM, the worst
thing that can happen (and it will) is that we leak some clusters.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>