]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
10 years agoqtest: fix qtest for vhost-user
Nikolay Nikolaev [Thu, 19 Jun 2014 15:07:59 +0000 (18:07 +0300)]
qtest: fix qtest for vhost-user

Fix compile for older glib, provide conditionally compiled versions of the
used glib APIs.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agolibqemustub: add more stubs for qemu-char
Nikolay Nikolaev [Thu, 19 Jun 2014 15:07:40 +0000 (18:07 +0300)]
libqemustub: add more stubs for qemu-char

Additional stubs:
 - chr_baum_init
 - qemu_chr_open_spice_vmc
 - qemu_chr_open_spice_port

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqapi/hmp: use 'backend' instead of 'device' with memory backend
Igor Mammedov [Thu, 19 Jun 2014 14:14:43 +0000 (16:14 +0200)]
qapi/hmp: use 'backend' instead of 'device' with memory backend

fixup documentation comments and HMP message/help text

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost: fix resource leak in error handling
Michael S. Tsirkin [Wed, 18 Jun 2014 15:55:22 +0000 (18:55 +0300)]
vhost: fix resource leak in error handling

vhost_verify_ring_mappings leaks mappings on error.
Fix this up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost: block migration if backend does not log memory
Michael S. Tsirkin [Wed, 18 Jun 2014 14:20:42 +0000 (17:20 +0300)]
vhost: block migration if backend does not log memory

vhost user does not support LOG_ALL feature bit.
Generally, we should not try to set this bit without
checking that backend can support it first.

Detect and block migration.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Mon, 23 Jun 2014 11:55:22 +0000 (12:55 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Block pull request

# gpg: Signature made Mon 23 Jun 2014 09:53:49 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  block: asynchronously stop the VM on I/O errors
  vl: allow other threads to do qemu_system_vmstop_request
  sheepdog: fix NULL dereference in sd_create
  QemuOpts: check NULL opts in qemu_opt_get functions
  block: m25p80: Support read only bdrvs.
  block: m25p80: sync_page(): Deindent function body.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging
Peter Maydell [Mon, 23 Jun 2014 11:40:39 +0000 (12:40 +0100)]
Merge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging

* remotes/mcayland/qemu-sparc:
  apb: Fix out-of-bounds array write access

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mcayland/qemu-openbios' into staging
Peter Maydell [Mon, 23 Jun 2014 10:35:27 +0000 (11:35 +0100)]
Merge remote-tracking branch 'remotes/mcayland/qemu-openbios' into staging

* remotes/mcayland/qemu-openbios:
  Update OpenBIOS images

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoconsole: move chardev declarations to sysemu/char.h
Michael S. Tsirkin [Mon, 23 Jun 2014 07:29:07 +0000 (10:29 +0300)]
console: move chardev declarations to sysemu/char.h

move generic chardev APIs to sysemu/char.h, to make them available to
callers which can not depend on the whole of ui/console.h.
This fixes a build error on systems without pixman-devel:

./configure --disable-tools --disable-docs --target-list=arm-linux-user
...
pixman            none
...
make
...
In file included from
/data/home/nchip/linaro/qemu/include/ui/console.h:4:0,
                 from /data/home/nchip/linaro/qemu/stubs/vc-init.c:2:
/data/home/nchip/linaro/qemu/include/ui/qemu-pixman.h:14:20: fatal
error: pixman.h: No such file or directory
 #include <pixman.h>
                    ^
compilation terminated.

Reported-by: Riku Voipio <riku.voipio@iki.fi>
Tested-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1403508500-32691-1-git-send-email-mst@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock: asynchronously stop the VM on I/O errors
Paolo Bonzini [Thu, 5 Jun 2014 12:53:59 +0000 (14:53 +0200)]
block: asynchronously stop the VM on I/O errors

With virtio-blk dataplane, I/O errors might occur while QEMU is
not in the main I/O thread.  However, it's invalid to call vm_stop
when we're neither in a VCPU thread nor in the main I/O thread,
even if we were to take the iothread mutex around it.

To avoid this problem, we can raise a request to the main I/O thread,
similar to what QEMU does when vm_stop is called from a CPU thread.
We know that bdrv_error_action is called from an AIO callback, and
the moment at which the callback will fire is not well-defined; it
depends on the moment at which the disk or OS finishes the operation,
which can happen at any time.  Note that QEMU is certainly not in a CPU
thread and we do not need to call cpu_stop_current() like vm_stop() does.

However, we need to ensure that any action taken by management will
result in correct detection of the error _and_ a running VM.  In particular:

- the event must be raised after the iostatus has been set, so that
"info block" will return an iostatus that matches the event.

- the VM must be stopped after the iostatus has been set, so that
"info block" will return an iostatus that matches the runstate.

The ordering between the STOP and BLOCK_IO_ERROR events is preserved;
BLOCK_IO_ERROR is documented to come first.

This makes bdrv_error_action() thread safe (assuming QMP events are,
which is attacked by a separate series).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agovl: allow other threads to do qemu_system_vmstop_request
Paolo Bonzini [Thu, 5 Jun 2014 12:53:58 +0000 (14:53 +0200)]
vl: allow other threads to do qemu_system_vmstop_request

There patch protects vmstop_requested with a lock and introduces
qemu_system_vmstop_request_prepare.

Together with the new call to qemu_vmstop_requested in vm_start,
qemu_system_vmstop_request_prepare avoids a race where the VM could remain
stopped even though the iostatus of a block device has already been set
(for example).

qemu_system_vmstop_request_prepare however also lets the caller thread
delay observation of the state change until it has itself communicated
that change to the user.  This delay avoids any possibility of a wrong
reordering of the BLOCK_IO_ERROR event and the subsequent STOP event.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agosheepdog: fix NULL dereference in sd_create
Liu Yuan [Tue, 17 Jun 2014 05:45:35 +0000 (13:45 +0800)]
sheepdog: fix NULL dereference in sd_create

Following command

qemu-img create -f qcow2 sheepdog:test 20g

will cause core dump because aio_context is NULL in sd_create. We should
initialize it by qemu_get_aio_context() to avoid NULL dereference.

Cc: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoQemuOpts: check NULL opts in qemu_opt_get functions
Chunyan Liu [Wed, 18 Jun 2014 02:47:26 +0000 (10:47 +0800)]
QemuOpts: check NULL opts in qemu_opt_get functions

Some places will call bdrv_create_file(filename, NULL, &local_err), where
opts is NULL. Check NULL in qemu_opt_get and qemu_opt_get_*_del functions,
to avoid extra effort of checking opts before calling them every time.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: m25p80: Support read only bdrvs.
Peter Crosthwaite [Thu, 19 Jun 2014 01:36:37 +0000 (18:36 -0700)]
block: m25p80: Support read only bdrvs.

By just never doing write-backs. This is completely invisible to the
guest, as the entire storage area is implemented as device state (at
realize time the entire drive is read in).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: m25p80: sync_page(): Deindent function body.
Peter Crosthwaite [Thu, 19 Jun 2014 01:36:03 +0000 (18:36 -0700)]
block: m25p80: sync_page(): Deindent function body.

sync_page() was conditionalizing it's whole fn body on the bdrv being
non-null. Just return for the function immediately on NULL brdv and
get rid of the big if.

Makes implementation consistent with flash_zynq_area().

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoUpdate OpenBIOS images
Mark Cave-Ayland [Fri, 20 Jun 2014 22:59:19 +0000 (23:59 +0100)]
Update OpenBIOS images

Update OpenBIOS images to SVN r1306 built from submodule.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 years agoapb: Fix out-of-bounds array write access
Stefan Weil [Mon, 9 Jun 2014 14:19:29 +0000 (16:19 +0200)]
apb: Fix out-of-bounds array write access

The array regs is declared with IOMMU_NREGS (3) elements and accessed
using IOMMU_CTRL (0) and IOMMU_BASE (8). In most cases, those values
are right shifted before being used as an index which results in indices
0 and 1. In one case, this right shift was missing for IOMMU_BASE which
results in an out-of-bounds write access with index 8.

The patch adds the missing shift operation also for IOMMU_CTRL where
it is needed only for cosmetic reasons.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
10 years agogt64xxx_pci: Add VMStateDescription
Sanjay Lal [Fri, 20 Jun 2014 13:59:58 +0000 (14:59 +0100)]
gt64xxx_pci: Add VMStateDescription

Add VMStateDescription for GT64120 PCI emulation used by the Malta
platform, to allow it to work with savevm/loadvm and live migration.

The entire register array is saved/restored using VMSTATE_UINT32_ARRAY
(fixed length GT_REGS = 1024).

Signed-off-by: Sanjay Lal <sanjayl@kymasys.com>
[james.hogan@imgtec.com: Convert to VMState]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Andreas Färber <afaerber@suse.de>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotarget-mips: copy CP0_Config1 into DisasContext
Aurelien Jarno [Thu, 29 May 2014 13:50:17 +0000 (15:50 +0200)]
target-mips: copy CP0_Config1 into DisasContext

In order to avoid access to the CPUMIPSState structure in the
translator, keep a copy of CP0_Config1 into DisasContext. The whole
register is read-only so it can be copied as a single value.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agoMerge remote-tracking branch 'remotes/kvm/uq/master' into staging
Peter Maydell [Fri, 20 Jun 2014 18:25:17 +0000 (19:25 +0100)]
Merge remote-tracking branch 'remotes/kvm/uq/master' into staging

* remotes/kvm/uq/master:
  hw/mips: malta: Don't boot from flash with KVM T&E
  MAINTAINERS: Add entry for MIPS KVM
  target-mips: Enable KVM support in build system
  hw/mips: malta: Add KVM support
  hw/mips: In KVM mode, inject IRQ2 (I/O) interrupts via ioctls
  target-mips: Call kvm_mips_reset_vcpu() from mips_cpu_reset()
  target-mips: kvm: Add main KVM support for MIPS
  kvm: Allow arch to set sigmask length
  target-mips: get_physical_address: Add KVM awareness
  target-mips: get_physical_address: Add defines for segment bases
  hw/mips: Add API to convert KVM guest KSEG0 <-> GPA
  hw/mips/cputimer: Don't start periodic timer in KVM mode
  target-mips: Reset CPU timer consistently
  KVM: Fix GSI number space limit

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Fri, 20 Jun 2014 17:01:24 +0000 (18:01 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc,pci,virtio,hotplug fixes, enhancements

numa work by Hu Tao and others
memory hotplug by Igor
vhost-user by Nikolay, Antonios and others
guest virtio announcements by Jason
qtest fixes by Sergey
qdev hotplug fixes by Paolo
misc other fixes mostly by myself

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* remotes/mst/tags/for_upstream: (109 commits)
  numa: use RAM_ADDR_FMT with ram_addr_t
  qapi/string-output-visitor: fix bugs
  tests: simplify code
  qapi: fix input visitor bugs
  acpi: rephrase comment
  qmp: add ACPI_DEVICE_OST event handling
  qmp: add query-acpi-ospm-status command
  acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices
  acpi: introduce TYPE_ACPI_DEVICE_IF interface
  qmp: add query-memory-devices command
  numa: handle mmaped memory allocation failure correctly
  pc: acpi: do not hardcode preprocessor
  qmp: clean out whitespace
  qdev: recursively unrealize devices when unrealizing bus
  qdev: reorganize error reporting in bus_set_realized
  qapi: fix build on glib < 2.28
  qapi: make string output visitor parse int list
  qapi: make string input visitor parse int list
  tests: fix memory leak in test of string input visitor
  hmp: add info memdev
  ...

Conflicts:
include/hw/i386/pc.h
[PMM: fixed minor conflict in pc.h]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140619' into...
Peter Maydell [Fri, 20 Jun 2014 16:41:09 +0000 (17:41 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140619' into staging

target-arm:
 * Support PSCI 0.2 when using KVM
 * fix AIRCR reset value for v7M CPUs
 * report correct size information for pflash_cfi01
 * minor coverity fixes
 * avoid warnings on Windows builds due to #define clash
 * implement TTBCR PD0/PD1 bits

# gpg: Signature made Thu 19 Jun 2014 18:35:06 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20140619:
  armv7m_nvic: fix AIRCR implementation
  Use PSCI v0.2 compatible string when KVM or TCG provides it
  target-arm: Introduce per-CPU field for PSCI version
  target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64
  target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible
  target-arm: Common kvm_arm_vcpu_init() for KVM ARM and KVM ARM64
  kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT
  hw/block/pflash_cfi01: Report correct size info for parallel configs
  hw/arm/vexpress: Forbid specifying flash contents in two ways at once
  target-arm/translate-a64.c: Fix dead ?: in handle_simd_shift_fpint_conv()
  target-arm/translate-a64.c: Remove dead ?: in disas_simd_3same_int()
  target-arm: Add ULL suffix to calculation of page size
  hw/arm/spitz: Avoid clash with Windows header symbol MOD_SHIFT
  target-arm: implement PD0/PD1 bits for TTBCR

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20140619-1' into staging
Peter Maydell [Fri, 20 Jun 2014 15:57:28 +0000 (16:57 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20140619-1' into staging

vnc: cleanups and fixes

# gpg: Signature made Thu 19 Jun 2014 12:02:09 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vnc-20140619-1:
  vnc: fix screen updates
  vnc: Drop superfluous conditionals around g_strdup()
  vnc: Drop superfluous conditionals around g_free()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agospice: fix 32bit build
Gerd Hoffmann [Fri, 20 Jun 2014 06:12:44 +0000 (08:12 +0200)]
spice: fix 32bit build

Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1403244764-8622-1-git-send-email-kraxel@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tcg-next' into staging
Peter Maydell [Fri, 20 Jun 2014 14:44:31 +0000 (15:44 +0100)]
Merge remote-tracking branch 'remotes/rth/tcg-next' into staging

* remotes/rth/tcg-next:
  tcg/optimize: Don't special case TCG_OPF_CALL_CLOBBER

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/mips: malta: Don't boot from flash with KVM T&E
James Hogan [Fri, 20 Jun 2014 11:47:59 +0000 (12:47 +0100)]
hw/mips: malta: Don't boot from flash with KVM T&E

In KVM trap & emulate (T&E) mode the flash reset region at 0xbfc00000
isn't executable, which is why the minimal kernel bootloader is loaded
and executed from the last 1MB of DRAM instead.

Therefore if no kernel is provided on the command line and KVM is
enabled, exit with an error since booting from flash will fail.

Reported-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoarmv7m_nvic: fix AIRCR implementation
Oran Avraham [Thu, 19 Jun 2014 17:06:27 +0000 (18:06 +0100)]
armv7m_nvic: fix AIRCR implementation

The returned reset value was wrong (off by one zero nibble), and
qemu didn't log unimplemented writes to the PRIGROUP field.

Signed-off-by: Oran Avraham <oranav@gmail.com>
Message-id: 1403010447-4627-1-git-send-email-oranav@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoUse PSCI v0.2 compatible string when KVM or TCG provides it
Pranavkumar Sawargaonkar [Thu, 19 Jun 2014 17:06:27 +0000 (18:06 +0100)]
Use PSCI v0.2 compatible string when KVM or TCG provides it

If we have PSCI v0.2 emulation available for KVM ARM/ARM64 or TCG then
we need to provide PSCI v0.2 compatible string via generated DTB.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Rob Herring <rob.herring@linaro.org>
Message-id: 1402901605-24551-9-git-send-email-pranavkumar@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Introduce per-CPU field for PSCI version
Pranavkumar Sawargaonkar [Thu, 19 Jun 2014 17:06:26 +0000 (18:06 +0100)]
target-arm: Introduce per-CPU field for PSCI version

We require to know the PSCI version available to given CPU at
potentially many places. Currently, we need to know PSCI version
when generating DTB for virt machine.

This patch introduce per-CPU 32bit field representing the PSCI
version available to the CPU. The encoding of this 32bit field
is same as described in PSCI v0.2 spec.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402901605-24551-8-git-send-email-pranavkumar@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64
Pranavkumar Sawargaonkar [Thu, 19 Jun 2014 17:06:26 +0000 (18:06 +0100)]
target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64

To implement kvm_arch_reset_vcpu(), we simply re-init the VCPU
using kvm_arm_vcpu_init() so that all registers of VCPU are set
to their reset values by in-kernel KVM code.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402901605-24551-7-git-send-email-pranavkumar@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible
Pranavkumar Sawargaonkar [Thu, 19 Jun 2014 17:06:26 +0000 (18:06 +0100)]
target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible

Latest linux kernel supports in-kernel emulation of PSCI v0.2 but
to enable it we need to select KVM_ARM_VCPU_PSCI_0_2 feature using
KVM_ARM_VCPU_INIT ioctl.

Also, we can use KVM_ARM_VCPU_PSCI_0_2 feature for VCPU only when
linux kernel has KVM_CAP_ARM_PSCI_0_2 capability.

This patch updates kvm_arch_init_vcpu() to enable KVM_ARM_VCPU_PSCI_0_2
feature for VCPU when KVM ARM/ARM64 has KVM_CAP_ARM_PSCI_0_2 capability.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402901605-24551-6-git-send-email-pranavkumar@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Common kvm_arm_vcpu_init() for KVM ARM and KVM ARM64
Pranavkumar Sawargaonkar [Thu, 19 Jun 2014 17:06:26 +0000 (18:06 +0100)]
target-arm: Common kvm_arm_vcpu_init() for KVM ARM and KVM ARM64

Introduce a common kvm_arm_vcpu_init() for doing KVM_ARM_VCPU_INIT
ioctl in KVM ARM and KVM ARM64. This also helps us factor-out few
common code lines from kvm_arch_init_vcpu() for KVM ARM/ARM64.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402901605-24551-5-git-send-email-pranavkumar@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agokvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT
Pranavkumar Sawargaonkar [Thu, 19 Jun 2014 17:06:25 +0000 (18:06 +0100)]
kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT

In-kernel PSCI v0.2 emulation of KVM ARM/ARM64 forwards SYSTEM_OFF
and SYSTEM_RESET function calls to QEMU using KVM_EXIT_SYSTEM_EVENT
exit reason.

This patch updates kvm_cpu_exec() to handle KVM_SYSTEM_EVENT_SHUTDOWN
and KVM_SYSTEM_EVENT_RESET system-level events from QEMU-side.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402901605-24551-4-git-send-email-pranavkumar@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agohw/block/pflash_cfi01: Report correct size info for parallel configs
Peter Maydell [Thu, 19 Jun 2014 17:06:25 +0000 (18:06 +0100)]
hw/block/pflash_cfi01: Report correct size info for parallel configs

If the flash device is configured with a device-width which is
not equal to the bank-width, indicating that it is actually several
narrow flash devices in parallel, the CFI table should report the
number of blocks and the size of a single device, not of the whole
combined setup. This stops Linux from complaining:
"NOR chip too large to fit in mapping. Attempting to cope..."

As usual, we retain the old broken but backwards compatible behaviour
when the device-width is not specified.

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

10 years agohw/arm/vexpress: Forbid specifying flash contents in two ways at once
Peter Maydell [Thu, 19 Jun 2014 17:06:25 +0000 (18:06 +0100)]
hw/arm/vexpress: Forbid specifying flash contents in two ways at once

Detect attempts by the user to specify the contents of the first flash
device via both -bios and -drive if=pflash... simultaneously and
print a helpful error message.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402419834-25982-1-git-send-email-peter.maydell@linaro.org

10 years agotarget-arm/translate-a64.c: Fix dead ?: in handle_simd_shift_fpint_conv()
Peter Maydell [Thu, 19 Jun 2014 17:06:25 +0000 (18:06 +0100)]
target-arm/translate-a64.c: Fix dead ?: in handle_simd_shift_fpint_conv()

In handle_simd_shift_fpint_conv(), the combination of is_double == true,
is_scalar == false and is_q == false is an unallocated encoding; the
'both parts false' case of the nested ?: expression for calculating
maxpass is therefore unreachable and can be removed.

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

10 years agotarget-arm/translate-a64.c: Remove dead ?: in disas_simd_3same_int()
Peter Maydell [Thu, 19 Jun 2014 17:06:24 +0000 (18:06 +0100)]
target-arm/translate-a64.c: Remove dead ?: in disas_simd_3same_int()

In disas_simd_3same_int(), none of the instructions permit is_q
to be false with size == 3 (this would be a vector operation with
a one-element vector, and the instruction set encodes those as
scalar operations). Replace the always-true ?: check with an
assert.

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

10 years agotarget-arm: Add ULL suffix to calculation of page size
Peter Maydell [Thu, 19 Jun 2014 17:06:24 +0000 (18:06 +0100)]
target-arm: Add ULL suffix to calculation of page size

The maximum block size for AArch64 address translation is 2GB. This means
that we need a ULL suffix on our shift to avoid shifting into the sign
bit of a signed 32 bit integer.

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

10 years agohw/arm/spitz: Avoid clash with Windows header symbol MOD_SHIFT
Peter Maydell [Thu, 19 Jun 2014 17:06:24 +0000 (18:06 +0100)]
hw/arm/spitz: Avoid clash with Windows header symbol MOD_SHIFT

The Windows headers provided by MinGW define MOD_SHIFT. Avoid
it by using SPITZ_MOD_* for our constants here.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: implement PD0/PD1 bits for TTBCR
Fabian Aggeler [Thu, 19 Jun 2014 17:06:24 +0000 (18:06 +0100)]
target-arm: implement PD0/PD1 bits for TTBCR

Corrected handling of writes to TTBCR for ARMv8 (previously UNK/SBZP
bits are not RES0) and ARMv7 (new bits PD0/PD1 for CPUs with Security
Extensions).

Bits PD0/PD1 are now respected in get_phys_addr_v6/v5() and
get_level1_table_address.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Message-id: 1402409556-18574-1-git-send-email-aggelerf@ethz.ch
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agonuma: use RAM_ADDR_FMT with ram_addr_t
Michael S. Tsirkin [Thu, 19 Jun 2014 10:08:35 +0000 (13:08 +0300)]
numa: use RAM_ADDR_FMT with ram_addr_t

commit 4407ab055be995e64633322a78e64dfa376dc534
    vl.c: extend -m option to support options for memory hotplug
prints ram_addr_t with u64 format, this is wrong for
some systems, in particular w32.

print ram_addr_t with RAM_ADDR_FMT to fix build on w32.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqapi/string-output-visitor: fix bugs
Michael S. Tsirkin [Wed, 18 Jun 2014 14:59:51 +0000 (17:59 +0300)]
qapi/string-output-visitor: fix bugs

in human mode, we are creating the string:

16-31 (16-31)

instead of

16-17 (10-1f)

because we forgot to pass 'true' as the human parameter on one of the
two calls to format_string.
Also, this is a worsening of quality; previously we would produce

16 (0x10)

to make it obvious which number was hex.
Fix these issues.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agotests: simplify code
Michael S. Tsirkin [Wed, 18 Jun 2014 14:52:52 +0000 (17:52 +0300)]
tests: simplify code

Use error_abort instead of open-coded assert.
Cleaner and shorter.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoqapi: fix input visitor bugs
Michael S. Tsirkin [Wed, 18 Jun 2014 14:50:07 +0000 (17:50 +0300)]
qapi: fix input visitor bugs

Remove dead code.  Reset errno to 0 before each strtoull call, as the
man page requires.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoacpi: rephrase comment
Michael S. Tsirkin [Tue, 17 Jun 2014 19:02:00 +0000 (22:02 +0300)]
acpi: rephrase comment

"only upto" is not proper English.
Say "up to" and drop "only".

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqmp: add ACPI_DEVICE_OST event handling
Igor Mammedov [Mon, 16 Jun 2014 17:12:29 +0000 (19:12 +0200)]
qmp: add ACPI_DEVICE_OST event handling

emits event when ACPI OSPM evaluates _OST method
of ACPI device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqmp: add query-acpi-ospm-status command
Igor Mammedov [Mon, 16 Jun 2014 17:12:28 +0000 (19:12 +0200)]
qmp: add query-acpi-ospm-status command

... to get ACPI OSPM status reported by ACPI devices
via _OST method.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi: implement ospm_status() method for PIIX4/ICH9_LPC devices
Igor Mammedov [Mon, 16 Jun 2014 17:12:27 +0000 (19:12 +0200)]
acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices

... using TYPE_ACPI_DEVICE_IF interface.
Which provides status reporting of ACPI declared memory devices

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoacpi: introduce TYPE_ACPI_DEVICE_IF interface
Igor Mammedov [Mon, 16 Jun 2014 17:12:26 +0000 (19:12 +0200)]
acpi: introduce TYPE_ACPI_DEVICE_IF interface

... it will be used to abstract generic ACPI bits from
device that implements ACPI interface.

ACPIOSTInfo type is used for passing-through raw _OST
event/status codes reported by guest OS to a management
layer. It lets management tools interpret values
as specified by ACPI spec if it is interested in it.

QEMU doesn't encode these values as enum, since it
doesn't need to handle them and it allows interface
to scale well without any changes in QEMU while guest
OS and management evolves in time.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqmp: add query-memory-devices command
Igor Mammedov [Mon, 16 Jun 2014 17:12:25 +0000 (19:12 +0200)]
qmp: add query-memory-devices command

... allowing to get state of present memory devices.
Currently implemented only for PCDIMMDevice.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agonuma: handle mmaped memory allocation failure correctly
Igor Mammedov [Tue, 17 Jun 2014 10:17:05 +0000 (12:17 +0200)]
numa: handle mmaped memory allocation failure correctly

when memory_region_init_ram_from_file() fails
memory_region_size() will still return size that was
provided at region init time.
Instead use errp to properly detect error condition.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: acpi: do not hardcode preprocessor
Igor Mammedov [Mon, 16 Jun 2014 16:33:40 +0000 (18:33 +0200)]
pc: acpi: do not hardcode preprocessor

but use one provided by environment, in addition
force C style preprocessing so that 'gcc -E' or
"clang -E" wouldn't ignore .dsl files.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqmp: clean out whitespace
Michael S. Tsirkin [Mon, 16 Jun 2014 12:20:18 +0000 (15:20 +0300)]
qmp: clean out whitespace

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqdev: recursively unrealize devices when unrealizing bus
Paolo Bonzini [Wed, 11 Jun 2014 12:52:09 +0000 (14:52 +0200)]
qdev: recursively unrealize devices when unrealizing bus

When the patch was posted that became 5c21ce7 (qdev: Realize buses
on device realization, 2014-03-12), it included recursive realization
and unrealization of devices when the bus's "realized" property
was toggled.

However, due to the same old worries about recursive realization
and prerequisites not being realized yet, those hunks were dropped when
committing the patch.  Unfortunately, this causes a use-after-free bug
(easily reproduced by a PCI hot-unplug action).

Before the patch, device_unparent behaved as follows:

   for each child bus
     unparent bus ----------------------------.
     | for each child device                  |
     |   unparent device ---------------.     |
     |   | unrealize device             |     |
     |   | call dc->unparent            |     |
     |   '-------------------------------     |
     '----------------------------------------'
   unrealize device

After the patch, it behaves as follows instead:

   unrealize device --------------------.
   | for each child bus                 |
   |   unrealize bus               (A)  |
   '------------------------------------'
   for each child bus
     unparent bus ----------------------.
     | for each child device            |
     |   unrealize device          (B)  |
     |   call dc->unparent              |
     '----------------------------------'

At the step marked (B) the device might use data from the bus that is
not available anymore due to step (A).

To fix this, we need to unrealize devices before step (A).  To sidestep
concerns about recursive realization, only do recursive unrealization
and leave the "value && !bus->realized" case as it is.

The resulting flow is:

   for each child bus
     unrealize bus ---------------------.
     | for each child device            |
     |   unrealize device          (B)  |
     | call bc->unrealize          (A)  |
     '----------------------------------'
   unrealize device
   for each child bus
     unparent bus ----------------------.
     | for each child device            |
     |   unparent device                |
     '----------------------------------'

where everything is "powered down" before it is unassembled.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
10 years agoqdev: reorganize error reporting in bus_set_realized
Paolo Bonzini [Wed, 11 Jun 2014 12:52:08 +0000 (14:52 +0200)]
qdev: reorganize error reporting in bus_set_realized

No semantic change.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
10 years agoqapi: fix build on glib < 2.28
Michael S. Tsirkin [Mon, 16 Jun 2014 15:07:03 +0000 (18:07 +0300)]
qapi: fix build on glib < 2.28

The following commits:
    qapi: make string output visitor parse int list
    qapi: make string input visitor parse int list
break with glib < 2.28 since they use the
new g_list_free_full function.

Open-code that to fix build on old systems.

Cc: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqapi: make string output visitor parse int list
Hu Tao [Tue, 10 Jun 2014 11:15:28 +0000 (19:15 +0800)]
qapi: make string output visitor parse int list

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: split up patch

10 years agoqapi: make string input visitor parse int list
Hu Tao [Tue, 10 Jun 2014 11:15:27 +0000 (19:15 +0800)]
qapi: make string input visitor parse int list

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: split up patch

10 years agotests: fix memory leak in test of string input visitor
Hu Tao [Tue, 10 Jun 2014 11:15:26 +0000 (19:15 +0800)]
tests: fix memory leak in test of string input visitor

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohmp: add info memdev
Hu Tao [Wed, 14 May 2014 09:43:35 +0000 (17:43 +0800)]
hmp: add info memdev

This is the hmp counterpart of qmp query-memdev.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: fix build on 32 bit

10 years agoqmp: add query-memdev
Hu Tao [Mon, 16 Jun 2014 10:05:41 +0000 (18:05 +0800)]
qmp: add query-memdev

Add qmp command query-memdev to query for information
of memory devices

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohostmem: add properties for NUMA memory policy
Hu Tao [Tue, 10 Jun 2014 11:15:25 +0000 (19:15 +0800)]
hostmem: add properties for NUMA memory policy

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[Raise errors on setting properties if !CONFIG_NUMA.  Add BUILD_BUG_ON
 checks. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohostmem: add property to map memory with MAP_SHARED
Paolo Bonzini [Tue, 10 Jun 2014 11:15:24 +0000 (19:15 +0800)]
hostmem: add property to map memory with MAP_SHARED

A new "share" property can be used with the "memory-file" backend to
map memory with MAP_SHARED instead of MAP_PRIVATE.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohostmem: allow preallocation of any memory region
Paolo Bonzini [Tue, 10 Jun 2014 11:15:23 +0000 (19:15 +0800)]
hostmem: allow preallocation of any memory region

And allow preallocation of file-based memory even without -mem-prealloc.
Some care is necessary because -mem-prealloc does not allow disabling
preallocation for hostmem-file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohostmem: add merge and dump properties
Paolo Bonzini [Tue, 10 Jun 2014 11:15:22 +0000 (19:15 +0800)]
hostmem: add merge and dump properties

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoosdep: add merge and dump flags
Michael S. Tsirkin [Wed, 18 Jun 2014 18:48:19 +0000 (21:48 +0300)]
osdep: add merge and dump flags

will be used by follow up patch

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohostmem: add file-based HostMemoryBackend
Paolo Bonzini [Tue, 10 Jun 2014 11:15:21 +0000 (19:15 +0800)]
hostmem: add file-based HostMemoryBackend

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: comment tweak

10 years agohostmem: separate allocation from UserCreatable complete method
Hu Tao [Tue, 10 Jun 2014 11:15:19 +0000 (19:15 +0800)]
hostmem: separate allocation from UserCreatable complete method

This allows the superclass to set various policies on the memory
region that the subclass creates. Drops hostmem-ram's complete method
accordingly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agobackend:hostmem: replace hostmemory with host_memory
Hu Tao [Tue, 10 Jun 2014 11:15:18 +0000 (19:15 +0800)]
backend:hostmem: replace hostmemory with host_memory

..to keep names consistant.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: pass MachineState to pc_memory_init
Paolo Bonzini [Tue, 10 Jun 2014 11:15:17 +0000 (19:15 +0800)]
pc: pass MachineState to pc_memory_init

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovl: redo -object parsing
Paolo Bonzini [Tue, 10 Jun 2014 11:15:15 +0000 (19:15 +0800)]
vl: redo -object parsing

Follow the lines of the HMP implementation, using OptsVisitor
to parse the options.  This gives access to OptsVisitor's
rich parsing of integer lists.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agomemory: add error propagation to file-based RAM allocation
Paolo Bonzini [Wed, 14 May 2014 09:43:20 +0000 (17:43 +0800)]
memory: add error propagation to file-based RAM allocation

Right now, -mem-path will fall back to RAM-based allocation in some
cases.  This should never happen with "-object memory-file", prepare
the code by adding correct error propagation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: drop \n at end of error messages

10 years agomemory: move mem_path handling to memory_region_allocate_system_memory
Paolo Bonzini [Wed, 14 May 2014 09:43:19 +0000 (17:43 +0800)]
memory: move mem_path handling to memory_region_allocate_system_memory

Like the previous patch did in exec.c, split memory_region_init_ram and
memory_region_init_ram_from_file, and push mem_path one step further up.
Other RAM regions than system memory will now be backed by regular RAM.

Also, boards that do not use memory_region_allocate_system_memory will
not support -mem-path anymore.  This can be changed before the patches
are merged by migrating boards to use the function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agonuma: add -numa node,memdev= option
Paolo Bonzini [Wed, 14 May 2014 09:43:17 +0000 (17:43 +0800)]
numa: add -numa node,memdev= option

This option provides the infrastructure for binding guest NUMA nodes
to host NUMA nodes.  For example:

 -object memory-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 \
 -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
 -object memory-ram,size=1024M,policy=interleave,host-nodes=1-3,id=ram-node1 \
 -numa node,nodeid=1,cpus=1,memdev=ram-node1

The option replaces "-numa node,mem=".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
MST: conflict resolution

10 years agoqom: introduce object_property_get_enum and object_property_get_uint16List
Hu Tao [Wed, 14 May 2014 09:43:33 +0000 (17:43 +0800)]
qom: introduce object_property_get_enum and object_property_get_uint16List

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoIntroduce signed range.
Hu Tao [Wed, 14 May 2014 09:43:30 +0000 (17:43 +0800)]
Introduce signed range.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: split up patch

10 years agoconfigure: add Linux libnuma detection
Wanlong Gao [Wed, 14 May 2014 09:43:28 +0000 (17:43 +0800)]
configure: add Linux libnuma detection

Add detection of libnuma (mostly contained in the numactl package)
to the configure script. Can be enabled or disabled on the command
line, default is use if available.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agomemory: move RAM_PREALLOC_MASK to exec.c, rename
Paolo Bonzini [Wed, 14 May 2014 09:43:22 +0000 (17:43 +0800)]
memory: move RAM_PREALLOC_MASK to exec.c, rename

Prepare for adding more flags.  The "_MASK" suffix is unique, kill it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agomemory: move preallocation code out of exec.c
Paolo Bonzini [Wed, 14 May 2014 09:43:21 +0000 (17:43 +0800)]
memory: move preallocation code out of exec.c

So that backends can use it.

Since we need the page size for efficiency, move code to compute it
out of translate-all.c and into util/oslib-win32.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agomemory: reorganize file-based allocation
Paolo Bonzini [Wed, 14 May 2014 09:43:18 +0000 (17:43 +0800)]
memory: reorganize file-based allocation

Split the internal interface in exec.c to a separate function, and
push the check on mem_path up to memory_region_init_ram.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agonuma: introduce memory_region_allocate_system_memory
Paolo Bonzini [Wed, 14 May 2014 09:43:15 +0000 (17:43 +0800)]
numa: introduce memory_region_allocate_system_memory

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: resolve conflicts

10 years agoqmp: improve error reporting for -object and object-add
Paolo Bonzini [Wed, 14 May 2014 09:43:13 +0000 (17:43 +0800)]
qmp: improve error reporting for -object and object-add

Use QERR_INVALID_PARAMETER_VALUE for consistency.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoman: improve -numa doc
Luiz Capitulino [Wed, 14 May 2014 09:43:10 +0000 (17:43 +0800)]
man: improve -numa doc

The -numa option documentation in qemu's manpage lacks the command-line
options and some information regarding how it relates to options -m and
-smp. This commit fills in the missing text.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoNUMA: expand MAX_NODES from 64 to 128
Wanlong Gao [Wed, 14 May 2014 09:43:09 +0000 (17:43 +0800)]
NUMA: expand MAX_NODES from 64 to 128

libnuma choosed 128 for MAX_NODES, so we follow libnuma here.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoNUMA: convert -numa option to use OptsVisitor
Wanlong Gao [Wed, 14 May 2014 09:43:08 +0000 (17:43 +0800)]
NUMA: convert -numa option to use OptsVisitor

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoNUMA: Add numa_info structure to contain numa nodes info
Wanlong Gao [Wed, 14 May 2014 09:43:07 +0000 (17:43 +0800)]
NUMA: Add numa_info structure to contain numa nodes info

Add the numa_info structure to contain the numa nodes memory,
VCPUs information and the future added numa nodes host memory
policies.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
[Fix hw/ppc/spapr.c - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoNUMA: check if the total numa memory size is equal to ram_size
Wanlong Gao [Wed, 14 May 2014 09:43:06 +0000 (17:43 +0800)]
NUMA: check if the total numa memory size is equal to ram_size

If the total number of the assigned numa nodes memory is not
equal to the assigned ram size, it will write the wrong data
to ACPI table, then the guest will ignore the wrong ACPI table
and recognize all memory to one node. It's buggy, we should
check it to ensure that we write the right data to ACPI table.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
MST: error message reworded

10 years agoNUMA: move numa related code to new file numa.c
Wanlong Gao [Wed, 14 May 2014 09:43:05 +0000 (17:43 +0800)]
NUMA: move numa related code to new file numa.c

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
MST: comment tweaks

10 years agotests: disable vhost test temporarily
Michael S. Tsirkin [Wed, 18 Jun 2014 09:23:36 +0000 (12:23 +0300)]
tests: disable vhost test temporarily

This test needs a bit more work: issues have been
found on legacy systems, disable it for now to
avoid false positives for people.
Will re-enable after issues are addressed.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd qtest for vhost-user
Nikolay Nikolaev [Tue, 10 Jun 2014 10:03:23 +0000 (13:03 +0300)]
Add qtest for vhost-user

This test creates a 'server' chardev to listen for vhost-user messages.
Once VHOST_USER_SET_MEM_TABLE is received it mmaps each received region,
and read 1k bytes from it. The read data is compared to data from readl.

The test requires hugetlbfs to be already mounted and writable. The mount
point defaults to '/hugetlbfs' and can be specified via the environment
variable QTEST_HUGETLBFS_PATH.

The rom pc-bios/pxe-virtio.rom is used to instantiate a virtio pcicontroller.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: fix up coding style
MST: disable vhost test temporarily

This test needs a bit more work: issues have been
found on legacy systems, disable it for now to
avoid false positives for people.
Will re-enable after issues are addressed.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agolibqemustub: add stubs to be able to use qemu-char.c
Nikolay Nikolaev [Tue, 27 May 2014 12:07:10 +0000 (15:07 +0300)]
libqemustub: add stubs to be able to use qemu-char.c

chardev depends on lots of external symbols that are not necessarily
needed to be able to use, for example, 'socket chardev'. So add stubs
for these functions:

 - bdrv_commit_all
 - qemu_chr_open_msmouse
 - is_daemonized
 - qemu_add_machine_init_done_notifier
 - monitor_init
 - qemu_notify_event
 - vc_init

and this array:

 - serial_hds

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd vhost-user protocol documentation
Nikolay Nikolaev [Tue, 10 Jun 2014 10:02:57 +0000 (13:02 +0300)]
Add vhost-user protocol documentation

This document describes the basic message format used by vhost-user
for communication over a unix domain socket. The protocol is based
on the existing ioctl interface used for the kernel version of vhost.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd the vhost-user netdev backend to the command line
Nikolay Nikolaev [Tue, 10 Jun 2014 10:02:16 +0000 (13:02 +0300)]
Add the vhost-user netdev backend to the command line

The supplied chardev id will be inspected for supported options. Only
a socket backend, with a set path (i.e. a Unix socket) and optionally
the server parameter set, will be allowed. Other options (nowait, telnet)
will make the chardev unusable and the netdev will not be initialised.

Additional checks for validity:
  - requires `-numa node,memdev=..`
  - requires `-device virtio-net-*`

The `vhostforce` option is used to force vhost-net when we deal with
non-MSIX guests.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
Peter Maydell [Thu, 19 Jun 2014 15:18:04 +0000 (16:18 +0100)]
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging

* remotes/bonzini/scsi-next:
  virtio-scsi: define dummy handle_output for vhost-scsi vqs
  block/iscsi: drop obsolete pointers from iscsi_co_writev
  block/iscsi: fix init value for iTask->retries
  block/iscsi: bump libiscsi requirement to 1.9.0
  virtio-scsi: add support for the any_layout feature
  virtio-scsi: introduce virtio_scsi_complete_cmd_req
  virtio-scsi: prepare sense data handling for any_layout
  virtio-scsi: add extra argument and return type to qemu_sgl_concat
  virtio-scsi: add target swap for VirtIOSCSICtrlTMFReq fields
  virtio-scsi: start preparing for any_layout
  util: add return value to qemu_iovec_concat_iov
  megasas: use PCI DMA API
  scsi: Print command name in debug
  scsi-disk: fix bug in scsi_block_new_request() introduced by commit 137745c
  scsi-disk.c: Fix compilation with -DDEBUG_SCSI
  block/iscsi: use 16 byte CDBs only when necessary
  block/iscsi: fix potential segfault on early callback
  block/iscsi: handle BUSY condition

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoinclude/qemu/aes.h: Avoid conflicts with FreeBSD AES functions
Sean Bruno [Mon, 16 Jun 2014 15:02:07 +0000 (08:02 -0700)]
include/qemu/aes.h: Avoid conflicts with FreeBSD AES functions

FreeBSD's libcrypto provides functions with the same names as us;
use #define to rename our versions to avoid conflicts at link time.

Signed-off-by: Sean Bruno <sbruno@freebsd.org>
Signed-off-by: Ed Maste <emaste@freebsd.org>
Message-id: 1402930927-41125-1-git-send-email-sbruno@freebsd.org
[PMM: improved commit message, fixed comment typo]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agow32: Fix regression caused by new g_poll implementation
Stefan Weil [Wed, 28 May 2014 15:42:24 +0000 (17:42 +0200)]
w32: Fix regression caused by new g_poll implementation

Commit 5a007547df76446ab891df93ebc55749716609bf tried to fix a
performance degradation caused by bad handling of small timeouts
in the original implementation of g_poll.

Since that commit, hard disk I/O no longer works.

Instead of rewriting the g_poll implementation, this patch simply copies
the original code (released under LGPL) from latest glib and only modifies
it where needed (see comments in the code). URL of the original code:
https://git.gnome.org/browse/glib/tree/glib/gpoll.c

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1401291744-14314-1-git-send-email-sw@weilnetz.de
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoAdd new vhost-user netdev backend
Nikolay Nikolaev [Tue, 27 May 2014 12:06:29 +0000 (15:06 +0300)]
Add new vhost-user netdev backend

Add a new QEMU netdev backend that is intended to invoke vhost_net with the
vhost-user backend. It uses an Unix socket chardev to establish a
communication with the 'slave' (client and server mode supported).

At runtime the netdev will handle OPEN/CLOSE events from the chardev. Upon
disconnection it will set link_down accordingly and notify virtio-net; the
virtio-net interface will go down.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost-net: vhost-user feature bits support
Nikolay Nikolaev [Tue, 27 May 2014 12:06:16 +0000 (15:06 +0300)]
vhost-net: vhost-user feature bits support

Handle the feature bits negotiation when using vhost-user. Allow
the underlying implementation to have a finer control over all the
bits except the VIRTIO_NET_F_MAC.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd vhost-user as a vhost backend.
Nikolay Nikolaev [Tue, 27 May 2014 12:06:02 +0000 (15:06 +0300)]
Add vhost-user as a vhost backend.

The initialization takes a chardev backed by a unix domain socket.
It should implement qemu_fe_set_msgfds in order to be able to pass
file descriptors to the remote process.

Each ioctl request of vhost-kernel has a vhost-user message equivalent,
which is sent over the control socket.

The general approach is to copy the data from the supplied argument
pointer to a designated field in the message. If a file descriptor is
to be passed it will be placed in the fds array for inclusion in
the sendmsg control header.

VHOST_SET_MEM_TABLE ignores the supplied vhost_memory structure and scans
the global ram_list for ram blocks with a valid fd field set. This would
be set when the '-object memory-file' option with share=on property is used.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoAdd vhost-backend and VhostBackendType
Nikolay Nikolaev [Tue, 27 May 2014 12:05:49 +0000 (15:05 +0300)]
Add vhost-backend and VhostBackendType

Use vhost_set_backend_type to initialise a proper vhost_ops structure.
In vhost_net_init and vhost_net_start_one call conditionally TAP related
initialisation depending on the vhost backend type.

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>