]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agocpu: Move gdb_regs field from CPU_COMMON to CPUState
Andreas Färber [Fri, 28 Jun 2013 19:11:37 +0000 (21:11 +0200)]
cpu: Move gdb_regs field from CPU_COMMON to CPUState

Prepares for changing gdb_register_coprocessor() argument to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agogdbstub: Change GDBState::{c,g}_cpu and find_cpu() to CPUState
Andreas Färber [Thu, 27 Jun 2013 17:19:39 +0000 (19:19 +0200)]
gdbstub: Change GDBState::{c,g}_cpu and find_cpu() to CPUState

Use CPUState::env_ptr where still needed.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Introduce CPUClass::memory_rw_debug() for target_memory_rw_debug()
Andreas Färber [Thu, 27 Jun 2013 17:09:09 +0000 (19:09 +0200)]
cpu: Introduce CPUClass::memory_rw_debug() for target_memory_rw_debug()

Make inline target_memory_rw_debug() always available and change its
argument to CPUState. Let it check if CPUClass::memory_rw_debug provides
a specialized callback and fall back to cpu_memory_rw_debug() otherwise.

The only overriding implementation is for 32-bit sparc.

This prepares for changing GDBState::g_cpu to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoexec: Change cpu_memory_rw_debug() argument to CPUState
Andreas Färber [Sat, 29 Jun 2013 17:40:58 +0000 (19:40 +0200)]
exec: Change cpu_memory_rw_debug() argument to CPUState

Propagate X86CPU in kvmvapic for simplicity.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Turn cpu_get_phys_page_debug() into a CPUClass hook
Andreas Färber [Sat, 29 Jun 2013 16:55:54 +0000 (18:55 +0200)]
cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook

Change breakpoint_invalidate() argument to CPUState alongside.

Since all targets now assign a softmmu-only field, we can drop helpers
cpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd().

Prepares for changing cpu_memory_rw_debug() argument to CPUState.

Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agogdbstub: Change gdb_{read,write}_register() argument to CPUState
Andreas Färber [Thu, 27 Jun 2013 16:25:36 +0000 (18:25 +0200)]
gdbstub: Change gdb_{read,write}_register() argument to CPUState

Use CPUState::env_ptr for now.

Prepares for changing GDBState::g_cpu to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agogdbstub: Change gdb_handlesig() argument to CPUState
Andreas Färber [Thu, 27 Jun 2013 17:49:31 +0000 (19:49 +0200)]
gdbstub: Change gdb_handlesig() argument to CPUState

Prepares for changing GDBState::c_cpu to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agogdbstub: Change syscall callback argument to CPUState
Andreas Färber [Thu, 27 Jun 2013 15:45:01 +0000 (17:45 +0200)]
gdbstub: Change syscall callback argument to CPUState

Callback implementations were specific to arm and m68k, so can easily
cast to ARMCPU and M68kCPU respectively.

Prepares for changing GDBState::c_cpu to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agokvm: Change kvm_{insert,remove}_breakpoint() argument to CPUState
Andreas Färber [Thu, 27 Jun 2013 15:12:06 +0000 (17:12 +0200)]
kvm: Change kvm_{insert,remove}_breakpoint() argument to CPUState

CPUArchState is no longer directly used since converting CPU loops to
CPUState.

Prepares for changing GDBState::c_cpu to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Change cpu_single_step() argument to CPUState
Andreas Färber [Mon, 24 Jun 2013 16:41:06 +0000 (18:41 +0200)]
cpu: Change cpu_single_step() argument to CPUState

Use CPUState::env_ptr for now.

Needed for GdbState::c_cpu.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agogdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style
Andreas Färber [Mon, 24 Jun 2013 17:20:57 +0000 (19:20 +0200)]
gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style

In particular reindent to 4 instead of 2 spaces.

Prepares for changing cpu_single_step() argument in gdb_handlesig().

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Move singlestep_enabled field from CPU_COMMON to CPUState
Andreas Färber [Fri, 21 Jun 2013 18:20:45 +0000 (20:20 +0200)]
cpu: Move singlestep_enabled field from CPU_COMMON to CPUState

Prepares for changing cpu_single_step() argument to CPUState.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agotarget-alpha: Copy implver to DisasContext
Richard Henderson [Mon, 1 Jul 2013 20:19:30 +0000 (13:19 -0700)]
target-alpha: Copy implver to DisasContext

Which allows removing env from DisasContext.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agotarget-alpha: Copy singlestep_enabled to DisasContext
Richard Henderson [Mon, 1 Jul 2013 20:19:29 +0000 (13:19 -0700)]
target-alpha: Copy singlestep_enabled to DisasContext

Prepare for removing env from DisasContext.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()
Andreas Färber [Fri, 28 Jun 2013 17:31:32 +0000 (19:31 +0200)]
cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()

Where no extra implementation is needed, fall back to CPUClass::set_pc().

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agotarget-unicore32: Implement CPUClass::set_pc()
Andreas Färber [Fri, 28 Jun 2013 17:41:07 +0000 (19:41 +0200)]
target-unicore32: Implement CPUClass::set_pc()

This adds support for GDB's c addr (Continue) and s addr (Single Step).

Prepares for dropping cpu_pc_from_tb().

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agotarget-moxie: Implement CPUClass::set_pc()
Andreas Färber [Fri, 28 Jun 2013 18:43:26 +0000 (20:43 +0200)]
target-moxie: Implement CPUClass::set_pc()

This adds support for GDB's c addr (Continue) and s addr (Single Step).

Prepares for dropping cpu_pc_from_tb().

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agotarget-m68k: Implement CPUClass::set_pc()
Andreas Färber [Fri, 28 Jun 2013 18:35:01 +0000 (20:35 +0200)]
target-m68k: Implement CPUClass::set_pc()

This adds support for GDB's c addr (Continue) and s addr (Single Step).

Prepares for dropping cpu_pc_from_tb().

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()
Andreas Färber [Fri, 21 Jun 2013 17:09:18 +0000 (19:09 +0200)]
cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()

This moves setting the Program Counter from gdbstub into target code.
Use vaddr type as upper-bound replacement for target_ulong.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoHACKING: Document vaddr type usage
Peter Maydell [Mon, 22 Jul 2013 16:34:35 +0000 (18:34 +0200)]
HACKING: Document vaddr type usage

Also extend documentation of target_ulong and abi_ulong.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocpu: Introduce vaddr type
Andreas Färber [Sat, 6 Jul 2013 01:14:52 +0000 (03:14 +0200)]
cpu: Introduce vaddr type

vaddr is to target_ulong what uintmax_t is to unsigned int.

Its purpose is to allow turning per-target functions with target_ulong
arguments into CPUClass hooks.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agogdbstub: Change GDBState::query_cpu to CPUState
Andreas Färber [Thu, 27 Jun 2013 11:44:40 +0000 (13:44 +0200)]
gdbstub: Change GDBState::query_cpu to CPUState

Since first_cpu/next_cpu are CPUState, CPUArchState is no longer needed.

This resolves a NULL pointer dereference of query_cpu, introduced
with commit 182735efaf956ccab50b6d74a4fed163e0f35660 and reported by
TeLeMan and Max Filippov.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agotests: Add test-bitops.c with some sextract tests
Peter Maydell [Fri, 28 Jun 2013 11:40:32 +0000 (12:40 +0100)]
tests: Add test-bitops.c with some sextract tests

Add some simple test cases for the new sextract32
and sextract64 functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 1372419632-5521-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agobitops: Provide sextract32() and sextract64()
Peter Maydell [Fri, 28 Jun 2013 11:40:31 +0000 (12:40 +0100)]
bitops: Provide sextract32() and sextract64()

A common operation in instruction decoding is to take a field
from an instruction that represents a signed integer in some
arbitrary number of bits, and sign extend it into a C signed
integer type for manipulation. Provide new functions sextract32()
and sextract64() which perform this operation; they are like
the existing extract32() and extract64() except that the field
is sign-extended into the returned result.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 1372419632-5521-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agomemory: Fix zero-sized memory region print
Alex Williamson [Fri, 19 Jul 2013 18:42:12 +0000 (12:42 -0600)]
memory: Fix zero-sized memory region print

if mr->size == 0, then

int128_get64(int128_sub(mr->size, int128_make64(1))) => assert(!a.hi)

Also, use int128_one().

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20130719184124.15864.20803.stgit@bling.home
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoconfigure: Remove ldscripts
Richard Henderson [Sun, 21 Jul 2013 23:39:26 +0000 (15:39 -0800)]
configure: Remove ldscripts

Since 964c6fa16f50a607f9da5068d6bf15ccc93872c0, these files are unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-id: 1374449966-12926-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agogtk: Fix accelerator filtering
Jan Kiszka [Mon, 22 Jul 2013 07:04:32 +0000 (09:04 +0200)]
gtk: Fix accelerator filtering

This is in fact very simply: When the input in grabbed, everything
should be exclusively passed to the guest - except it has our magic
CTRL-ALT modifier set. Then let GTK filter out those accels that are in
use. When checking the modifier state, we just need to filter out NUM
and CAPS lock.

Note: Filtering based on hard-coded modifiers breaks overriding
accelerators. Needs to be fixed at a later point.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'pmaydell/tags/pull-arm-devs-20130722' into staging
Anthony Liguori [Mon, 22 Jul 2013 15:14:24 +0000 (10:14 -0500)]
Merge remote-tracking branch 'pmaydell/tags/pull-arm-devs-20130722' into staging

arm-devs queue

# gpg: Signature made Mon 22 Jul 2013 06:38:52 AM CDT using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

# By Peter Maydell (8) and Soren Brinkmann (2)
# Via Peter Maydell
* pmaydell/tags/pull-arm-devs-20130722:
  hw/arm: Use 'load_ramdisk()' for loading ramdisks w/ U-Boot header
  hw/loader: Support ramdisk with u-boot header
  vexpress: Add virtio-mmio transports
  vexpress: Make VEDBoardInfo extend arm_boot_info
  arm/boot: Allow boards to modify the FDT blob
  virtio: Implement MMIO based virtio transport
  virtio: Support transports which can specify the vring alignment
  virtio: Add support for guest setting of queue size
  arm/boot: Use qemu_devtree_setprop_sized_cells()
  device_tree: Add qemu_devtree_setprop_sized_cells() utility functions

Message-id: 1374493427-3254-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
Anthony Liguori [Mon, 22 Jul 2013 15:14:18 +0000 (10:14 -0500)]
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging

# By Paolo Bonzini (2) and others
# Via Paolo Bonzini
* bonzini/iommu-for-anthony:
  exec: fix incorrect assumptions in memory_access_size
  memory: Return -1 again on reads from unsigned regions
  memory: actually set the owner
  exec.c: Pass correct pointer type to qemu_ram_ptr_length

Message-id: 1374264478-23913-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Mon, 22 Jul 2013 15:13:49 +0000 (10:13 -0500)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Michael Tokarev (2) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  doc: monitor multiplexing rewording
  block/m25p80: Update Micron entries
  Fix command example in qemu.sasl
  slirp: remove mbuf(m_hdr,m_dat) indirection
  linux-user: declare sys_futex to have 6 arguments

Message-id: 1374225073-12959-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Mon, 22 Jul 2013 15:13:34 +0000 (10:13 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Peter Lieven (5) and others
# Via Stefan Hajnoczi
* stefanha/block:
  block/raw: add .bdrv_get_info
  block: fix bdrv_read_unthrottled()
  cpus: Let vm_stop[_force_state]() always flush block devices
  block-migration: efficiently encode zero blocks
  block/raw: add bdrv_co_write_zeroes
  block: add bdrv_write_zeroes()
  block: fix vvfat error path for enable_write_target
  QEMUBH: make AioContext's bh re-entrant
  dataplane: sync virtio.c and vring.c virtqueue state
  gluster: Add discard support for GlusterFS block driver.
  gluster: Use pkg-config to configure GlusterFS block driver

Message-id: 1374223132-29107-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'rth/axp-next' into staging
Anthony Liguori [Mon, 22 Jul 2013 15:13:27 +0000 (10:13 -0500)]
Merge remote-tracking branch 'rth/axp-next' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/axp-next:
  pc-bios: Update palcode-clipper
  target-alpha: Move alarm to vm_clock

Message-id: 1374161033-11449-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Mon, 22 Jul 2013 15:13:15 +0000 (10:13 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

# By Markus Armbruster
# Via Stefan Hajnoczi
* stefanha/tracing:
  trace-events: Fix up source file comments
  trace-events: Drop unused events
  milkymist-minimac2: Fix minimac2_read/_write tracepoints
  slavio_misc: Fix slavio_led_mem_readw/_writew tracepoints
  cleanup-trace-events.pl: New

Message-id: 1374119369-26496-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agohw/arm: Use 'load_ramdisk()' for loading ramdisks w/ U-Boot header
Soren Brinkmann [Mon, 8 Jul 2013 22:40:02 +0000 (15:40 -0700)]
hw/arm: Use 'load_ramdisk()' for loading ramdisks w/ U-Boot header

The load_ramdisk function is used to load ramdisk featuring a U-Boot
header.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373323202-17083-3-git-send-email-soren.brinkmann@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/loader: Support ramdisk with u-boot header
Soren Brinkmann [Mon, 8 Jul 2013 22:40:01 +0000 (15:40 -0700)]
hw/loader: Support ramdisk with u-boot header

Introduce 'load_ramdisk()' which can load "normal" ramdisks and ramdisks
with a u-boot header.
To enable this and leverage synergies 'load_uimage()' is refactored to
accomodate this additional use case.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373323202-17083-2-git-send-email-soren.brinkmann@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agovexpress: Add virtio-mmio transports
Peter Maydell [Tue, 16 Jul 2013 12:25:12 +0000 (13:25 +0100)]
vexpress: Add virtio-mmio transports

Add some virtio-mmio transports to the vexpress board model,
together with a modify_dtb hook which adds them to the device
tree so that the kernel will probe for them. We put them
in a reserved area of the address map.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373977512-28932-9-git-send-email-peter.maydell@linaro.org

10 years agovexpress: Make VEDBoardInfo extend arm_boot_info
Peter Maydell [Tue, 16 Jul 2013 12:25:11 +0000 (13:25 +0100)]
vexpress: Make VEDBoardInfo extend arm_boot_info

Make the VEDBoardInfo struct extend arm_boot_info; this will
allow us to get at the VEDBoardInfo information inside callbacks
from arm/boot code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373977512-28932-8-git-send-email-peter.maydell@linaro.org

10 years agoarm/boot: Allow boards to modify the FDT blob
Peter Maydell [Tue, 16 Jul 2013 12:25:10 +0000 (13:25 +0100)]
arm/boot: Allow boards to modify the FDT blob

Add a callback hook in arm_boot_info to allow board models to
modify the device tree blob if they need to. (The major expected
use case is to add virtio-mmio nodes for virtio-mmio transports
that exist in QEMU but not in the hardware.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373977512-28932-7-git-send-email-peter.maydell@linaro.org

10 years agovirtio: Implement MMIO based virtio transport
Peter Maydell [Tue, 16 Jul 2013 12:25:09 +0000 (13:25 +0100)]
virtio: Implement MMIO based virtio transport

Add support for the generic MMIO based virtio transport.

This patch includes some fixes for bugs spotted by
Ying-Shiuan Pan <yspan@itri.org.tw>.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1373977512-28932-6-git-send-email-peter.maydell@linaro.org
[Fred changes: updated to new virtio-bus mechanisms]
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
[PMM changes:
 * fixed trivial makefile conflict
 * removed unused int_enable
 * host_features doesn't need migrating
 * reset guest accessible state in the reset function
 * minor style fixes like extra blank lines
 * RAZ/WI if there's no backend
 * made transport size 0x200, in line with kvmtool
 * set has_variable_vring_alignment
]

10 years agovirtio: Support transports which can specify the vring alignment
Peter Maydell [Tue, 16 Jul 2013 12:25:08 +0000 (13:25 +0100)]
virtio: Support transports which can specify the vring alignment

Support virtio transports which can specify the vring alignment
(ie where the guest communicates this to the host) by providing
a new virtio_queue_set_align() function. (The default alignment
remains as before.)

Transports which wish to make use of this must set the
has_variable_vring_alignment field in their VirtioBusClass
struct to true; they can then change the alignment via
virtio_queue_set_align().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373977512-28932-5-git-send-email-peter.maydell@linaro.org

10 years agovirtio: Add support for guest setting of queue size
Peter Maydell [Tue, 16 Jul 2013 12:25:07 +0000 (13:25 +0100)]
virtio: Add support for guest setting of queue size

The MMIO virtio transport spec allows the guest to tell the host how
large the queue size is. Add virtio_queue_set_num() function which
implements this in the QEMU common virtio support code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1373977512-28932-4-git-send-email-peter.maydell@linaro.org

10 years agoarm/boot: Use qemu_devtree_setprop_sized_cells()
Peter Maydell [Tue, 16 Jul 2013 12:25:06 +0000 (13:25 +0100)]
arm/boot: Use qemu_devtree_setprop_sized_cells()

Replace the opencoded assembly of the reg property array for the
/memory node with a call to qemu_devtree_setprop_sized_cells().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1373977512-28932-3-git-send-email-peter.maydell@linaro.org

10 years agodevice_tree: Add qemu_devtree_setprop_sized_cells() utility functions
Peter Maydell [Tue, 16 Jul 2013 12:25:05 +0000 (13:25 +0100)]
device_tree: Add qemu_devtree_setprop_sized_cells() utility functions

We already have a qemu_devtree_setprop_cells() which sets a dtb
property to an array of cells whose values are specified by varargs.
However for the fairly common case of setting a property to a list
of addresses or of address,size pairs the number of cells used by
each element in the list depends on the parent's #address-cells
and #size-cells properties. To make this easier we provide an analogous
qemu_devtree_setprop_sized_cells() macro which allows the number
of cells used by each element to be specified. This is implemented
using an underlying qemu_devtree_setprop_sized_cells_from_array()
function which takes the values and sizes as an array; this may
also be directly useful for cases where the cell contents are
constructed programmatically.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1373977512-28932-2-git-send-email-peter.maydell@linaro.org

10 years agodoc: monitor multiplexing rewording
Michael Tokarev [Thu, 11 Jul 2013 08:55:50 +0000 (12:55 +0400)]
doc: monitor multiplexing rewording

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoblock/m25p80: Update Micron entries
Ed Maste [Tue, 4 Jun 2013 15:59:14 +0000 (11:59 -0400)]
block/m25p80: Update Micron entries

- Split 32Mb and 256Mb parts into a11 and a13 variants.
- Add the 4K sector flag to the 128Mb parts.  (These entries were taken from
  the Linux kernel list, which is missing the flag.)
- Fill out the table of sizes with entries for 64Mb parts.

Prodded by Peter Crosthwaite.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoFix command example in qemu.sasl
Cole Robinson [Tue, 9 Jul 2013 14:07:53 +0000 (10:07 -0400)]
Fix command example in qemu.sasl

sasldblistusers2 doesn't have a '-a' option

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoslirp: remove mbuf(m_hdr,m_dat) indirection
Michael Tokarev [Sat, 13 Jul 2013 09:10:05 +0000 (13:10 +0400)]
slirp: remove mbuf(m_hdr,m_dat) indirection

10 years agolinux-user: declare sys_futex to have 6 arguments
Petar Jovanovic [Mon, 15 Jul 2013 13:17:40 +0000 (15:17 +0200)]
linux-user: declare sys_futex to have 6 arguments

sys_futex has 6 arguments, and all of these need to be copied. Fix incorrect
declaration in the mips_syscall_args array.

This change fixes the cases where the 5th and 6th arguments have non-zero
value and have importance. An example is a Linux implementation of
pthread_cond_wait() function.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoblock/raw: add .bdrv_get_info
Peter Lieven [Mon, 15 Jul 2013 10:49:34 +0000 (12:49 +0200)]
block/raw: add .bdrv_get_info

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: fix bdrv_read_unthrottled()
Peter Lieven [Thu, 18 Jul 2013 08:37:32 +0000 (10:37 +0200)]
block: fix bdrv_read_unthrottled()

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agocpus: Let vm_stop[_force_state]() always flush block devices
Kevin Wolf [Thu, 18 Jul 2013 12:52:19 +0000 (14:52 +0200)]
cpus: Let vm_stop[_force_state]() always flush block devices

Even if the VM is already stopped, we cannot assume that all data has
already been successfully flushed to disk. The flush during the previous
vm_stop() could have failed.

Run bdrv_flush_all() unconditionally so that we get an error each time
if the block device isn't really flushed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock-migration: efficiently encode zero blocks
Peter Lieven [Thu, 18 Jul 2013 07:48:50 +0000 (09:48 +0200)]
block-migration: efficiently encode zero blocks

this patch adds a efficient encoding for zero blocks by
adding a new flag indicating a block is completely zero.

additionally bdrv_write_zeros() is used at the destination
to efficiently write these zeroes. depending on the implementation
this avoids that the destination target gets fully provisioned.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock/raw: add bdrv_co_write_zeroes
Peter Lieven [Thu, 11 Jul 2013 12:16:23 +0000 (14:16 +0200)]
block/raw: add bdrv_co_write_zeroes

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: add bdrv_write_zeroes()
Peter Lieven [Thu, 11 Jul 2013 12:16:22 +0000 (14:16 +0200)]
block: add bdrv_write_zeroes()

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: fix vvfat error path for enable_write_target
Fam Zheng [Wed, 17 Jul 2013 09:57:37 +0000 (17:57 +0800)]
block: fix vvfat error path for enable_write_target

s->qcow and s->qcow_filename are allocated but not freed on error. Fix the
possible leaks, remove unnecessary check for bdrv_new(), propagate ret code of
bdrv_create() and also the one of enable_write_target().

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoQEMUBH: make AioContext's bh re-entrant
Liu Ping Fan [Tue, 16 Jul 2013 04:28:58 +0000 (12:28 +0800)]
QEMUBH: make AioContext's bh re-entrant

BH will be used outside big lock, so introduce lock to protect
between the writers, ie, bh's adders and deleter. The lock only
affects the writers and bh's callback does not take this extra lock.
Note that for the same AioContext, aio_bh_poll() can not run in
parallel yet.

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agodataplane: sync virtio.c and vring.c virtqueue state
Stefan Hajnoczi [Mon, 1 Jul 2013 11:29:17 +0000 (13:29 +0200)]
dataplane: sync virtio.c and vring.c virtqueue state

Load the virtio.c state into vring.c when we start dataplane mode and
vice versa when stopping dataplane mode.  This patch makes it possible
to start and stop dataplane any time while the guest is running.

This will eventually allow us to go back to QEMU main loop for
bdrv_drain_all() and live migration.  In the meantime, this patch makes
the dataplane lifecycle more robust but should make no visible
difference.  It may be useful in the virtio-net dataplane effort.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agogluster: Add discard support for GlusterFS block driver.
Bharata B Rao [Tue, 16 Jul 2013 16:17:42 +0000 (21:47 +0530)]
gluster: Add discard support for GlusterFS block driver.

Implement bdrv_aio_discard for gluster.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agogluster: Use pkg-config to configure GlusterFS block driver
Bharata B Rao [Tue, 16 Jul 2013 16:17:41 +0000 (21:47 +0530)]
gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency
for GlusterFS block driver.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoboot-order-test: Add tests for Sun4u
Markus Armbruster [Wed, 26 Jun 2013 13:52:23 +0000 (15:52 +0200)]
boot-order-test: Add tests for Sun4u

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-13-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agolibqos: Generalize I/O-mapped fw_cfg
Markus Armbruster [Wed, 26 Jun 2013 13:52:22 +0000 (15:52 +0200)]
libqos: Generalize I/O-mapped fw_cfg

Provide a constructor that takes the base address in addition to the
PC-specific one.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-12-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: Add tests for Sun4m
Markus Armbruster [Wed, 26 Jun 2013 13:52:21 +0000 (15:52 +0200)]
boot-order-test: Add tests for Sun4m

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-11-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: Add tests for PowerPC PREP
Markus Armbruster [Wed, 26 Jun 2013 13:52:20 +0000 (15:52 +0200)]
boot-order-test: Add tests for PowerPC PREP

Cc: Andreas Färber <afaerber@suse.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-10-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: Code motion for better readability
Markus Armbruster [Wed, 26 Jun 2013 13:52:19 +0000 (15:52 +0200)]
boot-order-test: Code motion for better readability

Cc: Andreas Färber <afaerber@suse.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-9-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: Better separate target-specific and generic parts
Markus Armbruster [Wed, 26 Jun 2013 13:52:18 +0000 (15:52 +0200)]
boot-order-test: Better separate target-specific and generic parts

The initial version did just PC.  I didn't bother to separate out
generic parts, because I don't like to abstract from a single case.

Now we have two cases, PC and PowerMac, and I'm about to add more.
Time to do it right.

To ease review, this commit changes the code in-place, and the next
commit reorders it for better readability.

Cc: Andreas Färber <afaerber@suse.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-8-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: Cover -boot once in ppc tests
Markus Armbruster [Wed, 26 Jun 2013 13:52:17 +0000 (15:52 +0200)]
boot-order-test: Cover -boot once in ppc tests

Cc: Andreas Färber <afaerber@suse.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-7-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: Add tests for PowerMacs
Andreas Färber [Wed, 26 Jun 2013 13:52:16 +0000 (15:52 +0200)]
boot-order-test: Add tests for PowerMacs

They set the boot device via fw_cfg, which is then translated to a boot
path of "hd" or "cd" in OpenBIOS.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-6-git-send-email-armbru@redhat.com
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Converted to libqos/fw_cfg on Anthony's request.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agolibqos: Add support for memory-mapped fw_cfg
Markus Armbruster [Wed, 26 Jun 2013 13:52:15 +0000 (15:52 +0200)]
libqos: Add support for memory-mapped fw_cfg

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agolibqos: include dependencies
Anthony Liguori [Wed, 26 Jun 2013 13:52:14 +0000 (15:52 +0200)]
libqos: include dependencies

Otherwise rebuilds can fail when libqos is modified.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoboot-order-test: New; covering just PC for now
Markus Armbruster [Wed, 26 Jun 2013 13:52:13 +0000 (15:52 +0200)]
boot-order-test: New; covering just PC for now

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoqtest: Don't reset on qtest chardev connect
Markus Armbruster [Wed, 26 Jun 2013 13:52:12 +0000 (15:52 +0200)]
qtest: Don't reset on qtest chardev connect

libqtest's qtest_init() connecting to the qtest socket triggers reset.
This was coded in the hope we could use the same QEMU process for
multiple tests that way.  Never used.  Injects an extra reset even
when it's not used, and that can mess up tests such as the one of
-boot once I'm about to add.  Drop it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372254743-15808-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agolibqtest: New qtest_end() to go with qtest_start()
Markus Armbruster [Thu, 20 Jun 2013 06:55:29 +0000 (08:55 +0200)]
libqtest: New qtest_end() to go with qtest_start()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371711329-9144-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agolibqtest: Plug fd and memory leaks in qtest_quit()
Markus Armbruster [Thu, 20 Jun 2013 06:55:28 +0000 (08:55 +0200)]
libqtest: Plug fd and memory leaks in qtest_quit()

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1371711329-9144-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agomonitor: maintain at most one G_IO_OUT watch
Laszlo Ersek [Tue, 16 Jul 2013 18:19:41 +0000 (20:19 +0200)]
monitor: maintain at most one G_IO_OUT watch

When monitor_flush() is invoked repeatedly outside the monitor_unblocked()
callback, for example from tlb_info() -> ... -> print_pte(), several
watches may be added for the same event.

This is no problem per se because the extra monitor_unblocked() callbacks
are harmless if mon->outbuf is empty, the watches will be removed
gradually. However a big number of watches can grow "gpollfds" without
limit in glib_pollfds_fill(), triggering a -1/EINVAL condition in
g_poll().

Keep at most one such watch, by following the pattern observable in eg.
commits c874ea97 and c3d6b96e. The change has no effect when
monitor_unblocked() calls monitor_flush() (when the watch can either be
removed or renewed 1-for-1), but non-callback contexts won't create an
additional watch when the monitor already has one.

Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=970047

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1373998781-29561-3-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agochar: io_channel_send: don't lose written bytes
Laszlo Ersek [Tue, 16 Jul 2013 18:19:40 +0000 (20:19 +0200)]
char: io_channel_send: don't lose written bytes

The g_io_channel_write_chars() documentation states,

  bytes_written: The number of bytes written. This can be nonzero even if
                 the return value is not G_IO_STATUS_NORMAL. [...]

io_channel_send() could lose such bytes before.

Furthermore, the (status == G_IO_STATUS_EOF) condition used to evaluate to
constant false whenever it was reached. When that condition actually held,
it always led to -1 / EINVAL. This patch (almost) distinguishes
G_IO_STATUS_EOF only when no bytes have been written, and then treats it
as an error.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1373998781-29561-2-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoconfigure: Provide more helpful message if libvte not present
Peter Maydell [Thu, 18 Jul 2013 15:42:01 +0000 (16:42 +0100)]
configure: Provide more helpful message if libvte not present

If the system has GTK but not libvte, it's more helpful to
tell the user that libvte is missing than to simply say that
GTK is not present.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1374162121-31582-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agopc-bios: Update palcode-clipper
Richard Henderson [Tue, 16 Jul 2013 13:48:28 +0000 (06:48 -0700)]
pc-bios: Update palcode-clipper

Update image to c87a92639b28ac42bc8f6c67443543b405dc479b,
incorporating changes for vm_time.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-alpha: Move alarm to vm_clock
Richard Henderson [Tue, 16 Jul 2013 13:45:57 +0000 (06:45 -0700)]
target-alpha: Move alarm to vm_clock

Basing the alarm off the rtc_clock was silly.  It leads to horrible
spinning in the guest after being suspended and resumed, as it tries
to catch up with lost ticks.

This requires adding an accessor for reading the vm_clock too.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoMerge remote-tracking branch 'awilliam/tags/vfio-for-qemu-1.6' into staging
Anthony Liguori [Thu, 18 Jul 2013 13:14:22 +0000 (08:14 -0500)]
Merge remote-tracking branch 'awilliam/tags/vfio-for-qemu-1.6' into staging

vfio: enhanced VGA quirks + AER error containment

# gpg: Signature made Wed 17 Jul 2013 05:39:38 PM CDT using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

# By Alex Williamson (1) and Vijay Mohan Pandarathil (1)
# Via Alex Williamson
* awilliam/tags/vfio-for-qemu-1.6:
  vfio: QEMU-AER: Qemu changes to support AER for VFIO-PCI devices
  vfio-pci: VGA quirk update

Message-id: 20130717224939.4763.87264.stgit@bling.home
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Thu, 18 Jul 2013 13:14:10 +0000 (08:14 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Amos Kong (1) and Luiz Capitulino (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  qmp: update send-key document
  qapi: qapi-commands: fix possible leaks on visitor dealloc

Message-id: 1374093679-29213-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Thu, 18 Jul 2013 13:13:50 +0000 (08:13 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Peter Lieven (4) and Ronnie Sahlberg (1)
# Via Paolo Bonzini
* bonzini/scsi-next:
  iscsi: factor out sector conversions
  iscsi: assert that sectors are aligned to LUN blocksize
  iscsi: remove support for misaligned nb_sectors in aio_readv
  iscsi: fix -ENOSPC in iscsi_create()
  Fix iSCSI crash on SG_IO with an iovector

Message-id: 1374073524-8469-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Thu, 18 Jul 2013 13:12:47 +0000 (08:12 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pci,net,pc enhancements

This includes some fixes and enhancements that accumulated in my tree:
pci fixes by dkoch, virtio-net enhancements by akong and mst,
and a fix for xen pc by mst.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Wed 17 Jul 2013 04:44:45 AM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Don Koch (2) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  pc: don't access fw cfg if NULL
  virtio-net: add feature bit for any header s/g
  net: add support of mac-programming over macvtap in QEMU side
  pci: fix BRDIGE typo
  pci-bridge: update mappings for migration/restore

Message-id: 1374054430-21966-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoexec: fix incorrect assumptions in memory_access_size
Paolo Bonzini [Wed, 17 Jul 2013 11:17:41 +0000 (13:17 +0200)]
exec: fix incorrect assumptions in memory_access_size

access_size_min can be 1 because erroneous accesses must not crash
QEMU, they should trigger exceptions in the guest or just return
garbage (depending on the CPU).  I am not sure I understand the
comment: placing a 4-byte field at the last byte of a region
makes no sense (unless impl.unaligned is true), and that is
why memory.c:access_with_adjusted_size does not bother with
minimums larger than the remaining length.

access_size_max can be mr->ops->valid.max_access_size because memory.c
can and will still break accesses bigger than
mr->ops->impl.max_access_size.

Reported-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: Return -1 again on reads from unsigned regions
Jan Kiszka [Tue, 16 Jul 2013 12:45:16 +0000 (14:45 +0200)]
memory: Return -1 again on reads from unsigned regions

This restore the behavior prior to b018ddf633 which accidentally changed
the return code to 0. Specifically guests probing for register existence
were affected by this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: actually set the owner
Paolo Bonzini [Mon, 15 Jul 2013 13:48:50 +0000 (15:48 +0200)]
memory: actually set the owner

Brown paper bag for me.  Originally commit 803c0816 came before commit
2c9b15c.  When the order was inverted, I left in the NULL initialization
of mr->owner.

Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoexec.c: Pass correct pointer type to qemu_ram_ptr_length
Peter Maydell [Mon, 8 Jul 2013 08:44:04 +0000 (09:44 +0100)]
exec.c: Pass correct pointer type to qemu_ram_ptr_length

Commit e3127ae0 introduced a problem where we're passing a
hwaddr* to qemu_ram_ptr_length() but it wants a ram_addr_t*;
this will cause problems on 32 bit hosts and in any case
provokes a clang warning on MacOSX:

  CC    arm-softmmu/exec.o
exec.c:2164:46: warning: incompatible pointer types passing 'hwaddr *'
(aka 'unsigned long long *') to parameter of type 'ram_addr_t *'
(aka 'unsigned long *')
[-Wincompatible-pointer-types]
    return qemu_ram_ptr_length(raddr + base, plen);
                                             ^~~~
exec.c:1392:63: note: passing argument to parameter 'size' here
static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)
                                                              ^

Since this function is only used in one place, change its
prototype to pass a hwaddr* rather than a ram_addr_t*,
rather than contorting the calling code to get the type right.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Riku Voipio <riku.voipio@linaro.org>
Tested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agotrace-events: Fix up source file comments
Markus Armbruster [Fri, 7 Jun 2013 10:59:21 +0000 (12:59 +0200)]
trace-events: Fix up source file comments

They're all wrong since (at least) Paolo's big source tree
reorganization.  Need to shuffle some event declarations around to
keep them under the correct source file comment.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace-events: Drop unused events
Markus Armbruster [Fri, 7 Jun 2013 10:59:20 +0000 (12:59 +0200)]
trace-events: Drop unused events

Dropped event                           Unused since
mirror_cow                              884fea4
paio_complete                           47e6b25
paio_cancel                             47e6b25
usb_ehci_data                           0ce668b
megasas_qf_dequeue                      never used
megasas_handle_frame                    never used
megasas_io_continue                     never used
megasas_iovec_map_failed                never used
megasas_dcmd_map_failed                 never used
milkymist_softusb_mouse_event           4c15ba9
xen_map_block                           6506e4f
xen_unmap_block                         6506e4f
qemu_spice_start                        67be672
qemu_spice_stop                         67be672

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agomilkymist-minimac2: Fix minimac2_read/_write tracepoints
Markus Armbruster [Fri, 7 Jun 2013 10:59:19 +0000 (12:59 +0200)]
milkymist-minimac2: Fix minimac2_read/_write tracepoints

Broken in milkymist-minimac.c from the start (commit 0742454),
faithfully moved to milkymist-minimac2.c (commit 57aa265).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoslavio_misc: Fix slavio_led_mem_readw/_writew tracepoints
Markus Armbruster [Fri, 7 Jun 2013 10:59:18 +0000 (12:59 +0200)]
slavio_misc: Fix slavio_led_mem_readw/_writew tracepoints

Broken since they got added in commit 97bf485.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agocleanup-trace-events.pl: New
Markus Armbruster [Fri, 7 Jun 2013 10:59:17 +0000 (12:59 +0200)]
cleanup-trace-events.pl: New

Simple script to drop unused events and fix up source file comments.
The next few commits put it to use.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqmp: update send-key document
Amos Kong [Tue, 16 Jul 2013 11:52:14 +0000 (19:52 +0800)]
qmp: update send-key document

commit 9f328977 changes qmp_send_key() to accept key codes in hex,
but the document wasn't updated. The items of keys list is union
now, not enum.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoiscsi: factor out sector conversions
Peter Lieven [Thu, 11 Jul 2013 12:16:25 +0000 (14:16 +0200)]
iscsi: factor out sector conversions

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoiscsi: assert that sectors are aligned to LUN blocksize
Peter Lieven [Thu, 11 Jul 2013 12:16:27 +0000 (14:16 +0200)]
iscsi: assert that sectors are aligned to LUN blocksize

if the blocksize of an iSCSI LUN is bigger than the BDRV_SECTOR_SIZE
it is possible that sector_num or nb_sectors are not correctly
aligned.

to avoid corruption we fail requests which are misaligned.

Signed-off-by: Peter Lieven <pl@kamp.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoiscsi: remove support for misaligned nb_sectors in aio_readv
Peter Lieven [Thu, 11 Jul 2013 12:16:26 +0000 (14:16 +0200)]
iscsi: remove support for misaligned nb_sectors in aio_readv

this hask is not working (anymore). support for misaligned offsets should
be handled at the block layer.

Signed-off-by: Peter Lieven <pl@kamp.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoiscsi: fix -ENOSPC in iscsi_create()
Peter Lieven [Thu, 11 Jul 2013 12:16:24 +0000 (14:16 +0200)]
iscsi: fix -ENOSPC in iscsi_create()

the -ENOPSC case did not work due to the missing goto.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoFix iSCSI crash on SG_IO with an iovector
Ronnie Sahlberg [Sun, 23 Jun 2013 15:07:08 +0000 (08:07 -0700)]
Fix iSCSI crash on SG_IO with an iovector

Don't assume that SG_IO is always invoked with a simple buffer,
check the iovec_count and if it is >= 1 then we need to pass an array
of iovectors to libiscsi instead of just a plain buffer.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoqapi: qapi-commands: fix possible leaks on visitor dealloc
Luiz Capitulino [Thu, 11 Jul 2013 18:26:56 +0000 (14:26 -0400)]
qapi: qapi-commands: fix possible leaks on visitor dealloc

In qmp-marshal.c the dealloc visitor calls use the same errp
pointer of the input visitor calls. This means that if any of
the input visitor calls fails, then the dealloc visitor will
return early, before freeing the object's memory.

Here's an example, consider this code:

int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret)
{
[...]

    char * device = NULL;
    char * password = NULL;

    mi = qmp_input_visitor_new_strict(QOBJECT(args));
    v = qmp_input_get_visitor(mi);
    visit_type_str(v, &device, "device", errp);
    visit_type_str(v, &password, "password", errp);
    qmp_input_visitor_cleanup(mi);

    if (error_is_set(errp)) {
        goto out;
    }
    qmp_block_passwd(device, password, errp);

out:
    md = qapi_dealloc_visitor_new();
    v = qapi_dealloc_get_visitor(md);
    visit_type_str(v, &device, "device", errp);
    visit_type_str(v, &password, "password", errp);
    qapi_dealloc_visitor_cleanup(md);

[...]

    return 0;
}

Consider errp != NULL when the out label is reached, we're going
to leak device and password.

This patch fixes this by always passing errp=NULL for dealloc
visitors, meaning that we always try to free them regardless of
any previous failure. The above example would then be:

out:
    md = qapi_dealloc_visitor_new();
    v = qapi_dealloc_get_visitor(md);
    visit_type_str(v, &device, "device", NULL);
    visit_type_str(v, &password, "password", NULL);
    qapi_dealloc_visitor_cleanup(md);

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
10 years agovfio: QEMU-AER: Qemu changes to support AER for VFIO-PCI devices
Vijay Mohan Pandarathil [Mon, 15 Jul 2013 21:49:49 +0000 (15:49 -0600)]
vfio: QEMU-AER: Qemu changes to support AER for VFIO-PCI devices

Add support for error containment when a VFIO device assigned to a KVM
guest encounters an error. This is for PCIe devices/drivers that support AER
functionality. When the host OS is notified of an error in a device either
through the firmware first approach or through an interrupt handled by the AER
root port driver, the error handler registered by the vfio-pci driver gets
invoked. The qemu process is signaled through an eventfd registered per
VFIO device by the qemu process. In the eventfd handler, qemu decides on
what action to take. In this implementation, guest is brought down to
contain the error.

The kernel patches for the above functionality has been already accepted.

This is a refresh of the QEMU patch which was reviewed earlier.
http://marc.info/?l=linux-kernel&m=136281557608087&w=2
This patch has the same contents and has been built after refreshing
to latest upstream and after the linux headers have been updated in qemu.

- Create eventfd per vfio device assigned to a guest and register an
          event handler

- This fd is passed to the vfio_pci driver through the SET_IRQ ioctl

- When the device encounters an error, the eventfd is signalled
          and the qemu eventfd handler gets invoked.

- In the handler decide what action to take. Current action taken
          is to stop the guest.

Signed-off-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio-pci: VGA quirk update
Alex Williamson [Mon, 15 Jul 2013 21:48:11 +0000 (15:48 -0600)]
vfio-pci: VGA quirk update

Turns out all the suspicions for AMD devices were correct, everywhere
we read a BAR address that the address matches the config space offset,
there's full access to PCI config space.  Attempt to generalize some
helpers to allow quirks to easily be added for mirrors and windows.
Also fill in complete config space for AMD.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>