sdk/emulator/qemu.git
9 years agoprep: do not use CPU_LOG_IOPORT, convert to tracepoints
Paolo Bonzini [Fri, 16 Oct 2015 13:16:11 +0000 (15:16 +0200)]
prep: do not use CPU_LOG_IOPORT, convert to tracepoints

These messages are disabled by default; a perfect usecase for tracepoints.
Convert them over.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoopenpic: add to misc category
Laurent Vivier [Sat, 26 Sep 2015 16:22:12 +0000 (18:22 +0200)]
openpic: add to misc category

openpic is a programmable interrupt controller, so
add it to the misc category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agomacio-nvram: add to misc category
Laurent Vivier [Sat, 26 Sep 2015 16:22:11 +0000 (18:22 +0200)]
macio-nvram: add to misc category

The macio nvram is a non volatile RAM, so add it
the misc category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agomacio: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:10 +0000 (18:22 +0200)]
macio: add to bridge category

macio is a bridge between the PCI bus and the Mac nvram,
IDE controller and PIC, so add it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agouninorth: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:09 +0000 (18:22 +0200)]
uninorth: add to bridge category

Uninorth is the mac99 PCI host controller, so add
it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agomacio-ide: add to storage category
Laurent Vivier [Sat, 26 Sep 2015 16:22:08 +0000 (18:22 +0200)]
macio-ide: add to storage category

macio-ide is an IDE controller, so add it
to the storage category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agocuda: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:07 +0000 (18:22 +0200)]
cuda: add to bridge category

Cuda is a bridge between PowerMac system bus and the ADB controller,
real-time clock, pram and the power management unit.

So add it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agograckle: add to bridge category
Laurent Vivier [Sat, 26 Sep 2015 16:22:06 +0000 (18:22 +0200)]
grackle: add to bridge category

Grackle is the PCI host controller of oldworld powermac,
so add it to the bridge category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoescc: add to input category
Laurent Vivier [Sat, 26 Sep 2015 16:22:05 +0000 (18:22 +0200)]
escc: add to input category

ESCC is a serial port controller, so add it
to the input category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agocmd646: add to storage category
Laurent Vivier [Sat, 26 Sep 2015 16:22:04 +0000 (18:22 +0200)]
cmd646: add to storage category

cmd646 is an IDE controller, so add it to the
storage category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoadb: add to input category
Laurent Vivier [Sat, 26 Sep 2015 16:22:03 +0000 (18:22 +0200)]
adb: add to input category

The Apple Desktop Bus is used to connect a keyboard and a mouse,
so add it to the input category.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoppc/spapr: Add "ibm,pa-features" property to the device-tree
Benjamin Herrenschmidt [Thu, 22 Oct 2015 07:30:59 +0000 (18:30 +1100)]
ppc/spapr: Add "ibm,pa-features" property to the device-tree

LoPAPR defines a "ibm,pa-features" per-CPU device tree property which
describes extended features of the Processor Architecture.

This adds the property to the device tree. At the moment this is the
copy of what pHyp advertises except "I=1 (cache inhibited) Large Pages"
which is enabled for TCG and disabled when running under HV KVM host
with 4K system page size.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[aik: rebased, changed commit log, moved ci_large_pages initialization,
renamed pa_features arrays]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoppc: Add mmu_model defines for arch 2.03 and 2.07
Benjamin Herrenschmidt [Thu, 22 Oct 2015 07:30:58 +0000 (18:30 +1100)]
ppc: Add mmu_model defines for arch 2.03 and 2.07

This removes unused POWERPC_MMU_2_06a/POWERPC_MMU_2_06d.

This replaces POWERPC_MMU_64B with POWERPC_MMU_2_03 for POWER5+ to be
more explicit about the version of the PowerISA supported.

This defines POWERPC_MMU_2_07 and uses it for the POWER8 CPU family.
This will not have an immediate effect now but it will in the following
patch.

This should cause no behavioural change.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[aik: rebased, changed commit log]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agohw/scsi/spapr_vscsi: Remove superfluous memset
Thomas Huth [Thu, 8 Oct 2015 19:35:13 +0000 (21:35 +0200)]
hw/scsi/spapr_vscsi: Remove superfluous memset

g_malloc0 already clears the memory, so no need for
the additional memset here.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agospapr_pci: Allow VFIO devices to work on the normal PCI host bridge
David Gibson [Thu, 24 Sep 2015 00:34:23 +0000 (10:34 +1000)]
spapr_pci: Allow VFIO devices to work on the normal PCI host bridge

The core VFIO infrastructure more or less allows VFIO devices to work
on any normal guest PCI host bridge (PHB) without extra logic.
However, the "spapr-pci-host-bridge" device (as opposed to the special
"spapr-pci-vfio-host-bridge" device) breaks this by using a partially
KVM accelerated implementation of the guest kernel IOMMU which won't
work with VFIO devices, without additional kernel support.

This patch allows VFIO devices to work on the spapr-pci-host-bridge,
by having it switch off KVM TCE acceleration when a VFIO device is
added to the PHB (either on startup, or by hotplug).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
9 years agospapr_iommu: Provide a function to switch a TCE table to allowing VFIO
David Gibson [Thu, 1 Oct 2015 00:46:10 +0000 (10:46 +1000)]
spapr_iommu: Provide a function to switch a TCE table to allowing VFIO

Because of the way non-VFIO guest IOMMU operations are KVM accelerated, not
all TCE tables (guest IOMMU contexts) can support VFIO devices.  Currently,
this is decided at creation time.

To support hotplug of VFIO devices, we need to allow a TCE table which
previously didn't allow VFIO devices to be switched so that it can.  This
patch adds an spapr_tce_set_need_vfio() function to do this, by
reallocating the table in userspace if necessary.

Currently this doesn't allow the KVM acceleration to be re-enabled if all
the VFIO devices are removed.  That's an optimization for another time.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
9 years agospapr_iommu: Rename vfio_accel parameter
David Gibson [Wed, 30 Sep 2015 03:42:55 +0000 (13:42 +1000)]
spapr_iommu: Rename vfio_accel parameter

The vfio_accel parameter used when creating a new TCE table (guest IOMMU
context) has a confusing name.  What it really means is whether we need the
TCE table created to be able to support VFIO devices.

VFIO is relevant, because when available we use in-kernel acceleration of
the TCE table, but that may not work with VFIO devices because updates to
the table are handled in kernel, bypass qemu and so don't hit qemu's
infrastructure for keeping the VFIO host IOMMU state in sync with the guest
IOMMU state.

Rename the parameter to "need_vfio" throughout.  This is a cosmetic change,
with no impact on the logic.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
9 years agospapr_pci: Allow PCI host bridge DMA window to be configured
David Gibson [Wed, 23 Sep 2015 23:56:44 +0000 (09:56 +1000)]
spapr_pci: Allow PCI host bridge DMA window to be configured

At present the PCI host bridge (PHB) for the pseries machine type has a
fixed DMA window from 0..1GB (in PCI address space) which is mapped to real
memory via the PAPR paravirtualized IOMMU.

For better support of VFIO devices, we're going to want to allow for
different configurations of the DMA window.

Eventually we'll want to allow the guest itself to reconfigure the window
via the PAPR dynamic DMA window interface, but as a preliminary this patch
allows the user to reconfigure the window with new properties on the PHB
device.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
9 years agospapr: Add "slb-size" property to CPU device tree nodes
Thomas Huth [Thu, 1 Oct 2015 13:30:07 +0000 (15:30 +0200)]
spapr: Add "slb-size" property to CPU device tree nodes

According to a commit message in the Linux kernel (see here
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b60c31d85a2a
for example), the name of the property that carries the information
about the number of SLB entries should be called "slb-size", and
not "ibm,slb-size". The Linux kernel can deal with both names, but
to be on the safe side we should support the official name, too.

[Now that LoPAPR is public, the relevant requirement can be found in
section C.6.1.8 --dwg]

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agospapr: Abort when HTAB of requested size isn't allocated
Bharata B Rao [Thu, 24 Sep 2015 08:22:48 +0000 (13:52 +0530)]
spapr: Abort when HTAB of requested size isn't allocated

Terminate the guest when HTAB of requested size isn't allocated by
the host.

When memory hotplug is attempted on a guest that has booted with
less than requested HTAB size, the guest kernel will not be able
to gracefully fail the hotplug request. This patch will ensure that
we never end up in a situation where memory hotplug fails due to
less than requested HTAB size.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agospapr: Allocate HTAB from machine init
Bharata B Rao [Thu, 24 Sep 2015 08:22:47 +0000 (13:52 +0530)]
spapr: Allocate HTAB from machine init

Allocate HTAB from ppc_spapr_init() so that we can abort the guest
if requested HTAB size is't allocated by the host. However retain the
htab reset call in spapr_reset_htab() so that HTAB gets reset (and
not allocated) during machine reset.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20151021' into staging
Peter Maydell [Thu, 22 Oct 2015 17:01:53 +0000 (18:01 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20151021' into staging

Collected tcg backend patches

# gpg: Signature made Wed 21 Oct 2015 22:34:28 BST using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/pull-tcg-20151021:
  cpu-exec: Add "nochain" debug flag
  tcg/mips: Support r6 SEL{NE, EQ}Z instead of MOVN/MOVZ
  tcg/mips: Support r6 multiply/divide encodings
  tcg/mips: Support r6 JR encoding
  tcg/mips: Add use_mips32r6_instructions definition
  disas/mips: Add R6 jr/jr.hb to disassembler
  tcg-opc.h: Simplify insn_start def
  tcg/ppc: Prefer mask over andi.
  tcg/ppc: Revise goto_tb implementation
  tcg/ppc: Adjust exit_tb for change in prologue placement

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-peter' into staging
Peter Maydell [Thu, 22 Oct 2015 16:33:54 +0000 (17:33 +0100)]
Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-peter' into staging

QOM CPUState and X86CPU

* Adoption of CPUClass::disas_set_info() hook

# gpg: Signature made Thu 22 Oct 2015 17:11:24 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-cpu-for-peter:
  disas: QOMify alpha specific disas setup
  disas: QOMify mips specific disas setup
  disas: QOMify sh4 specific disas setup
  disas: QOMify lm32 specific disas setup
  disas: QOMify sparc specific disas setup
  disas: QOMify m68k specific disas setup
  disas: QOMify moxie specific disas setup
  disas: QOMify s390x specific disas setup

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agodisas: QOMify alpha specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 02:00:05 +0000 (19:00 -0700)]
disas: QOMify alpha specific disas setup

Move the target_disas() alpha specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

This also makes monitor_disas() consistent with target_disas(), as
monitor_disas() was missing a set of the BFD (This was an omission from
commit b9bec751c8c8b08d8055da32306eb105db03031b).

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify mips specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 02:00:04 +0000 (19:00 -0700)]
disas: QOMify mips specific disas setup

Move the target_disas() mips specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Acked-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify sh4 specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 02:00:03 +0000 (19:00 -0700)]
disas: QOMify sh4 specific disas setup

Move the target_disas() sh4 specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify lm32 specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 02:00:02 +0000 (19:00 -0700)]
disas: QOMify lm32 specific disas setup

Move the target_disas() lm32 specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify sparc specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 02:00:01 +0000 (19:00 -0700)]
disas: QOMify sparc specific disas setup

Move the target_disas() sparc specifics to the QOM disas_set_info hook
and delete the #ifdef specific code in disas.c.

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify m68k specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 02:00:00 +0000 (19:00 -0700)]
disas: QOMify m68k specific disas setup

Move the target_disas() m68k specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify moxie specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 01:59:59 +0000 (18:59 -0700)]
disas: QOMify moxie specific disas setup

Move the target_disas() moxie specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Cc: Anthony Green <green@moxielogic.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agodisas: QOMify s390x specific disas setup
Peter Crosthwaite [Sun, 12 Jul 2015 01:59:58 +0000 (18:59 -0700)]
disas: QOMify s390x specific disas setup

Move the target_disas() s390 specifics to the CPUClass::disas_set_info()
hook and delete the #ifdef specific code in disas.c.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Thu, 22 Oct 2015 11:41:44 +0000 (12:41 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

vhost, pc, virtio features, fixes, cleanups

New features:
    VT-d support for devices behind a bridge
    vhost-user migration support

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Thu 22 Oct 2015 12:39:19 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (37 commits)
  hw/isa/lpc_ich9: inject the SMI on the VCPU that is writing to APM_CNT
  i386: keep cpu_model field in MachineState uptodate
  vhost: set the correct queue index in case of migration with multiqueue
  piix: fix resource leak reported by Coverity
  seccomp: add memfd_create to whitelist
  vhost-user-test: check ownership during migration
  vhost-user-test: add live-migration test
  vhost-user-test: learn to tweak various qemu arguments
  vhost-user-test: wrap server in TestServer struct
  vhost-user-test: remove useless static check
  vhost-user-test: move wait_for_fds() out
  vhost: add migration block if memfd failed
  vhost-user: use an enum helper for features mask
  vhost user: add rarp sending after live migration for legacy guest
  vhost user: add support of live migration
  net: add trace_vhost_user_event
  vhost-user: document migration log
  vhost: use a function for each call
  vhost-user: add a migration blocker
  vhost-user: send log shm fd along with log_base
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/isa/lpc_ich9: inject the SMI on the VCPU that is writing to APM_CNT
Laszlo Ersek [Tue, 20 Oct 2015 18:14:00 +0000 (20:14 +0200)]
hw/isa/lpc_ich9: inject the SMI on the VCPU that is writing to APM_CNT

Commit 4d00636e97b7 ("ich9: Add the lpc chip", Nov 14 2012) added the
ich9_apm_ctrl_changed() ioport write callback function such that it would
inject the SMI, in response to a write to the APM_CNT register, on the
first CPU, invariably.

Since this register is used by guest code to trigger an SMI synchronously,
the interrupt should be injected on the VCPU that is performing the write.

apm_ioport_writeb() is the .write callback of the "apm_ops"
MemoryRegionOps [hw/isa/apm.c]; it is parametrized to call
ich9_apm_ctrl_changed() by ich9_lpc_init() [hw/isa/lpc_ich9.c], via
apm_init(). Therefore this change affects no other board.

ich9_generate_smi() is an unrelated function that is called by the TCO
watchdog; a watchdog is likely in its right to (asynchronously) inject
interrupts on the first CPU only.

This patch allows the combined edk2/OVMF SMM driver stack to work with
multiple VCPUs on TCG, using both qemu-system-i386 and qemu-system-x86_64.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoi386: keep cpu_model field in MachineState uptodate
Zhu Guihua [Thu, 15 Oct 2015 03:12:12 +0000 (11:12 +0800)]
i386: keep cpu_model field in MachineState uptodate

Update cpu_model in MachineState for i386, so that the field can be used
for cpu hotplug, instead of using a static variable.

This patch is rebased on the latest master.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
9 years agovhost: set the correct queue index in case of migration with multiqueue
Thibaut Collet [Mon, 19 Oct 2015 12:59:27 +0000 (14:59 +0200)]
vhost: set the correct queue index in case of migration with multiqueue

When a live migration is started the log address to mark dirty pages is provided
to the vhost backend through the vhost_dev_set_log function.
This function is called for each queue pairs but the queue index is wrongly set:
always set to the first queue pair. Then vhost backend lost descriptor addresses
of the queue pairs greater than 1 and behaviour of the vhost backend is
unpredictable.

The queue index is computed by taking account of the vq_index (to retrieve the
queue pair index) and calling the vhost_get_vq_index method of the backend.

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Cc: qemu-stable@nongnu.org
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopiix: fix resource leak reported by Coverity
zhanghailiang [Mon, 14 Sep 2015 10:40:10 +0000 (18:40 +0800)]
piix: fix resource leak reported by Coverity

config_fd should be closed before return, or there will
be a resource leak error.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoseccomp: add memfd_create to whitelist
Eduardo Otubo [Fri, 9 Oct 2015 15:17:41 +0000 (17:17 +0200)]
seccomp: add memfd_create to whitelist

This is used by memfd code.

Signed-off-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user-test: check ownership during migration
Marc-André Lureau [Fri, 9 Oct 2015 15:17:40 +0000 (17:17 +0200)]
vhost-user-test: check ownership during migration

Check that backend source and destination do not have simultaneous
ownership during migration.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user-test: add live-migration test
Marc-André Lureau [Fri, 9 Oct 2015 15:17:39 +0000 (17:17 +0200)]
vhost-user-test: add live-migration test

This test checks that the log fd is given to the migration source, and
mark dirty pages during migration.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user-test: learn to tweak various qemu arguments
Marc-André Lureau [Fri, 9 Oct 2015 15:17:38 +0000 (17:17 +0200)]
vhost-user-test: learn to tweak various qemu arguments

Add a new macro to make the qemu command line with other
values of memory size, and specific chardev id.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user-test: wrap server in TestServer struct
Marc-André Lureau [Fri, 9 Oct 2015 15:17:37 +0000 (17:17 +0200)]
vhost-user-test: wrap server in TestServer struct

In the coming patches, a test will use several servers
simultaneously. Wrap the server in a struct, out of the global scope.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user-test: remove useless static check
Marc-André Lureau [Fri, 9 Oct 2015 15:17:36 +0000 (17:17 +0200)]
vhost-user-test: remove useless static check

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user-test: move wait_for_fds() out
Marc-André Lureau [Fri, 9 Oct 2015 15:17:35 +0000 (17:17 +0200)]
vhost-user-test: move wait_for_fds() out

This function is a precondition for most vhost-user tests.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost: add migration block if memfd failed
Marc-André Lureau [Fri, 9 Oct 2015 15:17:34 +0000 (17:17 +0200)]
vhost: add migration block if memfd failed

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user: use an enum helper for features mask
Thibaut Collet [Fri, 9 Oct 2015 15:17:33 +0000 (17:17 +0200)]
vhost-user: use an enum helper for features mask

The VHOST_USER_PROTOCOL_FEATURE_MASK will be automatically updated when
adding new features to the enum.

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
[Adapted from mailing list discussion - Marc-André]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost user: add rarp sending after live migration for legacy guest
Thibaut Collet [Fri, 9 Oct 2015 15:17:32 +0000 (17:17 +0200)]
vhost user: add rarp sending after live migration for legacy guest

A new vhost user message is added to allow QEMU to ask to vhost user backend to
broadcast a fake RARP after live migration for guest without GUEST_ANNOUNCE
capability.

This new message is sent only if the backend supports the new
VHOST_USER_PROTOCOL_F_RARP protocol feature.
The payload of this new message is the MAC address of the guest (not known by
the backend). The MAC address is copied in the first 6 bytes of a u64 to avoid
to create a new payload message type.

This new message has no equivalent ioctl so a new callback is added in the
userOps structure to send the request.

Upon reception of this new message the vhost user backend must generate and
broadcast a fake RARP request to notify the migration is terminated.

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
[Rebased and fixed checkpatch errors - Marc-André]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost user: add support of live migration
Thibaut Collet [Fri, 9 Oct 2015 15:17:31 +0000 (17:17 +0200)]
vhost user: add support of live migration

Some vhost user backends are able to support live migration.
To provide this service the following features must be added:
1. Add the VIRTIO_NET_F_GUEST_ANNOUNCE capability to vhost-net when netdev
   backend is vhost-user.
2. Provide a nop receive callback to vhost-user.
   This callback is called by:
    *  qemu_announce_self after a migration to send fake RARP to avoid network
       outage for peers talking to the migrated guest.
         - For guest with GUEST_ANNOUNCE capabilities, guest already sends GARP
           when the bit VIRTIO_NET_S_ANNOUNCE is set.
           => These packets must be discarded.
         - For guest without GUEST_ANNOUNCE capabilities, migration termination
           is notified when the guest sends packets.
           => These packets can be discarded.
    * virtio_net_tx_bh with a dummy boot to send fake bootp/dhcp request.
      BIOS guest manages virtio driver to send 4 bootp/dhcp request in case of
      dummy boot.
      => These packets must be discarded.

Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agonet: add trace_vhost_user_event
Marc-André Lureau [Fri, 9 Oct 2015 15:17:30 +0000 (17:17 +0200)]
net: add trace_vhost_user_event

Replace error_report() and use tracing instead. It's not an error to get
a connection or a disconnection, so silence this and trace it instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user: document migration log
Marc-André Lureau [Fri, 9 Oct 2015 15:17:29 +0000 (17:17 +0200)]
vhost-user: document migration log

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost: use a function for each call
Marc-André Lureau [Fri, 9 Oct 2015 15:17:28 +0000 (17:17 +0200)]
vhost: use a function for each call

Replace the generic vhost_call() by specific functions for each
function call to help with type safety and changing arguments.

While doing this, I found that "unsigned long long" and "uint64_t" were
used interchangeably and causing compilation warnings, using uint64_t
instead, as the vhost & protocol specifies.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Fix enum usage and MQ - Thibaut Collet]
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user: add a migration blocker
Marc-André Lureau [Fri, 9 Oct 2015 15:17:27 +0000 (17:17 +0200)]
vhost-user: add a migration blocker

If VHOST_USER_PROTOCOL_F_LOG_SHMFD is not announced, block vhost-user
migration. The blocker is removed in vhost_dev_cleanup().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user: send log shm fd along with log_base
Marc-André Lureau [Fri, 9 Oct 2015 15:17:26 +0000 (17:17 +0200)]
vhost-user: send log shm fd along with log_base

Send the shm for the dirty pages logging if the backend supports
VHOST_USER_PROTOCOL_F_LOG_SHMFD. Wait for a reply to make sure
the old log is no longer used.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost: alloc shareable log
Marc-André Lureau [Fri, 9 Oct 2015 15:17:25 +0000 (17:17 +0200)]
vhost: alloc shareable log

If the backend is requires it, allocate shareable memory.

vhost_log_get() now uses 2 globals "vhost_log" and "vhost_log_shm", that
way there is a common non-shareable log and a common shareable one.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost-user: add vhost_user_requires_shm_log()
Marc-André Lureau [Fri, 9 Oct 2015 15:17:24 +0000 (17:17 +0200)]
vhost-user: add vhost_user_requires_shm_log()

Check if the backend has VHOST_USER_PROTOCOL_F_LOG_SHMFD feature and
require a shared log.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost: add vhost_set_log_base op
Marc-André Lureau [Fri, 9 Oct 2015 15:17:23 +0000 (17:17 +0200)]
vhost: add vhost_set_log_base op

Split VHOST_SET_LOG_BASE call in a seperate function callback, so that
type safety works and more arguments can be added in the next patches.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovhost: document log resizing
Marc-André Lureau [Fri, 9 Oct 2015 15:17:22 +0000 (17:17 +0200)]
vhost: document log resizing

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agoutil: add fallback for qemu_memfd_alloc()
Marc-André Lureau [Fri, 9 Oct 2015 15:17:21 +0000 (17:17 +0200)]
util: add fallback for qemu_memfd_alloc()

Add an open/unlink/mmap fallback for system that do not support
memfd (only available since 3.17, ~1y ago).

This patch may require additional SELinux policies to work for enforced
systems, but should fail gracefully in this case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agoutil: add memfd helpers
Marc-André Lureau [Fri, 9 Oct 2015 15:17:20 +0000 (17:17 +0200)]
util: add memfd helpers

Add qemu_memfd_alloc/free() helpers.

The function helps to allocate and seal shared memory.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agoutil: add linux-only memfd fallback
Marc-André Lureau [Fri, 9 Oct 2015 15:17:19 +0000 (17:17 +0200)]
util: add linux-only memfd fallback

Implement memfd_create() fallback if not available in system libc.
memfd_create() is still not included in glibc today, atlhough it's been
available since Linux 3.17 in Oct 2014.

memfd has numerous advantages over traditional shm/mmap for ipc memory
sharing with fd handler, which we are going to make use of for
vhost-user logging memory in following patches.

The next patches are going to introduce helpers to use best practices of
memfd usage and provide some compatibility fallback. memfd.c is thus
temporarily useless and eventually empty if memfd_create() is provided
by the system.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agobuild-sys: split util-obj- on multi-lines
Marc-André Lureau [Fri, 9 Oct 2015 15:17:18 +0000 (17:17 +0200)]
build-sys: split util-obj- on multi-lines

Make it easier to add new unrelated units with shorter lines.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agolinux-headers: add unistd.h
Marc-André Lureau [Fri, 9 Oct 2015 15:17:17 +0000 (17:17 +0200)]
linux-headers: add unistd.h

New syscalls are not yet widely distributed. Add them to qemu
linux-headers include directory. Update based on v4.3-rc3 kernel headers.

Exclude mips for now, which is more problematic due to extra header
inclusion and probably unnecessary here.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agoconfigure: probe for memfd
Marc-André Lureau [Fri, 9 Oct 2015 15:17:16 +0000 (17:17 +0200)]
configure: probe for memfd

Check if memfd_create() is part of system libc.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agovirtio: add some migration doc
Cornelia Huck [Thu, 17 Sep 2015 16:42:57 +0000 (18:42 +0200)]
virtio: add some migration doc

Try to cover the basics of virtio migration.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
9 years agovhost: fail backend intialization early
Igor Mammedov [Tue, 6 Oct 2015 08:37:29 +0000 (10:37 +0200)]
vhost: fail backend intialization early

Don't initialize vhost backend if memslots number exceeds the supported
limit. This prevents failures down the road when backend
is actually started.

[MST: rewrite commit log]

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>
9 years agopc-dimm: add vhost slots limit check before commiting to hotplug
Igor Mammedov [Tue, 6 Oct 2015 08:37:28 +0000 (10:37 +0200)]
pc-dimm: add vhost slots limit check before commiting to hotplug

it allows safely cancel memory hotplug if vhost backend
doesn't support necessary amount of memory slots and prevents
QEMU crashing in vhost due to hitting vhost limit on amount
of supported memory ranges.

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>
9 years agovhost: add vhost_has_free_slot() interface
Igor Mammedov [Tue, 6 Oct 2015 08:37:27 +0000 (10:37 +0200)]
vhost: add vhost_has_free_slot() interface

it will allow for other parts of QEMU check if it's safe
to map memory region during hotplug/runtime.
That way hotplug path will have a chance to cancel
hotplug operation instead of crashing in vhost_commit().

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>
9 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20151021-xtensa' into staging
Peter Maydell [Wed, 21 Oct 2015 20:21:29 +0000 (21:21 +0100)]
Merge remote-tracking branch 'remotes/xtensa/tags/20151021-xtensa' into staging

Xtensa updates:

- fix register window overflow with l32e/s32e instructions;
- make MMU events logging dependent on CPU_LOG_MMU;
- attach FLASH to system I/O region on XTFPGA boards;
- implement depbits and l32nb instructions.

# gpg: Signature made Wed 21 Oct 2015 19:34:02 BST using RSA key ID F83FA044
# gpg: Good signature from "Max Filippov <max.filippov@cogentembedded.com>"
# gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>"

* remotes/xtensa/tags/20151021-xtensa:
  target-xtensa: implement S32NB
  target-xtensa: implement depbits instruction
  target-xtensa: xtfpga: attach FLASH to system IO
  target-xtensa: use CPU_LOG_MMU for MMU event logging
  target-xtensa: add window overflow check to L32E/S32E

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-xtensa: implement S32NB
Max Filippov [Sun, 19 Jul 2015 06:49:00 +0000 (09:49 +0300)]
target-xtensa: implement S32NB

S32NB provides the same functionality as S32I with two exceptions.
First, when its operation leaves the processor, the external transaction
is marked Non-Bufferable. Second, it may not be used to write to
Instruction RAM.
In QEMU S32NB is equivalent to S32I.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
9 years agotarget-xtensa: implement depbits instruction
Max Filippov [Sat, 11 Jul 2015 23:10:17 +0000 (02:10 +0300)]
target-xtensa: implement depbits instruction

This option provides an instruction for depositing a bit field from the
least significant position of one register to an arbitrary position in
another register.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
9 years agotarget-xtensa: xtfpga: attach FLASH to system IO
Max Filippov [Sun, 27 Sep 2015 15:21:19 +0000 (18:21 +0300)]
target-xtensa: xtfpga: attach FLASH to system IO

XTFPGA FLASH is tied to XTFPGA system IO block. It's not very important
for systems with MMU where system IO block is visible at single
location, but it's important for noMMU systems, where system IO block is
accessible through two separate physical address ranges.

Map XTFPGA FLASH to system IO block and fix offsets used for mapping.
Create and initialize FLASH device with series of qdev_prop_set_* as
that's the preferred interface now. Keep initialization in a separate
function.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
9 years agotarget-xtensa: use CPU_LOG_MMU for MMU event logging
Max Filippov [Mon, 21 Sep 2015 17:37:07 +0000 (20:37 +0300)]
target-xtensa: use CPU_LOG_MMU for MMU event logging

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
9 years agotarget-xtensa: add window overflow check to L32E/S32E
Max Filippov [Sun, 19 Jul 2015 07:02:37 +0000 (10:02 +0300)]
target-xtensa: add window overflow check to L32E/S32E

Despite L32E and S32E primary use is for window underflow and overflow
exception handlers they are just normal instructions, and thus need to
check for window overflow.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
9 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20151021-v2' into staging
Peter Maydell [Wed, 21 Oct 2015 14:07:42 +0000 (15:07 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20151021-v2' into staging

More s390x patches. The first ones are fixes: A regression, missed
compat and a missed part of the SIMD support. The others contain
optimizations and cleanup.

# gpg: Signature made Wed 21 Oct 2015 11:24:48 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20151021-v2:
  s390x/cmma: clean up cmma reset
  s390x: reset crypto only on clear reset and QEMU reset
  s390x: machine reset function with new ipl cpu handling
  s390x/ipl: we always have an ipl device
  s390x: unify device reset during subsystem_reset()
  s390x: flagify mcic values
  s390x/kvm: Fix vector validity bit in device machine checks
  s390x/virtio-ccw: fix 2.4 virtio compat
  util/qemu-config: fix missing machine command line options

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agos390x/cmma: clean up cmma reset
David Hildenbrand [Tue, 21 Jul 2015 09:11:11 +0000 (11:11 +0200)]
s390x/cmma: clean up cmma reset

The cmma reset is per VM, so we don't need a cpu object. We can
directly make use of kvm_state, as it is already available when
the reset is called. By moving the cmma reset in our machine reset
function, we can avoid a manual reset handler.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x: reset crypto only on clear reset and QEMU reset
David Hildenbrand [Wed, 30 Sep 2015 11:48:45 +0000 (13:48 +0200)]
s390x: reset crypto only on clear reset and QEMU reset

Initializing VM crypto in initial cpu reset has multiple problems

1. We call the exact same function #VCPU times, although one time is enough
2. On SIGP initial cpu reset, we exchange the wrapping key while
   other VCPUs are running. Bad!
3. It is simply wrong. According to the Pop, a reset happens only during a
   clear reset.

So, we have to reset the keys
- on modified clear reset
- on load clear (QEMU reset - via machine reset)
- on qemu start (via machine reset)

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x: machine reset function with new ipl cpu handling
David Hildenbrand [Tue, 21 Jul 2015 11:47:32 +0000 (13:47 +0200)]
s390x: machine reset function with new ipl cpu handling

Current implementation depends on the order of resets getting triggered.

If a cpu reset is triggered after the ipl device reset, the CPU is stopped and
the VM will not run. In fact, that hinders us from converting the ipl device
into a TYPE_DEVICE. Let's change that by manually configuring the ipl cpu
during a system reset, so we have full control and can demangle that code.

Also remove the superflous cpu parameter from s390_update_iplstate on the way.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/ipl: we always have an ipl device
David Hildenbrand [Thu, 25 Jun 2015 07:55:55 +0000 (09:55 +0200)]
s390x/ipl: we always have an ipl device

Both s390 machines unconditionally create an ipl device, so no need to
handle the missing case.

Now we can also change s390_ipl_update_diag308() to return void.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x: unify device reset during subsystem_reset()
David Hildenbrand [Tue, 21 Jul 2015 08:58:38 +0000 (10:58 +0200)]
s390x: unify device reset during subsystem_reset()

We have to manually reset several devices that are not on a bus: Let's
collect them in an array.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agonet: don't set native endianness
Michael S. Tsirkin [Wed, 14 Oct 2015 09:11:27 +0000 (12:11 +0300)]
net: don't set native endianness

commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991
    vhost-net: tell tap backend about the vnet endianness
makes vhost net always try to set LE - even if that matches the
native endian-ness.

This makes it fail on older kernels on x86 without TUNSETVNETLE support.

To fix, make qemu_set_vnet_le/qemu_set_vnet_be skip the
ioctl if it matches the host endian-ness.

Reported-by: Marcel Apfelbaum <marcel@redhat.com>
Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
9 years agoexec: factor out duplicate mmap code
Michael S. Tsirkin [Thu, 24 Sep 2015 11:41:17 +0000 (14:41 +0300)]
exec: factor out duplicate mmap code

Anonymous and file-backed RAM allocation are now almost exactly the same.

Reduce code duplication by moving RAM mmap code out of oslib-posix.c and
exec.c.

Reported-by: Marc-André Lureau <mlureau@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Thibaut Collet <thibaut.collet@6wind.com>
9 years agoMerge remote-tracking branch 'remotes/berrange/tags/io-channel-3-for-upstream' into...
Peter Maydell [Tue, 20 Oct 2015 15:51:43 +0000 (16:51 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/io-channel-3-for-upstream' into staging

Merge io-channels-3 partial branch

# gpg: Signature made Tue 20 Oct 2015 16:36:10 BST using RSA key ID 15104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"

* remotes/berrange/tags/io-channel-3-for-upstream:
  util: pull Buffer code out of VNC module
  coroutine: move into libqemuutil.a library
  osdep: add qemu_fork() wrapper for safely handling signals
  ui: convert VNC startup code to use SocketAddress
  sockets: allow port to be NULL when listening on IP address
  sockets: move qapi_copy_SocketAddress into qemu-sockets.c
  sockets: add helpers for creating SocketAddress from a socket

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agos390x: flagify mcic values
Cornelia Huck [Thu, 8 Oct 2015 13:05:46 +0000 (15:05 +0200)]
s390x: flagify mcic values

Instead of using magic values when building the machine check
interruption code, add some defines as by chapter 11-14 in the PoP.

This should make it easier to catch problems like the missing vector
register validity bit ("s390x/kvm: Fix vector validity bit in device
machine checks"), and less hassle should we want to generate machine
checks beyond the channel reports we currently support.

Acked-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: Fix vector validity bit in device machine checks
Christian Borntraeger [Wed, 7 Oct 2015 08:29:42 +0000 (10:29 +0200)]
s390x/kvm: Fix vector validity bit in device machine checks

Device hotplugs trigger a crw machine check. All machine checks
have validity bits for certain register types. With vector support
we also have to claim that vector registers are valid.
This is a band-aid suitable for stable. Long term we should
create the full  mcic value dynamically depending on the active
features in the kernel interrupt handler.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/virtio-ccw: fix 2.4 virtio compat
Cornelia Huck [Thu, 8 Oct 2015 13:11:34 +0000 (15:11 +0200)]
s390x/virtio-ccw: fix 2.4 virtio compat

Commit 542571d5 ("virtio-ccw: enable virtio-1") missed some virtio
devices for the 2.4 compat handling. Add them.

Fixes: 542571d5 ("virtio-ccw: enable virtio-1")
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
9 years agoutil/qemu-config: fix missing machine command line options
Tony Krowiak [Mon, 12 Oct 2015 15:36:21 +0000 (11:36 -0400)]
util/qemu-config: fix missing machine command line options

Commit 0a7cf217 ("util/qemu-config: fix regression of
qmp_query_command_line_options") aimed to restore parsing of global
machine options, but missed two: "aes-key-wrap" and
"dea-key-wrap" (which were present in the initial version of that
patch). Let's add them to the machine_opts again.

Fixes: 0a7cf217 ("util/qemu-config: fix regression of
                  qmp_query_command_line_options")
CC: Marcel Apfelbaum <marcel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1444664181-28023-1-git-send-email-akrowiak@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agoutil: pull Buffer code out of VNC module
Daniel P. Berrange [Tue, 3 Mar 2015 17:13:42 +0000 (17:13 +0000)]
util: pull Buffer code out of VNC module

The Buffer code in the VNC server is useful for the IO channel
code, so pull it out into a shared module, QIOBuffer.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agocoroutine: move into libqemuutil.a library
Daniel P. Berrange [Tue, 1 Sep 2015 13:48:02 +0000 (14:48 +0100)]
coroutine: move into libqemuutil.a library

The coroutine files are currently referenced by the block-obj-y
variable. The coroutine functionality though is already used by
more than just the block code. eg migration code uses coroutine
yield. In the future the I/O channel code will also use the
coroutine yield functionality. Since the coroutine code is nicely
self-contained it can be easily built as part of the libqemuutil.a
library, making it widely available.

The headers are also moved into include/qemu, instead of the
include/block directory, since they are now part of the util
codebase, and the impl was never in the block/ directory
either.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoosdep: add qemu_fork() wrapper for safely handling signals
Daniel P. Berrange [Fri, 28 Aug 2015 13:40:01 +0000 (14:40 +0100)]
osdep: add qemu_fork() wrapper for safely handling signals

When using regular fork() the child process of course inherits
all the parents' signal handlers. If the child then proceeds
to close() any open file descriptors, it may break some of those
registered signal handlers. The child generally does not want to
ever run any of the signal handlers that the parent may have
installed in the short time before it exec's. The parent may also
have blocked various signals which the child process will want
enabled.

This introduces a wrapper qemu_fork() that takes care to sanitize
signal handling across fork. Before forking it blocks all signals
in the parent thread. After fork returns, the parent unblocks the
signals and carries on as usual. The child, however, resets all the
signal handlers back to their defaults before it unblocks signals.
The child process can now exec the binary in a "clean" signal
environment.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoui: convert VNC startup code to use SocketAddress
Daniel P. Berrange [Fri, 14 Aug 2015 17:56:44 +0000 (18:56 +0100)]
ui: convert VNC startup code to use SocketAddress

The VNC code is currently using QemuOpts to configure the
sockets connections / listeners it needs. Convert it to
use SocketAddress to bring it in line with modern QAPI
based code elsewhere in QEMU.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agosockets: allow port to be NULL when listening on IP address
Daniel P. Berrange [Tue, 1 Sep 2015 13:46:50 +0000 (14:46 +0100)]
sockets: allow port to be NULL when listening on IP address

If the port in the SocketAddress struct is NULL, it can allow
the kernel to automatically select a free port. This is useful
in particular in unit tests to avoid a race trying to find a
free port to run a test case on.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agosockets: move qapi_copy_SocketAddress into qemu-sockets.c
Daniel P. Berrange [Fri, 14 Aug 2015 17:18:41 +0000 (18:18 +0100)]
sockets: move qapi_copy_SocketAddress into qemu-sockets.c

The qapi_copy_SocketAddress method is going to be useful
in more places than just qemu-char.c, so move it into
the qemu-sockets.c file to allow its reuse.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agosockets: add helpers for creating SocketAddress from a socket
Daniel P. Berrange [Fri, 1 May 2015 16:36:20 +0000 (17:36 +0100)]
sockets: add helpers for creating SocketAddress from a socket

Add two helper methods that, given a socket file descriptor,
can return a populated SocketAddress struct containing either
the local or remote address information.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 11:56:45 +0000 (12:56 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20151020-1' into staging

virtio-input: ignore events until the guest driver is ready

# gpg: Signature made Tue 20 Oct 2015 08:10:00 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-input-20151020-1:
  virtio-input: ignore events until the guest driver is ready

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 11:17:53 +0000 (12:17 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20151020-1' into staging

vga: enable virtio-vga for pseries, vmsvga cursor checks.

# gpg: Signature made Tue 20 Oct 2015 08:27:44 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-vga-20151020-1:
  vmsvga: more cursor checks
  ppc/spapr: Allow VIRTIO_VGA

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-fw_cfg-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 10:45:23 +0000 (11:45 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-fw_cfg-20151020-1' into staging

fw_cfg: add dma interface, add strings via cmdline.

# gpg: Signature made Tue 20 Oct 2015 07:07:34 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-fw_cfg-20151020-1:
  fw_cfg: Define a static signature to be returned on DMA port reads
  Enable fw_cfg DMA interface for x86
  Enable fw_cfg DMA interface for ARM
  Implement fw_cfg DMA interface
  fw_cfg DMA interface documentation
  fw_cfg: document fw_cfg_modify_iXX() update functions
  fw_cfg: insert string blobs via qemu cmdline

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging
Peter Maydell [Tue, 20 Oct 2015 09:52:56 +0000 (10:52 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging

usb: misc small tweaks.

# gpg: Signature made Tue 20 Oct 2015 08:24: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-usb-20151020-1:
  usb-audio: increate default buffer size
  usb: print device id in "info usb" monitor command
  usb-host: add wakeup call for iso xfers

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-14-v4-tag' into...
Peter Maydell [Tue, 20 Oct 2015 08:04:20 +0000 (09:04 +0100)]
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-10-14-v4-tag' into staging

qemu-ga patch queue

* add unit tests for qemu-ga
* add guest-exec support for posix/w32 guests
* added 'qemu-ga' target for w32. this allows us to do full MSI build,
  without overloading 'qemu-ga.exe' target with uneeded dependencies.
* number of s/g_new/g_malloc/ conversions for qga

v2:
* commit message and qapi documentation spelling fixes
* rename 'inp-data' guest-exec param to 'input-data'

v3:
* fix OSX build errors for test-qga by using PRId64
  format in place of glib's, and dropping use of G_SPAWN_DEFAULT
  macro for glib 2.22 compat
* fix win32 build warnings for 32-bit builds by avoid int casts
  of process HANDLEs

v4:
* assert connect_qga() doesn't fail
* only enable test-qga for linux hosts
* allow get-memory-block-info* to fail if memory blocks aren't exposed in
  sysfs

# gpg: Signature made Tue 20 Oct 2015 00:33:43 BST using RSA key ID F108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"

* remotes/mdroth/tags/qga-pull-2015-10-14-v4-tag:
  qga: fix uninitialized value warning for win32
  qga: guest-exec simple stdin/stdout/stderr redirection
  qga: handle G_IO_STATUS_AGAIN in ga_channel_write_all()
  qga: handle possible SIGPIPE in guest-file-write
  qga: guest exec functionality
  qga: drop guest_file_init helper and replace it with static initializers
  tests: add a local test for guest agent
  qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks
  glib-compat: add 2.38/2.40/2.46 asserts
  qtest: add a few fd-level qmp helpers
  qga: do not override configuration verbosity
  qga: add QGA_CONF environment variable
  qga: Use g_new() & friends where that makes obvious sense
  build: qemu-ga: add 'qemu-ga' build target for w32

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agovmsvga: more cursor checks
Gerd Hoffmann [Tue, 29 Sep 2015 07:58:05 +0000 (09:58 +0200)]
vmsvga: more cursor checks

Check the cursor size more carefully.  Also switch to unsigned while
being at it, so they can't be negative.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoppc/spapr: Allow VIRTIO_VGA
Benjamin Herrenschmidt [Tue, 15 Sep 2015 05:51:29 +0000 (15:51 +1000)]
ppc/spapr: Allow VIRTIO_VGA

It works fine with the Linux driver out of the box

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb-audio: increate default buffer size
Gerd Hoffmann [Tue, 6 Oct 2015 13:31:56 +0000 (15:31 +0200)]
usb-audio: increate default buffer size

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>