]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
11 years agoMerge remote-tracking branch 'quintela/migration-next-20120808' into staging
Anthony Liguori [Mon, 13 Aug 2012 21:02:11 +0000 (16:02 -0500)]
Merge remote-tracking branch 'quintela/migration-next-20120808' into staging

* quintela/migration-next-20120808:
  Restart optimization on stage3 update version
  Add XBZRLE statistics
  Add migration accounting for normal and duplicate pages
  Change total_time to total-time in MigrationStats
  Add migrate_set_cache_size command
  Add XBZRLE to ram_save_block and ram_save_live
  Add xbzrle_encode_buffer and xbzrle_decode_buffer functions
  Add uleb encoding/decoding functions
  Add cache handling functions
  Add XBZRLE documentation
  Add migrate-set-capabilities
  Add migration capabilities

11 years agoMerge remote-tracking branch 'pmaydell/arm-devs.next' into staging
Anthony Liguori [Mon, 13 Aug 2012 20:59:11 +0000 (15:59 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.next' into staging

* pmaydell/arm-devs.next:
  arm: Move some ARM devices into libhw
  ssd0323: abort() instead of exit(1) on error.
  hw/sd.c: make sd_wp_addr() return bool
  hw/sd.c: make sd_dataready() return bool
  hw/sd.c: convert binary variables to bool
  hw/sd.c: introduce wrapper for conversion address to wp group
  hw/sd.c: make sd_wp_addr() accept 64 bit address argument
  hw/sd.c: convert wp_groups in SDState to bitfield
  armv7m: Guard against no -kernel argument
  hw/armv7m_nvic: Fix incorrect default for num-irqs property

11 years agoarm: Move some ARM devices into libhw
Andreas Färber [Mon, 13 Aug 2012 02:11:12 +0000 (02:11 +0000)]
arm: Move some ARM devices into libhw

Avoids some unnecessary dependencies on cpu.h and prepares for
a future armeb-softmmu where most machines would not be built.

Defer touching the SoC devices since most have implicit or explicit
dependencies on the CPU.

Signed-off-by: Andreas Färber <andreas.faerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 13 Aug 2012 14:25:48 +0000 (09:25 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvm: Add documentation comment for kvm_irqchip_in_kernel()
  kvm: Decouple 'GSI routing' from 'kernel irqchip'
  kvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'
  kvm: Decouple 'irqfds usable' from 'kernel irqchip'
  kvm: Move kvm_allows_irq0_override() to target-i386, fix return type
  kvm: Rename kvm_irqchip_set_irq() to kvm_set_irq()
  kvm: Decouple 'async interrupt delivery' from 'kernel irqchip'
  configure: Don't implicitly hardcode list of KVM architectures
  kvm: Check if smp_cpus exceeds max cpus supported by kvm

11 years agossd0323: abort() instead of exit(1) on error.
Peter A. G. Crosthwaite [Mon, 13 Aug 2012 10:04:07 +0000 (11:04 +0100)]
ssd0323: abort() instead of exit(1) on error.

To be more consistent with the newer ways of error signalling. That and SIGABT
is easier to debug with than exit(1).

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: make sd_wp_addr() return bool
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:07 +0000 (11:04 +0100)]
hw/sd.c: make sd_wp_addr() return bool

For the sake of code clarity

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: make sd_dataready() return bool
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:07 +0000 (11:04 +0100)]
hw/sd.c: make sd_dataready() return bool

For the sake of code clarity

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: convert binary variables to bool
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: convert binary variables to bool

Several members of SDState have type int when they actually are binary variables.
Change type of these variables to bool to improve code readability. Change SD API
to be in consistency with new variables type.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: introduce wrapper for conversion address to wp group
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: introduce wrapper for conversion address to wp group

Add wrapper function sd_addr_to_wpnum() to replace long address-->wg_group
conversion line.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: make sd_wp_addr() accept 64 bit address argument
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: make sd_wp_addr() accept 64 bit address argument

Currently sd_wp_addr() accepts 32 bit address arguments therefore implicitly
restricting SD card address range. Change address argument type to uint64_t.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: convert wp_groups in SDState to bitfield
Mitsyanko Igor [Mon, 13 Aug 2012 10:04:06 +0000 (11:04 +0100)]
hw/sd.c: convert wp_groups in SDState to bitfield

Representing each group write protection flag with only one bit instead of int
variable significantly reduces memory consumption.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoarmv7m: Guard against no -kernel argument
Peter A. G. Crosthwaite [Mon, 13 Aug 2012 10:04:05 +0000 (11:04 +0100)]
armv7m: Guard against no -kernel argument

A -kernel argument must be specified for this machine. Guard against no -kernel
argument. Previously gave an unhelpful "bad address" error message.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/armv7m_nvic: Fix incorrect default for num-irqs property
Peter Maydell [Mon, 13 Aug 2012 10:04:05 +0000 (11:04 +0100)]
hw/armv7m_nvic: Fix incorrect default for num-irqs property

Fix an incorrect default value for the num-irqs property (we were
attempting to override it from the default set by the parent class
but not succeeding, which meant that the lm3s6965evb model would
assert on startup attempting to wire up nonexistent irq lines).
Instead of trying to override the parent's Property array, we
define an instance_init function which runs after default setup
but before user property setting and can just fix up the default
value in the gic_state struct.

Reported-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Tested-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoqom: Reimplement Interfaces
Anthony Liguori [Fri, 10 Aug 2012 03:16:10 +0000 (13:16 +1000)]
qom: Reimplement Interfaces

The current implementation of Interfaces is poorly designed.  Each interface
that an object implements ends up being an object that's tracked by the
implementing object.  There's all sorts of gymnastics to deal with casting
between these objects.

But an interface shouldn't be associated with an Object.  Interfaces are global
to a class.  This patch moves all Interface knowledge to ObjectClass eliminating
the relationship between Object and Interfaces.

Interfaces are now abstract (as they should be) but this is okay.  Interfaces
essentially act as additional parents for the classes and are treated as such.

With this new implementation, we should fully support derived interfaces
including reimplementing an inherited interface.

PC: Rebased against qom-next merge Jun-2012.

PC: Removed replication of cast logic for interfaces, i.e. there is only
one cast function - object_dynamic_cast() (and object_dynamic_cast_assert())

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoxilinx_axi*: Re-implemented interconnect
Peter A. G. Crosthwaite [Fri, 10 Aug 2012 03:16:11 +0000 (13:16 +1000)]
xilinx_axi*: Re-implemented interconnect

Re-implemented the interconnect between the Xilinx AXI ethernet and DMA
controllers. A QOM interface "stream" is created, for the two stream interfaces.

As per Edgars request, this is designed to be more generic than AXI-stream,
so in the future we may see more clients of this interface beyond AXI stream.

This is based primarily on Paolos original refactoring of the interconnect.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Sun, 12 Aug 2012 00:49:03 +0000 (19:49 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  target-arm: Fix typos in comments
  arm: translate: comment typo - s/middel/middle/
  vl.c: Exit QEMU early if no machine is found

11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Sun, 12 Aug 2012 00:48:50 +0000 (19:48 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  qemu-iotests: skip 039 with ./check -nocache
  block: add BLOCK_O_CHECK for qemu-img check
  qcow2: mark image clean after repair succeeds
  qed: mark image clean after repair succeeds
  blockdev: flip default cache mode from writethrough to writeback
  virtio-blk: disable write cache if not negotiated
  virtio-blk: support VIRTIO_BLK_F_CONFIG_WCE
  qemu-iotests: Save some sed processes
  ahci: Fix sglist memleak in ahci_dma_rw_buf()
  ahci: Fix ahci cdrom read corruptions for reads > 128k
  virtio-blk: fix use-after-free while handling scsi commands

11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Sat, 11 Aug 2012 22:11:23 +0000 (17:11 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi-disk: add support for the UNMAP command
  scsi-disk: improve out-of-range LBA detection for WRITE SAME
  scsi-disk: more assertions and resets for aiocb
  virtio-scsi: do not compare 32-bit QEMU tags against 64-bit virtio-scsi tags
  iscsi: Pick default initiator-name based on the name of the VM
  iscsi: reorganize code for parse_initiator_name
  iscsi: do not leak initiator_name

11 years agoconfigure: fix double check tests with Clang
Blue Swirl [Thu, 9 Aug 2012 20:21:25 +0000 (20:21 +0000)]
configure: fix double check tests with Clang

Configuring with Clang compiler with -Werror would not work after
improved checks:
/tmp/qemu-conf--25992-.c:4:32: error: self-comparison always evaluates
to true [-Werror,-Wtautological-compare]
int main(void) { return preadv == preadv; }
/tmp/qemu-conf--25992-.c:13:26: error: self-comparison always
evaluates to true [-Werror,-Wtautological-compare]
    return epoll_create1 == epoll_create1;
/tmp/qemu-conf--25992-.c:3:13: error: explicitly assigning a variable
of type 'char **' to itself [-Werror,-Wself-assign]
    environ = environ;

Avoid the errors by adjusting the tests.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Check for -Werror causing failures when compiling tests
Peter Maydell [Wed, 18 Jul 2012 14:10:28 +0000 (15:10 +0100)]
configure: Check for -Werror causing failures when compiling tests

Add support for checking whether test case code can compile without
warnings, by recompiling each successful test with -Werror. If the
-Werror version doesn't pass, we bail out. This gives us the same
level of visibility of warnings in test code as --enable-werror
provides for the main compile.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoexec.c: fix dirty bitmap reallocation
Igor Mitsyanko [Fri, 10 Aug 2012 14:45:11 +0000 (18:45 +0400)]
exec.c: fix dirty bitmap reallocation

For each newly created RAM block, dirty bitmap is reallocated with g_realloc, which doesn't
make any promises on initial content of new extra data in returned buffer. In theory,
we initialize this new data with cpu_physical_memory_set_dirty_range() call. The
problem is, cpu_physical_memory_set_dirty_range() has a side effect of incrementing
ram_list.dirty_pages variable, but only for pages which are not already dirty. And
page "cleanliness" is determined using the same not yet uninitialized dirty bitmap
we've just reallocated. This results in inconsistency between real dirty page number
and value in ram_list.dirty_pages variable, which in turn could (and will) result
in errors during VM migration.
Zero initialize new dirty bitmap bytes to fix this problem.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMakefile: add qapi.py dependencies
Stefan Hajnoczi [Fri, 10 Aug 2012 13:08:42 +0000 (14:08 +0100)]
Makefile: add qapi.py dependencies

Commit 427a1a2cb1d35b83b6302886f46289f6d617134d ("qapi: avoid reserved
keywords") modifies qapi.py, which is used by qapi-types.py and other
Python scripts.  Because Makefile has no dependencies for qapi.py the
qapi code generator will not be rerun and the following build error is
produced:

  net/slirp.c: In function ‘net_init_slirp’:
  net/slirp.c:721:50: error: ‘NetdevUserOptions’ has no member named ‘q_restrict’

Fix this issue by adding the missing qapi.py dependencies.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add a minimal curses screen support
Guan Xuetao [Fri, 10 Aug 2012 06:42:39 +0000 (14:42 +0800)]
unicore32-softmmu: Add a minimal curses screen support

This patch adds a minimal curses screen support for unicore32-softmmu.
We assume 80*30 screen size to minimize the implementation.
Two problems are not solved, but they are innocuous.
1. curses windows will be blank when switching to monitor screen and back
2. backspace is not handled yet

v1->v2: add extra handler for '\r'

Signed-off-by: Zhang Mengchi <zhangmengchi@mprc.pku.edu.cn>
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32: Close dump-option of cpu_dump_state_ucf64 function
Guan Xuetao [Fri, 10 Aug 2012 06:42:38 +0000 (14:42 +0800)]
unicore32: Close dump-option of cpu_dump_state_ucf64 function

Since of tedious output, we close dump-option of cpu_dump_state_ucf64 function.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32: Disintegrate cpu_dump_state_ucf64 function
Guan Xuetao [Fri, 10 Aug 2012 06:42:37 +0000 (14:42 +0800)]
unicore32: Disintegrate cpu_dump_state_ucf64 function

This patch disintegrates cpu_dump_state_ucf64 function from cpu_dump_state.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32: Split UniCore-F64 instruction helpers from helper.c
Guan Xuetao [Fri, 10 Aug 2012 06:42:36 +0000 (14:42 +0800)]
unicore32: Split UniCore-F64 instruction helpers from helper.c

This patch just splits ucf64 instruction simulation helpers from
helper.c.
Also, two checkpatch warnings are solved.

v1->v2: adjust copyright information for new ucf64_helper.c

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add is_default setting for puv3 machine
Guan Xuetao [Fri, 10 Aug 2012 06:42:35 +0000 (14:42 +0800)]
unicore32-softmmu: Add is_default setting for puv3 machine

This patch sets is_default to 1 for puv3 machine, so that
find_default_machine() returns puv3 machine.
Thanks Dunrong for pointing it out.

Cc: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add maintainer information for UniCore32 machine
Guan Xuetao [Fri, 10 Aug 2012 06:42:34 +0000 (14:42 +0800)]
unicore32-softmmu: Add maintainer information for UniCore32 machine

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add ps2 support
Guan Xuetao [Fri, 10 Aug 2012 06:42:33 +0000 (14:42 +0800)]
unicore32-softmmu: Add ps2 support

This patch adds ps2/keyboard support, and enables CONFIG_PCKBD.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add puv3 dma support
Guan Xuetao [Fri, 10 Aug 2012 06:42:32 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 dma support

This patch adds puv3 dma (Direct Memory Access) support,
include dma device simulation for kernel booting.

v1->v2: Add initialization to ret in puv3_dma_read.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add puv3 pm support
Guan Xuetao [Fri, 10 Aug 2012 06:42:31 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 pm support

This patch adds puv3 pm (power management) support,
include pm device simulation for kernel booting.
Thank Blue Swirl for pointing out the missing "break".

v1->v2: Add initialization to ret in puv3_pm_read.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add puv3 gpio support
Guan Xuetao [Fri, 10 Aug 2012 06:42:30 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 gpio support

This patch adds puv3 gpio (General Purpose Input/Output) support,
include gpio device simulation and its interrupt support.

v1->v2: Add initialization to ret in puv3_gpio_read.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add puv3 ostimer support
Guan Xuetao [Fri, 10 Aug 2012 06:42:29 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 ostimer support

This patch adds puv3 ostimer support, include os timer
device simulation and ptimer support in puv3 machine.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add puv3 interrupt support
Guan Xuetao [Fri, 10 Aug 2012 06:42:28 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 interrupt support

This patch adds puv3 interrupt support, include interrupt controler
device simulation and interrupt handler in puv3 machine.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add puv3 soc/board support
Guan Xuetao [Fri, 10 Aug 2012 06:42:27 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 soc/board support

This patch only add puv3 soc/board support, which introduces puv3
machine description, and specifies console type.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Make sure that kernel can access user space
Guan Xuetao [Fri, 10 Aug 2012 06:42:26 +0000 (14:42 +0800)]
unicore32-softmmu: Make sure that kernel can access user space

As a matter of course, we need to access user space in kernel code,
so we need to correct load/store decoders to indicate correct memory
region.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Implement softmmu specific functions
Guan Xuetao [Fri, 10 Aug 2012 06:42:25 +0000 (14:42 +0800)]
unicore32-softmmu: Implement softmmu specific functions

This patch implements softmmu specific functions, include tlb_fill,
switch_mode, do_interrupt and uc32_cpu_handle_mmu_fault.
So the full exception handlers and page table walking could work now.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-unicore32: Drop UC32_CPUID macros
Andreas Färber [Fri, 10 Aug 2012 06:42:24 +0000 (14:42 +0800)]
target-unicore32: Drop UC32_CPUID macros

Any code that depends on a particular CPU type can now go through
callbacks on the QOM UniCore32CPUClass.

Signed-off-by: Andreas Färber <afaerber@suse.de
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Make UniCore32 cpuid & exceptions correct and runable
Guan Xuetao [Fri, 10 Aug 2012 06:42:23 +0000 (14:42 +0800)]
unicore32-softmmu: Make UniCore32 cpuid & exceptions correct and runable

This patch initializes the cpuid to exactly correct value because
linux kernel will check it.
In addition, the exception types are specified in proper situations.
Then it could make exceptions generated correctly and timely.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support
Guan Xuetao [Fri, 10 Aug 2012 06:42:22 +0000 (14:42 +0800)]
unicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support

Coprocessor 0 is system control coprocessor, and we need get/set its contents.
Also, all cache/tlb ops shoule be implemented here, but just ignored with no harm.

Coprocessor 1 is OCD (on-chip-debugger), which is used for faked console,
so we could output chars to this console without graphic card.
TODO: curses display should be added lator for screen output.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agounicore32-softmmu: Add unicore32-softmmu build support
Guan Xuetao [Fri, 10 Aug 2012 06:42:21 +0000 (14:42 +0800)]
unicore32-softmmu: Add unicore32-softmmu build support

This patch adds unicore32-softmmu build support, include configure,
makefile, arch_init, and all missing functions needed by softmmu.
Although all missing functions are empty, unicore32-softmmu could
be build successfully.
By 20120804: change QEMU_ARCH_UNICORE32 to 0x4000

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Fix typos in comments
Peter Maydell [Mon, 6 Aug 2012 16:42:18 +0000 (17:42 +0100)]
target-arm: Fix typos in comments

Fix a variety of typos in comments in target-arm files.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoarm: translate: comment typo - s/middel/middle/
Peter A. G. Crosthwaite [Mon, 6 Aug 2012 07:05:56 +0000 (17:05 +1000)]
arm: translate: comment typo - s/middel/middle/

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agovl.c: Exit QEMU early if no machine is found
Dunrong Huang [Mon, 23 Jul 2012 16:42:20 +0000 (00:42 +0800)]
vl.c: Exit QEMU early if no machine is found

We check whether the variable machine is NULL or not before accessing
it. If machine is NULL, exit QEMU with an error, this can avoids a
segfault error.

Markus Armbruster <armbru@redhat.com> adds that the segfault can be
reproduced as follows:

  $ qemu-system-xtensa -cpu help

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoqemu-iotests: skip 039 with ./check -nocache
Stefan Hajnoczi [Thu, 9 Aug 2012 12:05:57 +0000 (13:05 +0100)]
qemu-iotests: skip 039 with ./check -nocache

When the qemu-io --nocache option is used the 039 test case cannot abort
QEMU at a point where the image is dirty.  Skip the test case.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: add BLOCK_O_CHECK for qemu-img check
Stefan Hajnoczi [Thu, 9 Aug 2012 12:05:56 +0000 (13:05 +0100)]
block: add BLOCK_O_CHECK for qemu-img check

Image formats with a dirty bit, like qed and qcow2, repair dirty image
files upon open with BDRV_O_RDWR.  Performing automatic repair when
qemu-img check runs is not ideal because the bdrv_open() call repairs
the image before the actual bdrv_check() call from qemu-img.c.

Fix this "double repair" since it leads to confusing output from
qemu-img check.  Tell the block driver that this image is being opened
just for bdrv_check().  This skips automatic repair and qemu-img.c can
invoke it manually with bdrv_check().

Update the golden output for qemu-iotests 039 to reflect the new
qemu-img check output.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: mark image clean after repair succeeds
Stefan Hajnoczi [Thu, 9 Aug 2012 12:05:55 +0000 (13:05 +0100)]
qcow2: mark image clean after repair succeeds

The dirty bit is cleared after image repair succeeds in qcow2_open().
Move this into qcow2_check() so that all callers benefit from this
behavior when fix mode is enabled.

This is necessary so qemu-img check can call .bdrv_check() and mark the
image clean.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqed: mark image clean after repair succeeds
Stefan Hajnoczi [Thu, 9 Aug 2012 12:05:54 +0000 (13:05 +0100)]
qed: mark image clean after repair succeeds

The dirty bit is cleared after image repair succeeds in qed_open().
Move this into qed_check() so that all callers benefit from this
behavior when fix=true.

This is necessary so qemu-img check can call .bdrv_check() and mark the
image clean.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockdev: flip default cache mode from writethrough to writeback
Paolo Bonzini [Thu, 9 Aug 2012 14:07:21 +0000 (16:07 +0200)]
blockdev: flip default cache mode from writethrough to writeback

Now all major device models (IDE, SCSI, virtio) can choose between
writethrough and writeback at run-time, and virtio will even revert
to writethrough if the guest is not capable of sending flushes.  So
we can change the default to writeback at last.

Tested, for lack of a better idea, with a breakpoint on bdrv_open
and all cache choices one by one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agovirtio-blk: disable write cache if not negotiated
Paolo Bonzini [Thu, 9 Aug 2012 14:07:20 +0000 (16:07 +0200)]
virtio-blk: disable write cache if not negotiated

If the guest does not support flushes, we should run in writethrough mode.
The setting is temporary until the next reset, so that for example the
BIOS will run in writethrough mode while Linux will run with a writeback
cache.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agovirtio-blk: support VIRTIO_BLK_F_CONFIG_WCE
Paolo Bonzini [Thu, 9 Aug 2012 14:07:19 +0000 (16:07 +0200)]
virtio-blk: support VIRTIO_BLK_F_CONFIG_WCE

Also rename VIRTIO_BLK_F_WCACHE to VIRTIO_BLK_F_WCE for consistency with
the spec.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Save some sed processes
Kevin Wolf [Thu, 9 Aug 2012 11:17:14 +0000 (13:17 +0200)]
qemu-iotests: Save some sed processes

Instead of building a huge pipeline, just pass all expressions to a
single sed process.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoahci: Fix sglist memleak in ahci_dma_rw_buf()
Jason Baron [Fri, 3 Aug 2012 19:57:10 +0000 (15:57 -0400)]
ahci: Fix sglist memleak in ahci_dma_rw_buf()

I noticed that in hw/ide/ahci:ahci_dma_rw_buf() we do not free the sglist. Thus,
I've added a call to qemu_sglist_destroy() to fix this memory leak.

In addition, I've adeed a call in qemu_sglist_destroy() to 0 all of the sglist
fields, in case there is some other codepath that tries to free the sglist.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoahci: Fix ahci cdrom read corruptions for reads > 128k
Jason Baron [Fri, 3 Aug 2012 19:57:06 +0000 (15:57 -0400)]
ahci: Fix ahci cdrom read corruptions for reads > 128k

While testing q35, which has its cdrom attached to the ahci controller, I found
that the Fedora 17 install would panic on boot. The panic occurs while
squashfs is trying to read from the cdrom. The errors are:

[    8.622711] SQUASHFS error: xz_dec_run error, data probably corrupt
[    8.625180] SQUASHFS error: squashfs_read_data failed to read block
0x20be48a

I was also able to produce corrupt data reads using an installed piix based
qemu machine, using 'dd'. I found that the corruptions were only occuring when
then read size was greater than 128k. For example, the following command
results in corrupted reads:

dd if=/dev/sr0 of=/tmp/blah bs=256k iflag=direct

The > 128k size reads exercise a different code path than 128k and below. In
ide_atapi_cmd_read_dma_cb() s->io_buffer_size is capped at 128k. Thus,
ide_atapi_cmd_read_dma_cb() is called a second time when the read is > 128k.
However, ahci_dma_rw_buf() restart the read from offset 0, instead of at 128k.
Thus, resulting in a corrupted read.

To fix this, I've introduced 'io_buffer_offset' field in IDEState to keep
track of the offset. I've also modified ahci_populate_sglist() to take a new
3rd offset argument, so that the sglist is property initialized.

I've tested this patch using 'dd' testing, and Fedora 17 now correctly boots
and installs on q35 with the cdrom ahci controller.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agovirtio-blk: fix use-after-free while handling scsi commands
Avi Kivity [Mon, 6 Aug 2012 12:49:03 +0000 (15:49 +0300)]
virtio-blk: fix use-after-free while handling scsi commands

The scsi passthrough handler falls through after completing a
request into the failure path, resulting in a use after free.

Reproducible by running a guest with aio=native on a block device.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agohandle device help before accelerator set up
Bruce Rogers [Thu, 9 Aug 2012 18:47:40 +0000 (12:47 -0600)]
handle device help before accelerator set up

A command line device probe using just -device "?" gets processed
after qemu-kvm initializes the accelerator. If /dev/kvm is not
present, the accelerator check will fail (kvm is defaulted to on),
which causes libvirt to not be set up to handle qemu guests.

Moving the device help handling before the accelerator set up allows
the device probe to work in this configuration and libvirt succeeds
in setting up for a qemu hypervisor mode.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu
Blue Swirl [Thu, 9 Aug 2012 18:44:49 +0000 (18:44 +0000)]
Merge branch 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu

* 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu:
  target-i386: move tcg initialization into x86_cpu_initfn()
  cleanup cpu_set_debug_excp_handler
  target-xtensa: drop usage of prev_debug_excp_handler
  target-i386: drop usage of prev_debug_excp_handler

11 years agoqemu_rearm_alarm_timer: do not call rearm if the next deadline is INT64_MAX
Stefano Stabellini [Tue, 29 May 2012 03:35:24 +0000 (03:35 +0000)]
qemu_rearm_alarm_timer: do not call rearm if the next deadline is INT64_MAX

qemu_rearm_alarm_timer partially duplicates the code in
qemu_next_alarm_deadline to figure out if it needs to rearm the timer.
If it calls qemu_next_alarm_deadline, it always rearms the timer even if
the next deadline is INT64_MAX.

This patch simplifies the behavior of qemu_rearm_alarm_timer and removes
the duplicated code, always calling qemu_next_alarm_deadline and only
rearming the timer if the deadline is less than INT64_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Tested-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: make 'sim' to be the default machine
Max Filippov [Wed, 8 Aug 2012 23:31:38 +0000 (03:31 +0400)]
target-xtensa: make 'sim' to be the default machine

This fixes the following error:

    $ qemu-system-xtensa -cpu help
    Segmentation fault

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: make default CPU depend on target endianness
Max Filippov [Wed, 8 Aug 2012 10:07:14 +0000 (14:07 +0400)]
target-xtensa: make default CPU depend on target endianness

This makes usable default for -cpu option both for qemu-system-xtensa
and qemu-system-xtensaeb fixing the following error:

    $ qemu-system-xtensaeb -M sim
    Unable to find CPU definition

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMIPS: Correct FCR0 initialization
Nathan Froyd [Thu, 7 Jun 2012 15:04:14 +0000 (15:04 +0000)]
MIPS: Correct FCR0 initialization

 This change addresses a problem where QEMU incorrectly traps on
floating-point MADD group instructions with SIGILL, at least while
emulating MIPS32r2 processors.  These instructions use the COP1X major
opcode and include ones like:

madd.d $f2,$f4,$f2,$f6

 Here's Nathan's original analysis of the problem:

"QEMU essentially does:

  d = find_cpu (cpu_string) // get CPU definition
  fpu_init (env, d) // initialize fpu state (init FCR0, basically)
  cpu_reset (env)

...and the cpu_reset call clears all interesting state that fpu_init
setup, then proceeds to reinitialize all the CP0 registers...but not
FCR0."

 I have verified this change with system emulation running the GDB test
suite for the mips-sde-elf target (o32, big endian, 24Kf CPU emulated),
there were 55 progressions and no regressions.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoscsi-bus: remove overlapping entry
Blue Swirl [Mon, 30 Jul 2012 17:46:06 +0000 (17:46 +0000)]
scsi-bus: remove overlapping entry

LOAD_UNLOAD and START_STOP have same value, so the table
entry is initialized twice. Spotted by Clang compiler.

Remove LOAD_UNLOAD entry since START_STOP entry already
represents both.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoxilinx_axienet: avoid useless self-assignment
Blue Swirl [Mon, 30 Jul 2012 17:28:04 +0000 (17:28 +0000)]
xilinx_axienet: avoid useless self-assignment

Statement s=s; makes little sense, remove it. Spotted by Clang
compiler.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agouser: fix accidental AREG0 use
Blue Swirl [Mon, 30 Jul 2012 15:51:17 +0000 (15:51 +0000)]
user: fix accidental AREG0 use

Global register AREG0 was always assumed to be usable in user-exec.c,
but this is incorrect for several targets.

Fix with #ifdeffery and by using other variables.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoqapi: avoid reserved keywords
Blue Swirl [Mon, 30 Jul 2012 15:46:55 +0000 (15:46 +0000)]
qapi: avoid reserved keywords

Clang compiler complained about use of reserved word 'restrict' in SLIRP
and QAPI.

Prefix C keywords with "q_", adjust SLIRP accordingly.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosparc: fix expression with uninitialized initial value
Blue Swirl [Mon, 30 Jul 2012 15:29:11 +0000 (15:29 +0000)]
sparc: fix expression with uninitialized initial value

err was uninitialized, it's not OK to use |=. Spotted by Clang
compiler.

Fix by implementing the earlier statement which initializes the variable.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agosparc: fix floppy TC line setup
Blue Swirl [Mon, 30 Jul 2012 15:24:23 +0000 (15:24 +0000)]
sparc: fix floppy TC line setup

The qemu_irq for Terminal Count (TC) line between FDC and Slavio misc
device was created only after use, spotted by Clang compiler. Also,
it was not created if the FDC didn't exist.

Rearrange code to fix order. Always create the TC line.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoesp: add Tekram DC-390 emulation (PC SCSI adapter)
Hervé Poussineau [Sat, 4 Aug 2012 19:10:06 +0000 (21:10 +0200)]
esp: add Tekram DC-390 emulation (PC SCSI adapter)

Difference with AMD PCscsi is that DC-390 contains a EEPROM,
and that a romfile is available to add INT13 support.

This has been successfully tested on:
- MS DOS 6.22 (using DC390 ASPI driver)
- MS Windows 98 SE (using DC390 driver)
- MS Windows NT 3.1 (using DC390 driver)
- MS Windows NT 4.0 (using DC390 driver)
- hard disk and cdrom boot

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoRevert "pci: add some stubs"
Hervé Poussineau [Sat, 4 Aug 2012 19:10:05 +0000 (21:10 +0200)]
Revert "pci: add some stubs"

This reverts commit 0883c5159f1df05d8761014f65451c3c3b77ebcf.

Those stubs were only used by PCI ESP emulation, which is now
not compiled on architectures which have no PCI bus support.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoesp: move PCI emulation to a new file esp-pci.c
Hervé Poussineau [Sat, 4 Aug 2012 19:10:04 +0000 (21:10 +0200)]
esp: move PCI emulation to a new file esp-pci.c

sparc machines loose ability to instanciate PCI ESP SCSI adapter,
which is not a big loose as they don't have PCI bus support.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoesp: move some definitions to header file
Hervé Poussineau [Sat, 4 Aug 2012 19:10:03 +0000 (21:10 +0200)]
esp: move some definitions to header file

These will be used by next commits.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoscsi-disk: add support for the UNMAP command
Paolo Bonzini [Thu, 9 Aug 2012 09:00:22 +0000 (11:00 +0200)]
scsi-disk: add support for the UNMAP command

The unmap command can reuse the same infrastructure as MODE SELECT
for reading the descriptor list into memory.  The descriptors are
processed sequentially.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi-disk: improve out-of-range LBA detection for WRITE SAME
Paolo Bonzini [Thu, 9 Aug 2012 11:34:53 +0000 (13:34 +0200)]
scsi-disk: improve out-of-range LBA detection for WRITE SAME

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi-disk: more assertions and resets for aiocb
Paolo Bonzini [Thu, 9 Aug 2012 09:33:26 +0000 (11:33 +0200)]
scsi-disk: more assertions and resets for aiocb

Leaving the aiocb to a non-NULL value leads to an assertion failure when
rerror/werror are set to stop or enospc, and the operation is retried.
scsi-disk checks that the aiocb member is NULL before filling it.

This patch correctly resets the aiocb to NULL values everywhere,
and adds the dual assertion that the aiocb was non-NULL before
calling bdrv_acct_done.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agokvm: Add documentation comment for kvm_irqchip_in_kernel()
Peter Maydell [Thu, 26 Jul 2012 14:35:17 +0000 (15:35 +0100)]
kvm: Add documentation comment for kvm_irqchip_in_kernel()

Now we've cleared out the architecture-independent uses of
kvm_irqchip_in_kernel(), we can add a doc comment describing
what it means.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Decouple 'GSI routing' from 'kernel irqchip'
Peter Maydell [Thu, 26 Jul 2012 14:35:16 +0000 (15:35 +0100)]
kvm: Decouple 'GSI routing' from 'kernel irqchip'

Don't assume having an in-kernel irqchip means that GSI
routing is enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'
Peter Maydell [Thu, 26 Jul 2012 14:35:15 +0000 (15:35 +0100)]
kvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'

Decouple another x86-specific assumption about what irqchips imply.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Decouple 'irqfds usable' from 'kernel irqchip'
Peter Maydell [Thu, 26 Jul 2012 14:35:14 +0000 (15:35 +0100)]
kvm: Decouple 'irqfds usable' from 'kernel irqchip'

Instead of assuming that we can use irqfds if and only if
kvm_irqchip_in_kernel(), add a bool to the KVMState which
indicates this, and is set only on x86 and only if the
irqchip is in the kernel.

The kernel documentation implies that the only thing
you need to use KVM_IRQFD is that KVM_CAP_IRQFD is
advertised, but this seems to be untrue. In particular
the kernel does not (alas) return a sensible error if you
try to set up an irqfd when you haven't created an irqchip.
If it did we could remove all this nonsense and let the
kernel return the error code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Move kvm_allows_irq0_override() to target-i386, fix return type
Peter Maydell [Thu, 26 Jul 2012 14:35:13 +0000 (15:35 +0100)]
kvm: Move kvm_allows_irq0_override() to target-i386, fix return type

kvm_allows_irq0_override() is a totally x86 specific concept:
move it to the target-specific source file where it belongs.
This means we need a new header file for the prototype:
kvm_i386.h, in line with the existing kvm_ppc.h.

While we are moving it, fix the return type to be 'bool' rather
than 'int'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Rename kvm_irqchip_set_irq() to kvm_set_irq()
Peter Maydell [Thu, 26 Jul 2012 14:35:12 +0000 (15:35 +0100)]
kvm: Rename kvm_irqchip_set_irq() to kvm_set_irq()

Rename the function kvm_irqchip_set_irq() to kvm_set_irq(),
since it can be used for sending (asynchronous) interrupts whether
there is a full irqchip model in the kernel or not. (We don't
include 'async' in the function name since asynchronous is the
normal case.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Decouple 'async interrupt delivery' from 'kernel irqchip'
Peter Maydell [Thu, 26 Jul 2012 14:35:11 +0000 (15:35 +0100)]
kvm: Decouple 'async interrupt delivery' from 'kernel irqchip'

On x86 userspace delivers interrupts to the kernel asynchronously
(and therefore VCPU idle management is done in the kernel) if and
only if there is an in-kernel irqchip. On other architectures this
isn't necessarily true (they may always send interrupts
asynchronously), so define a new kvm_async_interrupts_enabled()
function instead of misusing kvm_irqchip_in_kernel().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agoconfigure: Don't implicitly hardcode list of KVM architectures
Peter Maydell [Fri, 3 Aug 2012 12:51:25 +0000 (13:51 +0100)]
configure: Don't implicitly hardcode list of KVM architectures

The code creating the symlink from linux-headers/asm to the
architecture specific linux-headers/asm-$arch directory was
implicitly hardcoding a list of KVM supporting architectures.
Add a default case for the common "Linux architecture name and
QEMU CPU name match" case, so future architectures will only
need to add code if they've managed to get mismatched names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agokvm: Check if smp_cpus exceeds max cpus supported by kvm
Dunrong Huang [Tue, 31 Jul 2012 11:18:17 +0000 (19:18 +0800)]
kvm: Check if smp_cpus exceeds max cpus supported by kvm

Add a helper function for fetching max cpus supported by kvm.

Make QEMU exit with an error message if smp_cpus exceeds limit
of VCPU count retrieved by invoking this helper function.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
11 years agovirtio-scsi: do not compare 32-bit QEMU tags against 64-bit virtio-scsi tags
Paolo Bonzini [Wed, 8 Aug 2012 14:26:16 +0000 (16:26 +0200)]
virtio-scsi: do not compare 32-bit QEMU tags against 64-bit virtio-scsi tags

This patch fixes a problem in handling task management functions
in virtio-scsi.  The cause of the problem is a mismatch between
the size of the tag in QEMU (32-bit) and virtio-scsi (64-bit).
Changing the QEMU size is hard because the migration format
uses 32 bits to store the tag; so just don't use the QEMU tag
(virtio-scsi only uses the tag for task management functions
anyway) and look up the full 64-bit tag in the hba_private field.

The reproducer is a bit obscure.  If you cause an I/O timeout
(for example with rerror=stop and doing 'cont' on the monitor
continuously without fixing the error), sooner or later the
guest will try to abort the command and reissue it.  At this
point, QEMU will report _two_ errors instead of one when you
hit 'c', because the first error has not been canceled correctly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiscsi: Pick default initiator-name based on the name of the VM
Ronnie Sahlberg [Mon, 6 Aug 2012 08:24:55 +0000 (18:24 +1000)]
iscsi: Pick default initiator-name based on the name of the VM

This patch updates the iscsi layer to automatically pick a 'unique'
initiator-name based on the name of the vm in case the user has not set
an explicit iqn-name to use.

Create a new function qemu_get_vm_name() that returns the name of the VM,
if specified.

This way we can thus create default names to use as the initiator name
based on the guest session.

If the VM is not named via the '-name' command line argument, the iscsi
initiator-name used wiull simply be

    iqn.2008-11.org.linux-kvm

If a name for the VM was specified with the '-name' option, iscsi will
use a default initiatorname of

    iqn.2008-11.org.linux-kvm:<name>

These names are just the default iscsi initiator name that qemu will
generate/use only when the user has not set an explicit initiator name
via the commandlines or config files.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
11 years agoiscsi: reorganize code for parse_initiator_name
Paolo Bonzini [Mon, 6 Aug 2012 08:54:41 +0000 (10:54 +0200)]
iscsi: reorganize code for parse_initiator_name

Merge the occurrences of the "iqn.2008-11.org.linux-kvm" string
to avoid duplication.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiscsi: do not leak initiator_name
Paolo Bonzini [Mon, 6 Aug 2012 08:52:22 +0000 (10:52 +0200)]
iscsi: do not leak initiator_name

The argument of iscsi_create_context is never freed by libiscsi,
which in fact calls strdup on it.  Avoid a leak.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoRestart optimization on stage3 update version
Juan Quintela [Mon, 6 Aug 2012 18:42:58 +0000 (21:42 +0300)]
Restart optimization on stage3 update version

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd XBZRLE statistics
Orit Wasserman [Mon, 6 Aug 2012 18:42:57 +0000 (21:42 +0300)]
Add XBZRLE statistics

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd migration accounting for normal and duplicate pages
Orit Wasserman [Mon, 6 Aug 2012 18:42:56 +0000 (21:42 +0300)]
Add migration accounting for normal and duplicate pages

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoChange total_time to total-time in MigrationStats
Orit Wasserman [Mon, 6 Aug 2012 18:42:55 +0000 (21:42 +0300)]
Change total_time to total-time in MigrationStats

migration total_time was introduced in commit
d5f8a5701d3690b5ec0c34b6a5c0b5a24d274540 for QEMU 1.2

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd migrate_set_cache_size command
Orit Wasserman [Mon, 6 Aug 2012 18:42:54 +0000 (21:42 +0300)]
Add migrate_set_cache_size command

Change XBZRLE cache size in bytes (the size should be a power of 2, it will be
rounded down to the nearest power of 2).
If XBZRLE cache size is too small there will be many cache miss.

New query-migrate-cache-size QMP command and 'info migrate_cache_size' HMP
command to query cache value.

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd XBZRLE to ram_save_block and ram_save_live
Orit Wasserman [Mon, 6 Aug 2012 18:42:53 +0000 (21:42 +0300)]
Add XBZRLE to ram_save_block and ram_save_live

In the outgoing migration check to see if the page is cached and
changed, then send compressed page by using save_xbrle_page function.
In the incoming migration check to see if RAM_SAVE_FLAG_XBZRLE is set
and decompress the page (by using load_xbrle function).

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd xbzrle_encode_buffer and xbzrle_decode_buffer functions
Orit Wasserman [Mon, 6 Aug 2012 18:42:52 +0000 (21:42 +0300)]
Add xbzrle_encode_buffer and xbzrle_decode_buffer functions

For performance we are encoding long word at a time.
For nzrun we use long-word-at-a-time NULL-detection tricks from strcmp():
using ((lword - 0x0101010101010101) & (~lword) & 0x8080808080808080) test
to find out if any byte in the long word is zero.

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd uleb encoding/decoding functions
Orit Wasserman [Mon, 6 Aug 2012 18:42:51 +0000 (21:42 +0300)]
Add uleb encoding/decoding functions

Implement Unsigned Little Endian Base 128.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd cache handling functions
Orit Wasserman [Mon, 6 Aug 2012 18:42:50 +0000 (21:42 +0300)]
Add cache handling functions

Add MRU page cache mechanism.
The page are accessed by their address.

Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com>
Signed-off-by: Petter Svard <petters@cs.umu.se>
Signed-off-by: Aidan Shribman <aidan.shribman@sap.com>
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd XBZRLE documentation
Orit Wasserman [Mon, 6 Aug 2012 18:42:49 +0000 (21:42 +0300)]
Add XBZRLE documentation

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd migrate-set-capabilities
Orit Wasserman [Mon, 6 Aug 2012 18:42:48 +0000 (21:42 +0300)]
Add migrate-set-capabilities

The management can enable/disable a capability for the next migration by using
migrate-set-capabilities QMP command.
The user can use migrate_set_capability HMP command.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoAdd migration capabilities
Orit Wasserman [Mon, 6 Aug 2012 18:42:47 +0000 (21:42 +0300)]
Add migration capabilities

The management can query the current migration capabilities using
query-migrate-capabilities QMP command.
The user can use 'info migrate_capabilities' HMP command.
Currently only XBZRLE capability is available.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.58' into staging
Anthony Liguori [Tue, 7 Aug 2012 14:46:40 +0000 (09:46 -0500)]
Merge remote-tracking branch 'kraxel/usb.58' into staging

* kraxel/usb.58:
  usb-storage: fix SYNCHRONIZE_CACHE
  usb-storage: improve debug logging