]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
8 years agocpu: Change tcg_cpu_exec() arg to cpu, not env
Peter Crosthwaite [Wed, 24 Jun 2015 02:31:17 +0000 (19:31 -0700)] 
cpu: Change tcg_cpu_exec() arg to cpu, not env

The sole caller of this function navigates the cpu->env_ptr only for
this function to take it back the cpu pointer straight away. Pass in
cpu pointer instead and grab the env pointer locally in the function.
Removes a core code usage of ENV_GET_CPU().

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agogdbstub: Change gdbserver_fork() to accept cpu instead of env
Peter Crosthwaite [Wed, 24 Jun 2015 02:31:16 +0000 (19:31 -0700)] 
gdbstub: Change gdbserver_fork() to accept cpu instead of env

All callsites to this function navigate the cpu->env_ptr only for the
function to take the env ptr back to the original cpu ptr. Change the
function to just pass in the CPU pointer instead. Removes a core code
usage of ENV_GET_CPU() (in gdbstub.c).

Cc: Riku Voipio <riku.voipio@iki.fi>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agotranslate-all: Change tb_flush() env argument to cpu
Peter Crosthwaite [Wed, 24 Jun 2015 02:31:15 +0000 (19:31 -0700)] 
translate-all: Change tb_flush() env argument to cpu

All of the core-code usages of this API have the cpu pointer handy so
pass it in. There are only 3 architecture specific usages (2 of which
are commented out) which can just use ENV_GET_CPU() locally to get the
cpu pointer. The reduces core code usage of the CPU env, which brings
us closer to common-obj'ing these core files.

Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agotarget-ppc: Move cpu_exec_init() call to realize function
Bharata B Rao [Wed, 24 Jun 2015 02:31:14 +0000 (19:31 -0700)] 
target-ppc: Move cpu_exec_init() call to realize function

Move cpu_exec_init() call from instance_init to realize. This allows
any failures from cpu_exec_init() to be handled appropriately.
Also add corresponding cpu_exec_exit() call from unrealize.

cpu_dt_id assignment from instance_init is no longer needed since
correct assignment for cpu_dt_id is already present in realizefn.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
[AF: Keep calling cpu_exec_init() for CONFIG_USER_ONLY]
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agocpu: Convert cpu_index into a bitmap
Bharata B Rao [Wed, 24 Jun 2015 02:31:13 +0000 (19:31 -0700)] 
cpu: Convert cpu_index into a bitmap

Currently CPUState::cpu_index is monotonically increasing and a newly
created CPU always gets the next higher index. The next available
index is calculated by counting the existing number of CPUs. This is
fine as long as we only add CPUs, but there are architectures which
are starting to support CPU removal, too. For an architecture like PowerPC
which derives its CPU identifier (device tree ID) from cpu_index, the
existing logic of generating cpu_index values causes problems.

With the currently proposed method of handling vCPU removal by parking
the vCPU fd in QEMU
(Ref: http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg02604.html),
generating cpu_index this way will not work for PowerPC.

This patch changes the way cpu_index is handed out by maintaining
a bit map of the CPUs that tracks both addition and removal of CPUs.

The CPU bitmap allocation logic is part of cpu_exec_init(), which is
called by instance_init routines of various CPU targets. Newly added
cpu_exec_exit() API handles the deallocation part and this routine is
called from generic CPU instance_finalize.

Note: This new CPU enumeration is for !CONFIG_USER_ONLY only.
CONFIG_USER_ONLY continues to have the old enumeration logic.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
[AF: max_cpus -> MAX_CPUMASK_BITS]
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agocpu: Add Error argument to cpu_exec_init()
Bharata B Rao [Wed, 24 Jun 2015 02:31:12 +0000 (19:31 -0700)] 
cpu: Add Error argument to cpu_exec_init()

Add an Error argument to cpu_exec_init() to let users collect the
error. This is in preparation to change the CPU enumeration logic
in cpu_exec_init(). With the new enumeration logic, cpu_exec_init()
can fail if cpu_index values corresponding to max_cpus have already
been handed out.

Since all current callers of cpu_exec_init() are from instance_init,
use error_abort Error argument to abort in case of an error.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agocpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init
Eduardo Habkost [Mon, 27 Apr 2015 20:00:33 +0000 (17:00 -0300)] 
cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init

Instead of initializing cpu->as, cpu->thread_id, and reloading memory
map while holding cpu_list_lock(), do it earlier, before locking the CPU
list and initializing cpu_index.

This allows the code handling cpu_index and global CPU list to be
isolated from the rest.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agocpu: Initialize breakpoint/watchpoint lists in cpu_common_initfn()
Eduardo Habkost [Mon, 27 Apr 2015 20:00:32 +0000 (17:00 -0300)] 
cpu: Initialize breakpoint/watchpoint lists in cpu_common_initfn()

One small step in the simplification of cpu_exec_init().

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agocpu: No need to zero-initialize CPUState::numa_node
Eduardo Habkost [Mon, 27 Apr 2015 20:00:31 +0000 (17:00 -0300)] 
cpu: No need to zero-initialize CPUState::numa_node

QOM objects are already zero-filled when instantiated, there's no need
to explicitly set numa_node to 0.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
8 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Wed, 8 Jul 2015 19:46:35 +0000 (20:46 +0100)] 
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

Bugfixes and Daniel Berrange's crypto library.

# gpg: Signature made Wed Jul  8 12:12:29 2015 BST using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  ossaudio: fix memory leak
  ui: convert VNC to use generic cipher API
  block: convert qcow/qcow2 to use generic cipher API
  ui: convert VNC websockets to use crypto APIs
  block: convert quorum blockdrv to use crypto APIs
  crypto: add a nettle cipher implementation
  crypto: add a gcrypt cipher implementation
  crypto: introduce generic cipher API & built-in implementation
  crypto: move built-in D3DES implementation into crypto/
  crypto: move built-in AES implementation into crypto/
  crypto: introduce new module for computing hash digests
  vl: move rom_load_all after machine init done

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
Peter Maydell [Wed, 8 Jul 2015 18:44:28 +0000 (19:44 +0100)] 
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Wed Jul  8 19:08:28 2015 BST using RSA key ID AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/ide-pull-request:
  ahci: Fix CD-ROM signature
  libqos/ahci: fix ahci_write_fis for ncq on ppc64

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoahci: Fix CD-ROM signature
Hannes Reinecke [Mon, 6 Jul 2015 21:49:51 +0000 (17:49 -0400)] 
ahci: Fix CD-ROM signature

The CD-ROM signature is 0xeb140101, not 0xeb140000.
Without this change OVMF/Duet runs into a timeout trying
to detect a SATA cdrom.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1436219392-31915-2-git-send-email-jsnow@redhat.com

8 years agolibqos/ahci: fix ahci_write_fis for ncq on ppc64
John Snow [Mon, 6 Jul 2015 19:17:09 +0000 (15:17 -0400)] 
libqos/ahci: fix ahci_write_fis for ncq on ppc64

Don't try to correct the endianness of NCQ commands, which do not
use any fields wider than a single byte.

This corrects the /x86_64/ahci/io/ncq/simple test (and others)
for ppc64 BE hosts.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: John Snow <jsnow@redhat.com>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1436210229-4118-2-git-send-email-jsnow@redhat.com

8 years agoFix the compatibility typedef of ioservid_t to match the Xen headers
Paul Durrant [Tue, 7 Jul 2015 13:32:38 +0000 (14:32 +0100)] 
Fix the compatibility typedef of ioservid_t to match the Xen headers

There is a mismatch between the definition of ioservid_t in
xen_common.h and the definition in the Xen public headers. This patch
corrects the definition in xen_common.h.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1436275958-25174-1-git-send-email-paul.durrant@citrix.com
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Wed, 8 Jul 2015 12:36:19 +0000 (13:36 +0100)] 
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc,virtio,pci: fixes and updates

Most notably, this includes the TCO support for ICH: the last feature for 2.4
as we are entering the hard freeze.

Bugfixes only from now on.

virtio pci also gained cfg access capability - arguably a bugfix
since virtio spec makes it mandatory, but it's a big patch.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Wed Jul  8 10:40:07 2015 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:
  tco-test: fix up config accesses and re-enable
  virtio fix cfg endian-ness for BE targets
  virtio-pci: implement cfg capability
  virtio: define virtio_pci_cfg_cap in header.
  pcie: Set the "link active" in the link status register
  pci_regs.h: import from linux
  virtio_net: reuse constants from linux
  hw/i386/pc: don't carry FDC from pc_basic_device_init() to pc_cmos_init()
  hw/i386/pc: reflect any FDC @ ioport 0x3f0 in the CMOS
  hw/i386/pc: factor out pc_cmos_init_floppy()
  ich9: implement strap SPKR pin logic
  tests: add testcase for TCO watchdog emulation
  ich9: add TCO interface emulation
  acpi: split out ICH ACPI support
  Revert "dataplane: allow virtio-1 devices"
  dataplane: fix cross-endian issues

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-07-06-v3-tag' into...
Peter Maydell [Wed, 8 Jul 2015 11:35:14 +0000 (12:35 +0100)] 
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-07-06-v3-tag' into staging

tag for qga-pull-2015-07-06-v3

v3:
  - fix missing <windows.h> in configure test program.

v2:
  - added configure check for guest-get-fs-info to avoid breakage on older
    MinGWs
  - removed extraneous include of ws2ipdef.h in w32
    guest-network-get-interfaces. ws2tcpip.h already provides those
    definitions, and older MinGWs don't have it.
  - rebased on latest master

# gpg: Signature made Wed Jul  8 03:01:18 2015 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>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584

* remotes/mdroth/tags/qga-pull-2015-07-06-v3-tag:
  qga: added GuestPCIAddress information
  qga: added bus type and disk location path
  configure: add configure check for ntdddisk.h
  qga: added mountpoint and filesystem type for single volume
  qga: added empty qmp_quest_get_fsinfo functionality.
  qga: fail early for invalid time
  qga: win32 qmp_guest_network_get_interfaces implementation
  qga: add win32 library iphlpapi
  Revert "guest agent: remove g_strcmp0 usage"
  qga/qmp_guest_fstrim: Return per path fstrim result
  qga/commands-posix: Fix bug in guest-fstrim

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoossaudio: fix memory leak
Gonglei [Tue, 23 Jun 2015 01:01:10 +0000 (09:01 +0800)] 
ossaudio: fix memory leak

Variable "conf" going out of scope leaks the storage
it points to in line 856.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1435021270-7768-1-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoui: convert VNC to use generic cipher API
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:38 +0000 (18:10 +0100)] 
ui: convert VNC to use generic cipher API

Switch the VNC server over to use the generic cipher API, this
allows it to use the pluggable DES implementations, instead of
being hardcoded to use QEMU's built-in impl.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-11-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoblock: convert qcow/qcow2 to use generic cipher API
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:37 +0000 (18:10 +0100)] 
block: convert qcow/qcow2 to use generic cipher API

Switch the qcow/qcow2 block driver over to use the generic cipher
API, this allows it to use the pluggable AES implementations,
instead of being hardcoded to use QEMU's built-in impl.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-10-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoui: convert VNC websockets to use crypto APIs
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:36 +0000 (18:10 +0100)] 
ui: convert VNC websockets to use crypto APIs

Remove the direct use of gnutls for hash processing in the
websockets code, in favour of using the crypto APIs. This
allows the websockets code to be built unconditionally
removing countless conditional checks from the VNC code.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-9-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoblock: convert quorum blockdrv to use crypto APIs
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:35 +0000 (18:10 +0100)] 
block: convert quorum blockdrv to use crypto APIs

Get rid of direct use of gnutls APIs in quorum blockdrv in
favour of using the crypto APIs. This avoids the need to
do conditional compilation of the quorum driver. It can
simply report an error at file open file instead if the
required hash algorithm isn't supported by QEMU.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-8-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocrypto: add a nettle cipher implementation
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:34 +0000 (18:10 +0100)] 
crypto: add a nettle cipher implementation

If we are linking to gnutls already and gnutls is built against
nettle, then we should use nettle as a cipher backend in
preference to our built-in backend.

This will be used when linking against some GNUTLS 2.x versions
and all GNUTLS 3.x versions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-7-git-send-email-berrange@redhat.com>
[Change "#elif" to "#elif defined". - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocrypto: add a gcrypt cipher implementation
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:33 +0000 (18:10 +0100)] 
crypto: add a gcrypt cipher implementation

If we are linking to gnutls already and gnutls is built against
gcrypt, then we should use gcrypt as a cipher backend in
preference to our built-in backend.

This will be used when linking against GNUTLS 1.x and many
GNUTLS 2.x versions.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-6-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocrypto: introduce generic cipher API & built-in implementation
Daniel P. Berrange [Wed, 1 Jul 2015 17:10:32 +0000 (18:10 +0100)] 
crypto: introduce generic cipher API & built-in implementation

Introduce a generic cipher API and an implementation of it that
supports only the built-in AES and DES-RFB algorithms.

The test suite checks the supported algorithms + modes to
validate that every backend implementation is actually correctly
complying with the specs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1435770638-25715-5-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotco-test: fix up config accesses and re-enable
Michael S. Tsirkin [Wed, 8 Jul 2015 07:06:15 +0000 (10:06 +0300)] 
tco-test: fix up config accesses and re-enable

The mistake that made the test fail was that it tried to
use a BAR address as an offset for config accesses to LPC.

Config accesses don't need a BAR, and LPC does not have one. Don't
attempt to map it.

With this change applied, TCO test passes, so re-enable it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agovirtio fix cfg endian-ness for BE targets
Michael S. Tsirkin [Sun, 5 Jul 2015 13:08:09 +0000 (15:08 +0200)] 
virtio fix cfg endian-ness for BE targets

address_space_rw assumes data is in target format
and byte-swaps it if target is BE and device is LE.
Use fixed-endian LE APIs instead.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agovirtio-pci: implement cfg capability
Michael S. Tsirkin [Thu, 2 Jul 2015 12:59:49 +0000 (14:59 +0200)] 
virtio-pci: implement cfg capability

spec says we must, so let's do it!

Note: the implementation is incorrect for BE targets.
Will fix with a patch on top, not a big deal now as
the only user is seabios, used on x86 only.

Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agovirtio: define virtio_pci_cfg_cap in header.
Michael S. Tsirkin [Thu, 2 Jul 2015 10:52:44 +0000 (12:52 +0200)] 
virtio: define virtio_pci_cfg_cap in header.

Update virtio pci header from linux-next virtio maintainer tree.
We already have VIRTIO_PCI_CAP_PCI_CFG, let's define the structure
that goes with it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agopcie: Set the "link active" in the link status register
Benjamin Herrenschmidt [Sat, 4 Jul 2015 23:26:03 +0000 (09:26 +1000)] 
pcie: Set the "link active" in the link status register

Some firmwares can test that and assume the device hasn't come
up if that bit isn't set

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agopci_regs.h: import from linux
Michael S. Tsirkin [Wed, 1 Jul 2015 09:42:18 +0000 (11:42 +0200)] 
pci_regs.h: import from linux

It seems to make sense to import pci_regs.h from linux:
why maintain our own?
As a first step, move the header to standard-headers,
and add it to the update script.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agovirtio_net: reuse constants from linux
Michael S. Tsirkin [Wed, 1 Jul 2015 09:36:57 +0000 (11:36 +0200)] 
virtio_net: reuse constants from linux

VIRTIO_NET_F_CTRL_GUEST_OFFLOADS now appears in the
linux header, let's reuse it.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agohw/i386/pc: don't carry FDC from pc_basic_device_init() to pc_cmos_init()
Laszlo Ersek [Thu, 25 Jun 2015 13:35:07 +0000 (15:35 +0200)] 
hw/i386/pc: don't carry FDC from pc_basic_device_init() to pc_cmos_init()

Thanks to the last patch, pc_cmos_init() doesn't need the (optional)
board-default FDC any longer as an input parameter. Update
pc_basic_device_init() not to hand it back to pc_init1() / pc_q35_init(),
and update the latter not to carry the FDC to pc_cmos_init(). This
simplifies the code.

pc_init1() | pc_q35_init()
  pc_basic_device_init()
  pc_cmos_init()

Cc: Jan Tomko <jtomko@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agohw/i386/pc: reflect any FDC @ ioport 0x3f0 in the CMOS
Laszlo Ersek [Thu, 25 Jun 2015 13:35:06 +0000 (15:35 +0200)] 
hw/i386/pc: reflect any FDC @ ioport 0x3f0 in the CMOS

With the pc-q35-2.4 machine type, if the user creates an ISA FDC manually:

  -device isa-fdc,driveA=drive-fdc0-0-0 \
  -drive file=...,if=none,id=drive-fdc0-0-0,format=raw

then the board-default FDC will be skipped, and only the explicitly
requested FDC will exist. qtree-wise, this is correct; however such an FDC
is currently not registered in the CMOS, because that code is only reached
for the board-default FDC.

The pc_cmos_init_late() one-shot reset handler -- one-shot because the
CMOS is not reprogrammed during warm reset -- should search for any ISA
FDC devices, created implicitly (by board code) or explicitly, and set the
CMOS accordingly to the ISA FDC(s) with iobase=0x3f0:

- if there is no such FDC, report both drives absent,
- if there is exactly one such FDC, report its drives in the CMOS,
- if there are more than one such FDCs, then pick one (it is not specified
  which one), and print a warning about the ambiguity.

Cc: Jan Tomko <jtomko@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Jan Tomko <jtomko@redhat.com>
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agohw/i386/pc: factor out pc_cmos_init_floppy()
Laszlo Ersek [Thu, 25 Jun 2015 13:35:05 +0000 (15:35 +0200)] 
hw/i386/pc: factor out pc_cmos_init_floppy()

Extract the pc_cmos_init_floppy() function from pc_cmos_init(). The
function sets two RTC registers: floppy drive types (0x10), overwriting
the earlier value in there), and REG_EQUIPMENT_BYTE (0x14), setting bits
in the prior value.

Cc: Jan Tomko <jtomko@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agoich9: implement strap SPKR pin logic
Paulo Alcantara [Sun, 28 Jun 2015 17:58:58 +0000 (14:58 -0300)] 
ich9: implement strap SPKR pin logic

If the signal is sampled high, this indicates that the system is
strapped to the "No Reboot" mode (ICH9 will disable the TCO Timer system
reboot feature). The status of this strap is readable via the NO_REBOOT
bit (CC: offset 0x3410:bit 5).

The NO_REBOOT bit is set when SPKR pin on ICH9 is sampled high. This bit
may be set or cleared by software if the strap is sampled low but may
not override the strap when it indicates "No Reboot".

This patch implements the logic where hardware has ability to set SPKR
pin through a property named "noreboot" and it's sampled high by
default.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agotests: add testcase for TCO watchdog emulation
Paulo Alcantara [Sun, 28 Jun 2015 17:58:57 +0000 (14:58 -0300)] 
tests: add testcase for TCO watchdog emulation

This patch adds a testcase that covers the following:
  1) TCO default values
  2) first and second TCO timeout
  3) watch and validate ticks counter through TCO_RLD register
  4) maximum supported TCO timeout (0x3ff)
  5) watchdog actions (pause/reset/shutdown/none) upon second TCO
     timeout
  6) set and get of TCO control and status bits

MST: The test does not pass yet, so it's disabled by default.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agoqga: added GuestPCIAddress information
Michael Roth [Wed, 8 Jul 2015 00:12:18 +0000 (19:12 -0500)] 
qga: added GuestPCIAddress information

PCIAddress inforfation is obtained via SetupApi, which provides the
information about address, bus, etc. We look throught entire device tree
in the system and try to find device object for given volume. For this PDO
SetupDiGetDeviceRegistryProperty is called, which reads PCI configuration
for a given devicei if it is possible.

This is the most convinient way for a userspace service. The lookup is
performed for every volume available. However, this information is
not mandatory for vss-provider.

In order to use SetupApi we need to notify linker about it. We do not need
to install additional libs, so we do not make separate configuration
option to use libsetupapi.su

SetupApi gives as the same information as kernel driver
with IRP_MN_QUERY_INTERFACE.
https://support.microsoft.com/en-us/kb/253232

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
* stub out get_pci_info if !CONFIG_QGA_NTDDSCSI
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: added bus type and disk location path
Olga Krishtal [Tue, 30 Jun 2015 10:25:22 +0000 (13:25 +0300)] 
qga: added bus type and disk location path

According to Microsoft disk location path can be obtained via
IOCTL_SCSI_GET_ADDRESS. Unfortunately this ioctl can not be used for all
devices. There are certain bus types which could be obtained with this
API. Please, refer to the following link for more details
https://technet.microsoft.com/en-us/library/ee851589(v=ws.10).aspx

Bus type could be obtained using IOCTL_STORAGE_QUERY_PROPERTY. Enum
STORAGE_BUS_TYPE describes all buses supported by OS.

Windows defines more bus types than Linux. Thus some values have been added
to GuestDiskBusType.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
* fixed warning in CreateFile due to use of NULL instead of 0
* only provide disk info when CONFIG_QGA_NTDDSCSI=y
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoconfigure: add configure check for ntdddisk.h
Michael Roth [Tue, 7 Jul 2015 23:10:09 +0000 (18:10 -0500)] 
configure: add configure check for ntdddisk.h

This header file provides w32 ioctl definitions for working with disk
devices. Older versions of mingw do not expose this in a useable way,
so add a configure check and report it via CONFIG_QGA_NTDDSCSI.

Subsequent patches will use this macro to stub out functionality that
relies on this in cases where it's not available.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: added mountpoint and filesystem type for single volume
Olga Krishtal [Tue, 30 Jun 2015 10:25:21 +0000 (13:25 +0300)] 
qga: added mountpoint and filesystem type for single volume

We should use GetVolumeXXX api to work with volumes. This will help us to
resolve the situation with volumes without drive letter, i.e. when the
volume is mounted as a folder. Such volume is called mounted folder.
This volume is a regular mounted volume from all other points of view.
The information about non mounted volume is reported as System Reserved.
This volume is not mounted and thus it is not writable.

GuestDiskAddressList API is not used because operations are performed with
volumes but no with disks. This means that spanned disk will
be counted and handled as a single volume. It is worth mentioning
that the information about every disk in the volume can be queried
via IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: added empty qmp_quest_get_fsinfo functionality.
Olga Krishtal [Tue, 30 Jun 2015 10:25:20 +0000 (13:25 +0300)] 
qga: added empty qmp_quest_get_fsinfo functionality.

We need qmp_quest_get_fsinfo togather with vss-provider, which works with
volumes. The call to this function is implemented via
FindFirst/NextVolumes. Moreover, volumes in Windows OS are filesystem unit,
so it will be more effective to work with them rather with devices.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: fail early for invalid time
Marc-André Lureau [Sun, 5 Jul 2015 14:28:58 +0000 (16:28 +0200)] 
qga: fail early for invalid time

It's possible to set system time with dates after 2070, however, it's
not possible to set the RTC. It has limitation to up to year
2070 (1970+100). In order to keep both clock in sync and before the
kernel complains on invalid values, bail out early.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: win32 qmp_guest_network_get_interfaces implementation
Kirk Allan [Tue, 2 Jun 2015 17:41:07 +0000 (11:41 -0600)] 
qga: win32 qmp_guest_network_get_interfaces implementation

By default, IPv4 prefixes will be derived by matching the address
to those returned by GetAdaptersInfo.  IPv6 prefixes can not be
matched this way due to the unpredictable order of entries.

In Windows Vista/2008 guests and newer, both IPv4 and IPv6 prefixes
can be retrieved from OnLinkPrefixLength.  Setting --extra-cflags
in the build configuration to "-D_WIN32_WINNT=0x600"
or greater makes OnLinkPrefixLength available.  Setting --extra-cflags
is not required and if not set, the default approach to get the prefix
will be taken.

Signed-off-by: Kirk Allan <kallan@suse.com>
* drop ws2ipdef.h, it's missing on old mingw, and ws2tcpip.h already
  includes it automatically on new builds
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: add win32 library iphlpapi
Kirk Allan [Tue, 2 Jun 2015 17:41:06 +0000 (11:41 -0600)] 
qga: add win32 library iphlpapi

Add the iphlpapi library to use APIs such as GetAdaptersInfo and
GetAdaptersAddresses.

Signed-off-by: Kirk Allan <kallan@suse.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoRevert "guest agent: remove g_strcmp0 usage"
Markus Armbruster [Wed, 27 May 2015 17:53:49 +0000 (19:53 +0200)] 
Revert "guest agent: remove g_strcmp0 usage"

Since we now require GLib 2.22+ (commit f40685c), we don't have to
work around lack of g_strcmp0() anymore.

This reverts commit 8f4774789947bc4bc4c8d026a289fe980d3d2ee1.

Conflicts:
qemu-ga.c

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga/qmp_guest_fstrim: Return per path fstrim result
Justin Ossevoort [Mon, 11 May 2015 06:58:45 +0000 (08:58 +0200)] 
qga/qmp_guest_fstrim: Return per path fstrim result

The current guest-fstrim support only returns an error if some
mountpoint was unable to be trimmed, skipping any possible additional
mountpoints. The result of the TRIM operation itself is also discarded.

This change returns a per mountpoint result of the TRIM operation. If an
error occurs on some mountpoints that error is returned and the
guest-fstrim continue with any additional mountpoints.

The returned values for errors, minimum and trimmed are dependant on the
filesystem, storage stacks and kernel version.

Signed-off-by: Justin Ossevoort <justin@quarantainenet.nl>
* s/type/struct/ in schema type definitions
* moved version annotation for new guest-fstrim return field to
  the field itself rather than applying to the entire command
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga/commands-posix: Fix bug in guest-fstrim
Justin Ossevoort [Mon, 11 May 2015 06:58:44 +0000 (08:58 +0200)] 
qga/commands-posix: Fix bug in guest-fstrim

The FITRIM ioctl updates the fstrim_range structure it receives. This
way the caller can determine how many bytes were trimmed. The
guest-fstrim logic reuses the same fstrim_range for each filesystem,
effectively limiting each filesystem to trim at most as much as the
previous was able to trim.

If a previous filesystem would have trimmed 0 bytes, than the next
filesystem would report an error 'Invalid argument' because a FITRIM
request with length 0 is not valid.

This change resets the fstrim_range structure for each filesystem.

Signed-off-by: Justin Ossevoort <justin@quarantainenet.nl>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoMerge remote-tracking branch 'remotes/agraf/tags/signed-s390-for-upstream' into staging
Peter Maydell [Tue, 7 Jul 2015 22:16:42 +0000 (23:16 +0100)] 
Merge remote-tracking branch 'remotes/agraf/tags/signed-s390-for-upstream' into staging

Patch queue for s390 - 2015-07-07

A few last minute fixes for 2.4. All of them are s390 TCG bug fixes.

# gpg: Signature made Tue Jul  7 16:52:22 2015 BST using RSA key ID 03FEDC60
# gpg: Good signature from "Alexander Graf <agraf@suse.de>"
# gpg:                 aka "Alexander Graf <alex@csgraf.de>"

* remotes/agraf/tags/signed-s390-for-upstream:
  tcg/s390: fix branch target change during code retranslation
  target-s390x: fix CONVERT TO BINARY (CVD, CVDY)
  target-s390x: fix EXECUTE instruction executing TRT
  target-s390x: fix MOVE LONG instruction

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging
Peter Maydell [Tue, 7 Jul 2015 20:16:06 +0000 (21:16 +0100)] 
Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging

Patch queue for ppc - 2015-07-07

A few last minute PPC changes for 2.4:

  - spapr: Update SLOF
  - spapr: Fix a few bugs
  - spapr: Preparation for hotplug
  - spapr: Minor code cleanups
  - linux-user: Add mftb handling
  - kvm: Enable hugepage support with memory-backend-file
  - mac99: Remove nonexistent interrupt pin (Mac OS 9 fix)

# gpg: Signature made Tue Jul  7 16:48:41 2015 BST using RSA key ID 03FEDC60
# gpg: Good signature from "Alexander Graf <agraf@suse.de>"
# gpg:                 aka "Alexander Graf <alex@csgraf.de>"

* remotes/agraf/tags/signed-ppc-for-upstream: (30 commits)
  sPAPR: Clear stale MSIx table during EEH reset
  sPAPR: Reenable EEH functionality on reboot
  sPAPR: Don't enable EEH on emulated PCI devices
  spapr-vty: Use TYPE_ definition instead of hardcoding
  spapr_vty: lookup should only return valid VTY objects
  spapr_pci: drop redundant args in spapr_[populate, create]_pci_child_dt
  spapr_pci: populate ibm,loc-code
  spapr_pci: enumerate and add PCI device tree
  xics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled
  ppc: Update cpu_model in MachineState
  spapr: Consolidate cpu init code into a routine
  spapr: Reorganize CPU dt generation code
  cpus: Add a macro to walk CPUs in reverse
  spapr: Support ibm, lrdr-capacity device tree property
  spapr: Consider max_cpus during xics initialization
  Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
  spapr_iommu: translate sPAPRTCEAccess to IOMMUAccessFlags
  spapr_iommu: drop erroneous check in h_put_tce_indirect()
  spapr_pci: set device node unit address as hex
  spapr_pci: encode class code including Prog IF register
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging
Peter Maydell [Tue, 7 Jul 2015 19:12:55 +0000 (20:12 +0100)] 
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

X86 queue, 2015-07-07

Patch "target-i386: emulate CPUID level of real hardware" was removed after the
2015-07-03 pull request.

# gpg: Signature made Tue Jul  7 15:46:23 2015 BST using RSA key ID 984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-pull-request:
  target-i386: avoid overflow in the tsc-frequency property
  i386: Introduce ARAT CPU feature

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Tue, 7 Jul 2015 18:12:45 +0000 (19:12 +0100)] 
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

v2:
 * Drop block/nfs patch since it exposes an unfinished QAPI interface [kwolf]

# gpg: Signature made Tue Jul  7 14:29:47 2015 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:
  blockjob: add block_job_release function
  block/raw-posix: Don't think /dev/fd/<NN> is a floppy drive.
  block: Use bdrv_drain to replace uncessary bdrv_drain_all
  block: Initialize local_err in bdrv_append_temp_snapshot
  block: update bdrv_drain_all()/bdrv_drain() comments
  qcow2: remove unnecessary check

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20150707' into...
Peter Maydell [Tue, 7 Jul 2015 16:19:59 +0000 (17:19 +0100)] 
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150707' into staging

migration/next for 20150707

# gpg: Signature made Tue Jul  7 13:56:30 2015 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20150707: (28 commits)
  migration: extend migration_bitmap
  migration: protect migration_bitmap
  check_section_footers: Check the correct section_id
  migration: Add migration events on target side
  migration: Make events a capability
  migration: create migration event
  migration: No need to call trace_migrate_set_state()
  migration: Use always helper to set state
  migration: ensure we start in NONE state
  migration: Use cmpxchg correctly
  migration: Add configuration section
  vmstate: Create optional sections
  global_state: Make section optional
  migration: create new section to store global state
  runstate: migration allows more transitions now
  runstate: Add runstate store
  Fix older machine type compatibility on power with section footers
  Fail more cleanly in mismatched RAM cases
  Sanity check RDMA remote data
  Sort destination RAMBlocks to be the same as the source
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotcg/s390: fix branch target change during code retranslation
Aurelien Jarno [Tue, 16 Jun 2015 05:11:41 +0000 (07:11 +0200)] 
tcg/s390: fix branch target change during code retranslation

Make sure to not modify the branch target. This ensure that the
branch target is not corrupted during partial retranslation.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agotarget-s390x: fix CONVERT TO BINARY (CVD, CVDY)
Aurelien Jarno [Thu, 25 Jun 2015 19:16:58 +0000 (21:16 +0200)] 
target-s390x: fix CONVERT TO BINARY (CVD, CVDY)

current_number being shift left by more than 32 bits, we can't use a
simple int. Similarly use an int64_t type for the input binary value,
to not get the -2^31 case wrong. Finally don't initialize shift to 4,
it's already done in the for loop.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agotarget-s390x: fix EXECUTE instruction executing TRT
Aurelien Jarno [Sun, 21 Jun 2015 16:51:08 +0000 (18:51 +0200)] 
target-s390x: fix EXECUTE instruction executing TRT

A break is missing in the EXECUTE instruction, when executing the
TRANSLATE AND TEST instruction.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-By: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agotarget-s390x: fix MOVE LONG instruction
Aurelien Jarno [Tue, 16 Jun 2015 20:57:47 +0000 (22:57 +0200)] 
target-s390x: fix MOVE LONG instruction

The MOVE LONG instruction should pad the destination operand with the
byte from bit positions 32-39 of the source length (r2 + 1), not with
the same byte in the source address.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agosPAPR: Clear stale MSIx table during EEH reset
Gavin Shan [Thu, 2 Jul 2015 06:23:28 +0000 (16:23 +1000)] 
sPAPR: Clear stale MSIx table during EEH reset

The PCI device MSIx table is cleaned out in hardware after EEH PE
reset. However, we still hold the stale MSIx entries in QEMU, which
should be cleared accordingly. Otherwise, we will run into another
(recursive) EEH error and the PCI devices contained in the PE have
to be offlined exceptionally.

The patch introduces function spapr_phb_vfio_eeh_pre_reset(), which
is called by sPAPR when asserting hot or fundamental reset, to clear
stale MSIx table for VFIO PCI devices before EEH PE reset so that
MSIx table could be restored properly after EEH PE reset.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agosPAPR: Reenable EEH functionality on reboot
Gavin Shan [Thu, 2 Jul 2015 06:23:27 +0000 (16:23 +1000)] 
sPAPR: Reenable EEH functionality on reboot

When rebooting the guest, some PEs might be in frozen state. The
contained PCI devices won't work properly if their frozen states
aren't cleared in time. One case running into this situation would
be maximal EEH error times encountered in the guest.

The patch reenables the EEH functinality on PEs on PHB's reset
callback, which will clear their frozen states if needed.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agosPAPR: Don't enable EEH on emulated PCI devices
Gavin Shan [Thu, 2 Jul 2015 06:23:26 +0000 (16:23 +1000)] 
sPAPR: Don't enable EEH on emulated PCI devices

There might have emulated PCI devices, together with VFIO PCI
devices under one PHB. The EEH capability shouldn't enabled
on emulated PCI devices.

The patch returns error when enabling EEH capability on emulated
PCI devices by RTAS call "ibm,set-eeh-option".

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr-vty: Use TYPE_ definition instead of hardcoding
David Gibson [Thu, 2 Jul 2015 06:23:25 +0000 (16:23 +1000)] 
spapr-vty: Use TYPE_ definition instead of hardcoding

There's a call to object_dynamic_cast() in spapr_vty which uses the type
name "spapr-vty" directly, instead of the usual idiom of using the #defined
TYPE_VIO_SPAPR_VTY_DEVICE.  Fix it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_vty: lookup should only return valid VTY objects
David Gibson [Thu, 2 Jul 2015 06:23:24 +0000 (16:23 +1000)] 
spapr_vty: lookup should only return valid VTY objects

If a guest passes the reg property of a valid VIO object that is not a VTY
to either H_GET_TERM_CHAR or H_PUT_TERM_CHAR, QEMU hits a dynamic cast
assertion and aborts.

PAPR+ says "Hypervisor checks the termno parameter for validity against the
Vterm IOA unit addresses assigned to the partition, else return H_Parameter."

This patch adds a type check to ensure vty_lookup() either returns a pointer
to a valid VTY object or NULL.  H_GET_TERM_CHAR and H_PUT_TERM_CHAR will
now return H_PARAMETER to the guest instead of crashing.

The patch has no effect on the reg == 0 hack used to implement the RTAS call
display-character.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_pci: drop redundant args in spapr_[populate, create]_pci_child_dt
Nikunj A Dadhania [Thu, 2 Jul 2015 06:23:23 +0000 (16:23 +1000)] 
spapr_pci: drop redundant args in spapr_[populate, create]_pci_child_dt

* phb_index is not being used and if required can be obtained from sphb
* use helper to get drc_index in spapr_populate_pci_child_dt()
* Check if drc_index is zero

Suggested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_pci: populate ibm,loc-code
Nikunj A Dadhania [Thu, 2 Jul 2015 06:23:22 +0000 (16:23 +1000)] 
spapr_pci: populate ibm,loc-code

Each hardware instance has a platform unique location code.  The OF
device tree that describes a part of a hardware entity must include
the “ibm,loc-code” property with a value that represents the location
code for that hardware entity.

Populate ibm,loc-code.

1) PCI passthru devices need to identify with its own ibm,loc-code
   available on the host. In failure cases use:
   vfio_<name>:<phb-index>:<bus>:<slot>.<fn>

2) Emulated devices encode as following:
   qemu_<name>:<phb-index>:<bus>:<slot>.<fn>

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_pci: enumerate and add PCI device tree
Nikunj A Dadhania [Thu, 2 Jul 2015 06:23:21 +0000 (16:23 +1000)] 
spapr_pci: enumerate and add PCI device tree

All the PCI enumeration and device node creation was off-loaded to
SLOF. With PCI hotplug support, code needed to be added to add device
node. This creates multiple copy of the code one in SLOF and other in
hotplug code. To unify this, the patch adds the pci device node
creation in Qemu. For backward compatibility, a flag
"qemu,phb-enumerated" is added to the phb, suggesting to SLOF to not
do device node creation.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[ Squashed Michael's drc_index changes ]
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoxics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled
Bharata B Rao [Thu, 2 Jul 2015 06:23:20 +0000 (16:23 +1000)] 
xics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled

When supporting CPU hot removal by parking the vCPU fd and reusing
it during hotplug again, there can be cases where we try to reenable
KVM_CAP_IRQ_XICS CAP for the vCPU for which it was already enabled.
Introduce a boolean member in ICPState to track this and don't
reenable the CAP if it was already enabled earlier.

Re-enabling this CAP should ideally work, but currently it results in
kernel trying to create and associate ICP with this vCPU and that
fails since there is already an ICP associated with it. Hence this
patch is needed to work around this problem in the kernel.

This change allows CPU hot removal to work for sPAPR.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoppc: Update cpu_model in MachineState
Bharata B Rao [Thu, 2 Jul 2015 06:23:19 +0000 (16:23 +1000)] 
ppc: Update cpu_model in MachineState

Keep cpu_model field in MachineState uptodate so that it can be used
from the CPU hotplug path.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Consolidate cpu init code into a routine
Bharata B Rao [Thu, 2 Jul 2015 06:23:18 +0000 (16:23 +1000)] 
spapr: Consolidate cpu init code into a routine

Factor out bits of sPAPR specific CPU initialization code into
a separate routine so that it can be called from CPU hotplug
path too.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Reorganize CPU dt generation code
Bharata B Rao [Thu, 2 Jul 2015 06:23:17 +0000 (16:23 +1000)] 
spapr: Reorganize CPU dt generation code

Reorganize CPU device tree generation code so that it be reused from
hotplug path. CPU dt entries are now generated from spapr_finalize_fdt()
instead of spapr_create_fdt_skel().

Note: This is how the split-up looks like now:

Boot path
---------
spapr_finalize_fdt
 spapr_populate_cpus_dt_node
  spapr_populate_cpu_dt
   spapr_fixup_cpu_numa_dt
   spapr_fixup_cpu_smt_dt

ibm,cas path
------------
spapr_h_cas_compose_response
 spapr_fixup_cpu_dt
  spapr_fixup_cpu_numa_dt
  spapr_fixup_cpu_smt_dt

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agocpus: Add a macro to walk CPUs in reverse
Bharata B Rao [Thu, 2 Jul 2015 06:23:16 +0000 (16:23 +1000)] 
cpus: Add a macro to walk CPUs in reverse

Add CPU_FOREACH_REVERSE that walks CPUs in reverse.

Needed for PowerPC CPU device tree reorganization.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Support ibm, lrdr-capacity device tree property
Bharata B Rao [Thu, 2 Jul 2015 06:23:15 +0000 (16:23 +1000)] 
spapr: Support ibm, lrdr-capacity device tree property

Add support for ibm,lrdr-capacity since this is needed by the guest
kernel to know about the possible hot-pluggable CPUs and Memory. With
this, pseries kernels will start reporting correct maxcpus in
/sys/devices/system/cpu/possible.

Also define the minimum hotpluggable memory size as 256MB.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: Fix compile error on 32bit hosts]
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Consider max_cpus during xics initialization
Bharata B Rao [Thu, 2 Jul 2015 06:23:14 +0000 (16:23 +1000)] 
spapr: Consider max_cpus during xics initialization

Use max_cpus instead of smp_cpus when intializating xics system. Also
report max_cpus in ibm,interrupt-server-ranges device tree property of
interrupt controller node.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoRevert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
Markus Armbruster [Thu, 2 Jul 2015 06:23:13 +0000 (16:23 +1000)] 
Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"

Since we now require GLib 2.22+ (commit f40685c), we don't have to
work around lack of g_hash_table_iter_init() & friends anymore.

This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_iommu: translate sPAPRTCEAccess to IOMMUAccessFlags
Greg Kurz [Thu, 2 Jul 2015 06:23:12 +0000 (16:23 +1000)] 
spapr_iommu: translate sPAPRTCEAccess to IOMMUAccessFlags

The fact that these enums have matching values is pure coincidence. We
actually need to translate from the PAPR definition to the QEMU one.

This patch doesn't fix any bug, it is only code cleanup.

Suggested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_iommu: drop erroneous check in h_put_tce_indirect()
Greg Kurz [Thu, 2 Jul 2015 06:23:11 +0000 (16:23 +1000)] 
spapr_iommu: drop erroneous check in h_put_tce_indirect()

The tce_list variable is not a TCE but the address to a TCE: we shouldn't
clear permission bits as we do now. And this is dead code anyway since we
check tce_list is 4K aligned a few lines above.

This patch doesn't fix any bug, it is only code cleanup.

Suggested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_pci: set device node unit address as hex
Nikunj A Dadhania [Thu, 2 Jul 2015 06:23:10 +0000 (16:23 +1000)] 
spapr_pci: set device node unit address as hex

Device node names should encode the unit address as hex, while the
code was encodind it as integers.

Also, use FDT_NAME_MAX macro for allocating and composing the name.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_pci: encode class code including Prog IF register
Nikunj A Dadhania [Thu, 2 Jul 2015 06:23:09 +0000 (16:23 +1000)] 
spapr_pci: encode class code including Prog IF register

Current code missed the Prog IF register. All Class Code, Subclass,
and Prog IF registers are needed to identify the accurate device type.

For example: USB controllers use the PROG IF for denoting: USB
FullSpeed, HighSpeed or SuperSpeed.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr_pci: encode missing 64-bit memory address space
Nikunj A Dadhania [Thu, 2 Jul 2015 06:23:08 +0000 (16:23 +1000)] 
spapr_pci: encode missing 64-bit memory address space

The properties reg/assigned-resources need to encode 64-bit memory
address space as part of phys.hi dword.

  00 if configuration space
  01 if IO region,
  10 if 32-bit MEM region
  11 if 64-bit MEM region

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Add sPAPRMachineClass
David Gibson [Thu, 2 Jul 2015 06:23:07 +0000 (16:23 +1000)] 
spapr: Add sPAPRMachineClass

Currently although we have an sPAPRMachineState descended from MachineState
we don't have an sPAPRMAchineClass descended from MachineClass.  So far it
hasn't been needed, but several upcoming features are going to want it,
so this patch creates a stub implementation.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Remove obsolete entry_point field from sPAPRMachineState
David Gibson [Thu, 2 Jul 2015 06:23:06 +0000 (16:23 +1000)] 
spapr: Remove obsolete entry_point field from sPAPRMachineState

The sPAPRMachineState structure includes an entry_point field containing
the initial PC value for starting the machine, even though this always has
the value 0x100.

I think this is a hangover from very early versions which bypassed the
firmware when using -kernel.  In any case it has no function now, so remove
it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Remove obsolete ram_limit field from sPAPRMachineState
David Gibson [Thu, 2 Jul 2015 06:23:05 +0000 (16:23 +1000)] 
spapr: Remove obsolete ram_limit field from sPAPRMachineState

The ram_limit field was imported from sPAPREnvironment where it predates
the machine's ram size being available generically from machine->ram_size.

Worse, the existing code was inconsistent about where it got the ram size
from.  Sometimes it used spapr->ram_limit, sometimes the global 'ram_size'
and sometimes a local 'ram_size' masking the global.

This cleans up the code to consistently use machine->ram_size, eliminating
spapr->ram_limit in the process.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: Merge sPAPREnvironment into sPAPRMachineState
David Gibson [Thu, 2 Jul 2015 06:23:04 +0000 (16:23 +1000)] 
spapr: Merge sPAPREnvironment into sPAPRMachineState

The code for -machine pseries maintains a global sPAPREnvironment structure
which keeps track of general state information about the guest platform.
This predates the existence of the MachineState structure, but performs
basically the same function.

Now that we have the generic MachineState, fold sPAPREnvironment into
sPAPRMachineState, the pseries specific subclass of MachineState.

This is mostly a matter of search and replace, although a few places which
relied on the global spapr variable are changed to find the structure via
qdev_get_machine().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agopseries: Update SLOF firmware image to qemu-slof-20150429
Alexey Kardashevskiy [Thu, 2 Jul 2015 06:23:03 +0000 (16:23 +1000)] 
pseries: Update SLOF firmware image to qemu-slof-20150429

The changelog is:
  > version: update to 20150429
  > pci: Use QEMU created PCI device nodes
  > usb: support 64-bit pci bars
  > pci: Support 64-bit address translation
  > pci: program correct bridge limit registers during probe
  > scsi: handle report-luns failure
  > Fix "key?" Forth word when using USB keyboards
  > Remove bulk.fs package
  > Include make.rules in the library Makefiles

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agospapr: ensure we have at least one XICS server
Greg Kurz [Thu, 2 Jul 2015 06:23:02 +0000 (16:23 +1000)] 
spapr: ensure we have at least one XICS server

XICS needs to know the upper value for cpu_index as it is used to compute
the number of servers:

    smp_cpus * kvmppc_smt_threads() / smp_threads

When passing -smp cpus=1,threads=9 on a POWER8 host, we end up with:

    1 * 8 / 9 = 0

... which leads to an assertion in both emulated:

Number of servers needs to be greater 0
Aborted (core dumped)

... and in-kernel XICS:

xics_kvm_realize: Assertion `icp->nr_servers' failed.
Aborted (core dumped)

With this patch, we are sure that nr_servers > 0. Passing the same bogus
-smp option then leads to:

qemu-system-ppc64: Cannot support more than 8 threads on PPC with KVM

... which is a lot more explicit than the XICS errors.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agotarget-ppc: fix hugepage support when using memory-backend-file
Michael Roth [Thu, 2 Jul 2015 20:46:14 +0000 (15:46 -0500)] 
target-ppc: fix hugepage support when using memory-backend-file

Current PPC code relies on -mem-path being used in order for
hugepage support to be detected. With the introduction of
MemoryBackendFile we can now handle this via:
  -object memory-file-backend,mem-path=...,id=hugemem0 \
  -numa node,id=mem0,memdev=hugemem0

Management tools like libvirt treat the 2 approaches as
interchangeable in some cases, which can lead to user-visible
regressions even for previously supported guest configurations.

Fix these by also iterating through any configured memory
backends that may be backed by hugepages.

Since the old code assumed hugepages always backed the entirety
of guest memory, play it safe an pick the minimum across the
max pages sizes for all backends, even ones that aren't backed
by hugepages.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agomacio: remove nonexistent interrupt on pin 1
Cormac O'Brien [Wed, 17 Jun 2015 22:04:11 +0000 (17:04 -0500)] 
macio: remove nonexistent interrupt on pin 1

The current macio implementation declares an interrupt that doesn't appear to
exist in the hardware or any other emulator implementation. OpenBIOS detects
this interrupt and generates an 'interrupts' property in the macio device tree
entry. Mac OS 9 halts boot when it detects this interrupt, so it has been
removed to permit further progress in the boot process.

Signed-off-by: Cormac O'Brien <i.am.cormac.obrien@gmail.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agolinux-user, ppc: mftbl can be used by user application
Laurent Vivier [Tue, 30 Jun 2015 09:49:54 +0000 (11:49 +0200)] 
linux-user, ppc: mftbl can be used by user application

In qemu-linux-user, when calling gethostbyname2(),
it was hanging in .__res_nmkquery.

(gdb) bt
0 in .__res_nmkquery () from /lib64/libresolv.so.2
1 in .__libc_res_nquery () from /lib64/libresolv.so.2
2 in .__libc_res_nsearch () from /lib64/libresolv.so.2
3 in ._nss_dns_gethostbyname3_r () from /lib64/libnss_dns.so.2
4 in ._nss_dns_gethostbyname2_r () from /lib64/libnss_dns.so.2
5 in .gethostbyname2_r () from /lib64/libc.so.6
6 in .gethostbyname2 () from /lib64/libc.so.6

.__res_nmkquery() is:

...
do { RANDOM_BITS (randombits); } while ((randombits & 0xffff) == 0);
...

<.__res_nmkquery+112>: mftbl   r11
<.__res_nmkquery+116>: clrlwi  r10,r11,16
<.__res_nmkquery+120>: cmpwi   cr7,r10,0
<.__res_nmkquery+124>: beq     cr7,<.__res_nmkquery+112>

but as mftbl (Move From Time Base Lower) is not implemented,
r11 is always 0, so we have an infinite loop.

This patch fills the Time Base register with cpu_get_real_ticks().

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Tue, 7 Jul 2015 14:48:49 +0000 (15:48 +0100)] 
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

# gpg: Signature made Tue Jul  7 13:38:13 2015 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/net-pull-request:
  rocker: tests: don't need to specify master/self when setting vlans
  rocker: mark copy-to-cpu pkts as forwarding offloaded
  rocker: return -1 when dropping packet on ingress
  rocker: fix missing break statements
  rocker: fix misplaced break statement
  rocker: don't queue receive pkts when port is disabled
  vmxnet3: Fix incorrect small packet padding
  e1000: flush packets when link comes up
  rocker: fix memory leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-i386: avoid overflow in the tsc-frequency property
Paolo Bonzini [Wed, 24 Jun 2015 12:11:27 +0000 (14:11 +0200)] 
target-i386: avoid overflow in the tsc-frequency property

The TSC frequency fits comfortably in an int when expressed in kHz,
but it may overflow when converted to Hz.  In this case,
tsc-frequency returns a negative value because x86_cpuid_get_tsc_freq
does a 32-bit multiplication before assigning to int64_t.

For simplicity just make tsc_khz a 64-bit value.

Spotted by Coverity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agoi386: Introduce ARAT CPU feature
Jan Kiszka [Sun, 7 Jun 2015 09:15:08 +0000 (11:15 +0200)] 
i386: Introduce ARAT CPU feature

ARAT signals that the APIC timer does not stop in power saving states.
As our APICs are emulated, it's fine to expose this feature to guests,
at least when asking for KVM host features or with CPU types that
include the flag. The exact model number that introduced the feature is
not known, but reports can be found that it's at least available since
Sandy Bridge.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150707-1' into staging
Peter Maydell [Tue, 7 Jul 2015 13:44:19 +0000 (14:44 +0100)] 
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150707-1' into staging

virtio-gpu property fixes, add testcase

# gpg: Signature made Tue Jul  7 10:24:16 2015 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-20150707-1:
  virtio-gpu: add to display-vga test
  virtio-gpu: use virtio_instance_init_common, fixup properties
  virtio-gpu: update console device property.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoblockjob: add block_job_release function
Ting Wang [Fri, 26 Jun 2015 09:37:35 +0000 (17:37 +0800)] 
blockjob: add block_job_release function

There is job resource leak in function mirror_start_job,
although bdrv_create_dirty_bitmap is unlikely failed.
Add block_job_release for each release when needed.

Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1435311455-56048-1-git-send-email-kathy.wangting@huawei.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock/raw-posix: Don't think /dev/fd/<NN> is a floppy drive.
Richard W.M. Jones [Wed, 1 Jul 2015 14:40:14 +0000 (15:40 +0100)] 
block/raw-posix: Don't think /dev/fd/<NN> is a floppy drive.

In libguestfs we use /dev/fd/<NN> to pass pre-opened file descriptors
to qemu-img.  Lately I've discovered that although this works, qemu
believes that these are floppy disk images.  That in itself isn't much
of a problem, but now qemu prints a warning about host floppy
pass-thru being deprecated.

Extend the existing test so that it ignores /dev/fd/ as well as
/dev/fdset/

A simple test of this, if you are using the bash shell, is:

  qemu-img info <( cat /dev/null )

without this patch:

  $ qemu-img info <( cat /dev/null )
  qemu-img: Host floppy pass-through is deprecated
  Support for it will be removed in a future release.
  qemu-img: Could not open '/dev/fd/63': Could not refresh total sector count: Illegal seek

with this patch:

  $ qemu-img info <( cat /dev/null )
  qemu-img: Could not open '/dev/fd/63': Could not refresh total sector count: Illegal seek

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1435761614-31358-1-git-send-email-rjones@redhat.com
Fixes: https://bugs.launchpad.net/qemu/+bug/1470536
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Use bdrv_drain to replace uncessary bdrv_drain_all
Fam Zheng [Fri, 29 May 2015 10:53:14 +0000 (18:53 +0800)] 
block: Use bdrv_drain to replace uncessary bdrv_drain_all

There callers work on a single BlockDriverState subtree, where using
bdrv_drain() is more accurate.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Initialize local_err in bdrv_append_temp_snapshot
Fam Zheng [Mon, 6 Jul 2015 04:24:44 +0000 (12:24 +0800)] 
block: Initialize local_err in bdrv_append_temp_snapshot

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1436156684-16526-1-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agomigration: extend migration_bitmap
Li Zhijian [Thu, 2 Jul 2015 12:18:06 +0000 (20:18 +0800)] 
migration: extend migration_bitmap

Prevously, if we hotplug a device(e.g. device_add e1000) during
migration is processing in source side, qemu will add a new ram
block but migration_bitmap is not extended.
In this case, migration_bitmap will overflow and lead qemu abort
unexpectedly.

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agomigration: protect migration_bitmap
Li Zhijian [Thu, 2 Jul 2015 12:18:05 +0000 (20:18 +0800)] 
migration: protect migration_bitmap

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agocheck_section_footers: Check the correct section_id
Dr. David Alan Gilbert [Thu, 2 Jul 2015 08:22:03 +0000 (09:22 +0100)] 
check_section_footers: Check the correct section_id

The section footers check was incorrectly checking the section_id
in the SaveStateEntry not the LoadStateEntry.  These can validly be different
if the two QEMU instances have instantiated their devices in a
different order.  The test only cares that we're finishing the same
section we started, and hence it's the LoadStateEntry that we care about.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agomigration: Add migration events on target side
Juan Quintela [Wed, 20 May 2015 15:15:42 +0000 (17:15 +0200)] 
migration: Add migration events on target side

We reuse the migration events from the source side, sending them on the
appropiate place.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8 years agomigration: Make events a capability
Juan Quintela [Tue, 7 Jul 2015 12:44:05 +0000 (14:44 +0200)] 
migration: Make events a capability

Make check fails with events.  THis is due to the parser/lexer that it
uses.  Just in case that they are more broken parsers, just only send
events when there are capabilities.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8 years agomigration: create migration event
Juan Quintela [Wed, 20 May 2015 10:16:15 +0000 (12:16 +0200)] 
migration: create migration event

We have one argument that tells us what event has happened.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>