sdk/emulator/qemu.git
8 years agohw: Don't use hw_error() for machine initialization errors
Markus Armbruster [Thu, 17 Dec 2015 16:35:09 +0000 (17:35 +0100)]
hw: Don't use hw_error() for machine initialization errors

Printing CPU registers is not helpful during machine initialization.
Moreover, these are straightforward configuration or "can get
resources" errors, so dumping core isn't appropriate either.  Replace
hw_error() by error_report(); exit(1).  Matches how we report these
errors in other machine initializations.

Cc: Richard Henderson <rth@twiddle.net>
Cc: qemu-arm@nongnu.org
Cc: qemu-ppc@nongnu.org
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1450370121-5768-2-git-send-email-armbru@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
8 years agohw: Inline the qdev_prop_set_drive_nofail() wrapper
Markus Armbruster [Thu, 10 Dec 2015 16:29:15 +0000 (17:29 +0100)]
hw: Inline the qdev_prop_set_drive_nofail() wrapper

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1449764955-10741-3-git-send-email-armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoUse error_fatal to simplify obvious fatal errors
Markus Armbruster [Fri, 11 Sep 2015 13:04:45 +0000 (15:04 +0200)]
Use error_fatal to simplify obvious fatal errors

Done with this Coccinelle semantic patch:

    @@
    type T;
    identifier FUN, RET;
    expression list ARGS;
    expression ERR, EC;
    @@
    (
    -    T RET = FUN(ARGS, &ERR);
    +    T RET = FUN(ARGS, &error_fatal);
    |
    -    RET = FUN(ARGS, &ERR);
    +    RET = FUN(ARGS, &error_fatal);
    |
    -    FUN(ARGS, &ERR);
    +    FUN(ARGS, &error_fatal);
    )
    -    if (ERR != NULL) {
    -        error_report_err(ERR);
    -        exit(EC);
    -    }

This is actually a more elegant version of my initial semantic patch
by courtesy of Eduardo.

It leaves dead Error * variables behind, cleaned up manually.

Cc: qemu-arm@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
8 years agoerror: Document how to accumulate multiple errors
Markus Armbruster [Tue, 17 Nov 2015 16:05:49 +0000 (17:05 +0100)]
error: Document how to accumulate multiple errors

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1447776349-2344-1-git-send-email-armbru@redhat.com>

8 years agoMerge remote-tracking branch 'remotes/kvaneesh/tags/for-upstream-signed' into staging
Peter Maydell [Tue, 12 Jan 2016 17:37:22 +0000 (17:37 +0000)]
Merge remote-tracking branch 'remotes/kvaneesh/tags/for-upstream-signed' into staging

VirtFS update:

Cleanups mostly isolating virtio related details into separate files. This
is done to enable easy addition of Xen transport for VirtFS.

The changes include:

1. Rename a bunch of files and functions to make clear they are generic.
2. disentangle virtio transport code and generic 9pfs code.
3. Some function name clean-up.

# gpg: Signature made Tue 12 Jan 2016 06:04:35 GMT using RSA key ID 04C4E23A
# gpg: Good signature from "Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 4846 9DE7 1860 360F A6E9  968C DE41 A4FE 04C4 E23A

* remotes/kvaneesh/tags/for-upstream-signed: (25 commits)
  9pfs: introduce V9fsVirtioState
  9pfs: factor out v9fs_device_{,un}realize_common
  9pfs: rename virtio-9p.c to 9p.c
  9pfs: rename virtio_9p_set_fd_limit to use v9fs_ prefix
  9pfs: move handle_9p_output and make it static function
  9pfs: export pdu_{submit,alloc,free}
  9pfs: factor out virtio_9p_push_and_notify
  9pfs: break out 9p.h from virtio-9p.h
  9pfs: break out virtio_init_iov_from_pdu
  9pfs: factor out pdu_push_and_notify
  9pfs: factor out virtio_pdu_{,un}marshal
  9pfs: make pdu_{,un}marshal proper functions
  9pfs: PDU processing functions should start pdu_ prefix
  9pfs: PDU processing functions don't need to take V9fsState as argument
  fsdev: rename virtio-9p-marshal.{c,h} to 9p-iov-marshal.{c,h}
  fsdev: break out 9p-marshal.{c,h} from virtio-9p-marshal.{c,h}
  9pfs: remove dead code
  9pfs: merge hw/virtio/virtio-9p.h into hw/9pfs/virtio-9p.h
  9pfs: rename virtio-9p-xattr{,-user}.{c,h} to 9p-xattr{,-user}.{c,h}
  9pfs: rename virtio-9p-synth.{c,h} to 9p-synth.{c,h}
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agodisas/libvixl: Suppress gcc 4.6.3 sign-compare warnings
Peter Maydell [Tue, 12 Jan 2016 13:10:04 +0000 (13:10 +0000)]
disas/libvixl: Suppress gcc 4.6.3 sign-compare warnings

The VIXL code includes some equality comparisons between signed
and unsigned types. Modern gcc and clang do not complain about
these, but older versions of gcc such as gcc 4.6.3 do. Since
libvixl is an upstream library, the simplest approach is to
suppress the warnings by applying -Wno-sign-compare to the
relevant files.

(GCC 4.6 is not quite yet irrelevant for us; it is the gcc
shipped with Ubuntu Precise, for example, which is an LTS
release not yet out of its support period.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1452604204-27202-1-git-send-email-peter.maydell@linaro.org
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
Peter Maydell [Tue, 12 Jan 2016 10:38:08 +0000 (10:38 +0000)]
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Mon 11 Jan 2016 19:16:27 GMT using RSA key ID AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"

* remotes/jnsnow/tags/ide-pull-request:
  libqos/ahci: organize header
  qtest/ahci: ATAPI data tests
  libqos/ahci: add ahci_exec
  libqos/ahci: allow nondata commands for ahci_io variants
  libqos: allow zero-size allocations
  libqos/ahci: Switch to mutable properties
  libqos/ahci: ATAPI identify
  libqos/ahci: ATAPI support
  ahci-test: fix memory leak
  ide: ahci: reset ncq object to unused on error
  macio: fix overflow in lba to offset conversion for ATAPI devices

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years ago9pfs: introduce V9fsVirtioState
Wei Liu [Mon, 11 Jan 2016 09:29:37 +0000 (09:29 +0000)]
9pfs: introduce V9fsVirtioState

V9fsState now only contains generic fields. Introduce V9fsVirtioState
for virtio transport.  Change virtio-pci and virtio-ccw to use
V9fsVirtioState.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
8 years agolibqos/ahci: organize header
John Snow [Mon, 11 Jan 2016 19:10:44 +0000 (14:10 -0500)]
libqos/ahci: organize header

Organize the prototypes into nice little sections.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-10-git-send-email-jsnow@redhat.com

8 years agoqtest/ahci: ATAPI data tests
John Snow [Mon, 11 Jan 2016 19:10:43 +0000 (14:10 -0500)]
qtest/ahci: ATAPI data tests

Simple I/O tests for DMA and PIO pathways in the AHCI HBA.

I believe at this point in time all of the common, major IO pathways
in BMDMA and AHCI are covered by qtests now.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-9-git-send-email-jsnow@redhat.com

8 years agolibqos/ahci: add ahci_exec
John Snow [Mon, 11 Jan 2016 19:10:43 +0000 (14:10 -0500)]
libqos/ahci: add ahci_exec

add ahci_exec, which is a standard purpose flexible command dispatcher
and tester for the AHCI device. The intent is to eventually cut down on
the absurd amount of boilerplate inside of the AHCI qtest.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-8-git-send-email-jsnow@redhat.com

8 years agolibqos/ahci: allow nondata commands for ahci_io variants
John Snow [Mon, 11 Jan 2016 19:10:43 +0000 (14:10 -0500)]
libqos/ahci: allow nondata commands for ahci_io variants

These variants try to set a data offset, even if you don't specify one.
In the cases where the offset is zero and it's a nondata command, just
ignore the instruction.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-7-git-send-email-jsnow@redhat.com

8 years agolibqos: allow zero-size allocations
John Snow [Mon, 11 Jan 2016 19:10:43 +0000 (14:10 -0500)]
libqos: allow zero-size allocations

As part of streamlining the AHCI tests interface, it'd be nice
if specying a size of zero could be handled without special branches
and the allocator could handle this special case gracefully.

This lets me use the "ahci_io" macros for non-data commands, too,
which moves me forward towards shepherding all AHCI qtests into
a common set of commands in a unified pipeline.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-6-git-send-email-jsnow@redhat.com

8 years agolibqos/ahci: Switch to mutable properties
John Snow [Mon, 11 Jan 2016 19:10:43 +0000 (14:10 -0500)]
libqos/ahci: Switch to mutable properties

ATAPI commands are, unfortunately, weird in that they can
be either DMA or PIO depending on a header bit. In order to
accommodate them, I'll need to make AHCI command properties
mutable so we can toggle between which "flavor" of ATAPI command
we want to test.

The default ATAPI transfer mechanism is PIO and the default
properties are adjusted accordingly.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-5-git-send-email-jsnow@redhat.com

8 years agolibqos/ahci: ATAPI identify
John Snow [Mon, 11 Jan 2016 19:10:42 +0000 (14:10 -0500)]
libqos/ahci: ATAPI identify

We need to say "hello!" to our ATAPI friends
in a slightly different manner.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-4-git-send-email-jsnow@redhat.com

8 years agolibqos/ahci: ATAPI support
John Snow [Mon, 11 Jan 2016 19:10:42 +0000 (14:10 -0500)]
libqos/ahci: ATAPI support

Add pathways to tolerate ATAPI commands.

Notably, unlike ATA, each SCSI command's layout is a little different,
so support will have to be patched in for each command as we want to
test them in e.g. ahci_command_set_sizes and ahci_command_set_offset.

For now, I'm adding support for 0x28, READ (10).

[Maintainer edit: replaced type-punning with stl_be_p(). --js]

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-3-git-send-email-jsnow@redhat.com

8 years agoahci-test: fix memory leak
John Snow [Mon, 11 Jan 2016 19:10:42 +0000 (14:10 -0500)]
ahci-test: fix memory leak

Use the proper free command to detroy an AHCICommand.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1452282920-21550-2-git-send-email-jsnow@redhat.com

8 years agoide: ahci: reset ncq object to unused on error
Prasad J Pandit [Mon, 11 Jan 2016 19:10:42 +0000 (14:10 -0500)]
ide: ahci: reset ncq object to unused on error

When processing NCQ commands, AHCI device emulation prepares a
NCQ transfer object; To which an aio control block(aiocb) object
is assigned in 'execute_ncq_command'. In case, when the NCQ
command is invalid, the 'aiocb' object is not assigned, and NCQ
transfer object is left as 'used'. This leads to a use after
free kind of error in 'bdrv_aio_cancel_async' via 'ahci_reset_port'.
Reset NCQ transfer object to 'unused' to avoid it.

[Maintainer edit: s/ACHI/AHCI/ in the commit message. --js]

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1452282511-4116-1-git-send-email-ppandit@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
8 years agomacio: fix overflow in lba to offset conversion for ATAPI devices
Mark Cave-Ayland [Mon, 11 Jan 2016 19:10:42 +0000 (14:10 -0500)]
macio: fix overflow in lba to offset conversion for ATAPI devices

As the IDEState lba field is an int32_t, make sure we cast to int64_t before
shifting to calculate the offset. Otherwise we end up with an overflow when
trying to access sectors beyond 2GB as can occur when using DVD images.

[Maintainer edit: fixed extraneous parentheses. --js]

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1451928613-29476-1-git-send-email-mark.cave-ayland@ilande.co.uk
Signed-off-by: John Snow <jsnow@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160111-1' into...
Peter Maydell [Mon, 11 Jan 2016 16:09:50 +0000 (16:09 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160111-1' into staging

target-arm queue:
 * i.MX: move i.MX31 CCM object to register array
 * xilinx_axidma: remove dead code
 * disas/libvixl: Update to upstream VIXL 1.12
 * virt: Support legacy -nic command line syntax

# gpg: Signature made Mon 11 Jan 2016 16:05:58 GMT using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"

* remotes/pmaydell/tags/pull-target-arm-20160111-1:
  hw/arm/virt: Support legacy -nic command line syntax
  disas/libvixl: Update to upstream VIXL 1.12
  hw/dma/xilinx_axidma: remove dead code
  i.MX: move i.MX31 CCM object to register array

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/arm/virt: Support legacy -nic command line syntax
Ashok Kumar [Mon, 11 Jan 2016 15:52:18 +0000 (15:52 +0000)]
hw/arm/virt: Support legacy -nic command line syntax

Support the legacy -nic syntax for creating PCI network devices
as well as the new-style -device options. This makes life easier
for people moving from x86 KVM virtualization to ARM KVM virtualization
and expecting their network configuration options to work the same
way for both setups.

We use "virtio" as the default NIC model if the user doesn't specify one.

Signed-off-by: Ashok Kumar <ashoks@broadcom.com>
Message-id: 1452091659-17698-1-git-send-email-ashoks@broadcom.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: expanded and clarified commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agodisas/libvixl: Update to upstream VIXL 1.12
Peter Maydell [Mon, 11 Jan 2016 15:52:18 +0000 (15:52 +0000)]
disas/libvixl: Update to upstream VIXL 1.12

Update our copy of libvixl to upstream's 1.12 release.
The major benefit from QEMU's point of view is that some instructions
previously disassembled as "unimplemented (System)" are now displayed
as something more useful. It also fixes some warnings about format
strings that newer w64-mingw32 compilers were emitting.

We didn't have any local changes to libvixl so nothing needed
to be forward-ported.

Although this is a large commit (due to upstream renaming most
of the files), only a few of the files changed in this commit
are not just straight copies of upstream libvixl files:
 disas/arm-a64.cc
 disas/libvixl/Makefile.objs
 disas/libvixl/README

Note that this commit introduces some signed-unsigned comparison
warnings on the old mingw compilers. Those compilers have broken
TLS support anyway so have only ever been much use for compile tests;
anybody still using them should add -Wno-sign-compare to their
--extra-cflags.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/dma/xilinx_axidma: remove dead code
Andrew Jones [Mon, 11 Jan 2016 15:52:18 +0000 (15:52 +0000)]
hw/dma/xilinx_axidma: remove dead code

stream_desc_show() (and DEBUG_ENET) appear to be unused, as the
function isn't compilable (there are broken PRI format strings).

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 1452084792-17424-1-git-send-email-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoi.MX: move i.MX31 CCM object to register array
Jean-Christophe DUBOIS [Mon, 11 Jan 2016 15:52:18 +0000 (15:52 +0000)]
i.MX: move i.MX31 CCM object to register array

With this i.MX25 and i.MX31 will have closer implementations.

Moreover all i.MX31 CCM registers are now present.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160111' into staging
Peter Maydell [Mon, 11 Jan 2016 14:22:04 +0000 (14:22 +0000)]
Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160111' into staging

January 2016 Linux-user queque

# gpg: Signature made Mon 11 Jan 2016 14:13:57 GMT using RSA key ID DE3C9BC0
# gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>"
# gpg:                 aka "Riku Voipio <riku.voipio@linaro.org>"

* remotes/riku/tags/pull-linux-user-20160111:
  linux-user/mmap.c: Use end instead of real_end in target_mmap
  linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.
  linux-user: Update m68k syscall definitions to match Linux 4.4.
  linux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt()
  linux-user: enable sigaltstack for all architectures
  unicore32: convert get_sp_from_cpustate from macro to inline
  linux-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()
  linux-user,sh4: fix signal retcode address
  linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr
  linux-user: manage bind with a socket of SOCK_PACKET type.
  linux-user: add a function hook to translate sockaddr
  linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly
  linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
  linux-user/syscall.c: malloc()/calloc() to g_malloc()/g_try_malloc()/g_new0()
  linux-user: in poll(), if nfds is 0, pfd can be NULL
  linux-user: correctly align target_epoll_event
  linux-user: add signalfd/signalfd4 syscalls

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agolinux-user/mmap.c: Use end instead of real_end in target_mmap
Chen Gang [Thu, 24 Dec 2015 01:07:33 +0000 (09:07 +0800)]
linux-user/mmap.c: Use end instead of real_end in target_mmap

The fragment must effectively be mapped only to "end" not to "real_end"
(which is a host page aligned address, and thus this is not a fragment).
It is consistent with what it is done in the case of one single page.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-01-11' into...
Peter Maydell [Mon, 11 Jan 2016 12:56:58 +0000 (12:56 +0000)]
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-01-11' into staging

trivial patches for 2016-01-11

# gpg: Signature made Mon 11 Jan 2016 08:39:32 GMT using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"

* remotes/mjt/tags/pull-trivial-patches-2016-01-11:
  hw/s390x: Remove superfluous return statements
  hw/core/qdev: Remove superfluous return statement
  hw/acpi: Remove superfluous return statement
  hw/ide: Remove superfluous return statements
  osdep.h: Include glib-compat.h in osdep.h rather than qemu-common.h
  scripts/checkpatch.pl: Don't allow special cases of unspaced operators
  PCI Bonito: QOMify and cleanup
  SH PCI Host: convert to realize()
  gt64120: convert to realize()
  Add missing syscall nrs. according to more recent Linux kernels
  hw/misc/edu: Convert to realize()
  configure: fix trace backend check
  xen/Makefile.objs: simplify
  crypto: Fix typo in example
  MAINTAINERS: Add the correct device_tree.h file
  iscsi: fix readcapacity error message
  net: convert qemu_log to error_report, fix message
  linux-user: enable sigaltstack for all architectures
  unicore32: convert get_sp_from_cpustate from macro to inline

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agolinux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.
John Paul Adrian Glaubitz [Thu, 24 Dec 2015 18:59:59 +0000 (19:59 +0100)]
linux-user: Add SOCKOP_sendmmsg and SOCKOP_recvmmsg socket call, wire them up.

Adds the definitions for the socket calls SOCKOP_sendmmsg
and SOCKOP_recvmmsg and wires them up with the rest of the code.
The necessary function do_sendrecvmmsg() is already present in
linux-user/syscall.c. After adding these two definitions and wiring
them up, I no longer receive an error message about the
unimplemented socket calls when running "apt-get update" on Debian
unstable running on qemu with glibc_2.21 on m68k.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
8 years agolinux-user: Update m68k syscall definitions to match Linux 4.4.
John Paul Adrian Glaubitz [Thu, 24 Dec 2015 18:59:58 +0000 (19:59 +0100)]
linux-user: Update m68k syscall definitions to match Linux 4.4.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Mon, 11 Jan 2016 12:30:02 +0000 (12:30 +0000)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Mon 11 Jan 2016 05:22:16 GMT using RSA key ID 398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@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: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request: (24 commits)
  ether/slirp: Avoid redefinition of the same constants
  l2tpv3: fix cookie decoding
  net: ne2000: fix bounds check in ioport operations
  net: rocker: fix an incorrect array bounds check
  vmxnet3: Introduce 'x-disable-pcie' back-compat property
  vmxnet3: Report the Device Serial Number capability
  vmxnet3: The vmxnet3 device is a PCIE endpoint
  vmxnet3: coding: Introduce VMXNET3Class
  vmxnet3: Introduce 'x-old-msi-offsets' back-compat property
  vmxnet3: Change the offset of the MSIX PBA table
  vmxnet3: Change offsets of msi/msix pci capabilities
  net/filter: fix nf->netdev_id leak
  net/dump: fix nfds->filename leak
  net/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION
  net/vmxnet3: return 0 on unknown command
  net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO
  net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command
  net/vmxnet3: return 1 on device activation failure
  MAINTAINERS: Add an entry for the net/slirp.c file
  net: vmxnet3: avoid memory leakage in activate_device
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160111' into staging
Peter Maydell [Mon, 11 Jan 2016 11:57:53 +0000 (11:57 +0000)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160111' into staging

ppc patch queue 2016-01-11

Biggest content is a thorough cleanups of spapr machine type handling.
Also contains several other minor cleanups, bugfixes and extensions.

# gpg: Signature made Mon 11 Jan 2016 04:34:38 GMT using RSA key ID 20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# 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: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.6-20160111:
  hw/ppc/spapr: fix spapr->kvm_type leak
  spapr vio: fix to incomplete QOMify
  hw/ppc/spapr: Use XHCI as host controller for new spapr machines
  pseries: Add pseries-2.6 machine type
  pseries: Improve setting of default machine version
  pseries: Restructure class_options functions
  pseries: DEFINE_SPAPR_MACHINE
  pseries: Use SET_MACHINE_COMPAT
  Move SET_MACHINE_COMPAT macro to boards.h
  pseries: Remove versions from mc->desc
  pseries: Remove redundant calls to spapr_machine_initfn()
  pseries: Rearrange versioned machine type code
  pseries: Remove redundant setting of mc->name for pseries-2.5 machine
  spapr: Add /system-id
  target-ppc: Define kvmppc_read_int_dt()
  hw/ppc/spapr_rtc: Remove bad class_size value

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agolinux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt()
Chen Gang [Mon, 11 Jan 2016 05:58:50 +0000 (13:58 +0800)]
linux-user/syscall.c: Use SOL_SOCKET instead of level for setsockopt()

In this case, level is TARGET_SOL_SOCKET, but we need SOL_SOCKET for
setsockopt().

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 11 Jan 2016 11:19:05 +0000 (11:19 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

acpi dsdt rework, misc fixes

This completes the dsdt rewrite, and includes misc fixes all over the place.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sat 09 Jan 2016 21:20:34 GMT 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: (59 commits)
  virtio: fix error message for number of queues
  ivshmem: Store file descriptor for vhost-user negotiation
  migration/virtio: Remove simple .get/.put use
  Add VMSTATE_STRUCT_VARRAY_KNOWN
  i386/pc: expose identifying the floppy controller
  pc: acpi: remove unused ASL templates and related blobs/utils
  pc: acpi: switch to AML API composed DSDT
  pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
  pc: acpi: q35: move PCI0 device definition into SSDT
  pc: acpi: q35: move PCI0._OSC() method into SSDT
  pc: acpi: q35: move _PIC() method into SSDT
  pc: acpi: q35: move PRTP routing table into SSDT
  pc: acpi: q35: move PRTA routing table into SSDT
  pc: acpi: q35: move _PRT() into SSDT
  pc: acpi: q35: move ISA bridge into SSDT
  pc: acpi: q35: move IQST() into SSDT
  pc: acpi: q35: move IQCR() into SSDT
  pc: acpi: q35: move link devices to SSDT
  pc: acpi: q35: move GSI links to SSDT
  pc: acpi: piix4: acpi move PCI0 device to SSDT
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/s390x: Remove superfluous return statements
Thomas Huth [Tue, 10 Nov 2015 20:16:10 +0000 (21:16 +0100)]
hw/s390x: Remove superfluous return statements

The "return;" statements at the end of functions do not make
much sense, so let's remove them.

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agohw/core/qdev: Remove superfluous return statement
Thomas Huth [Tue, 10 Nov 2015 20:16:11 +0000 (21:16 +0100)]
hw/core/qdev: Remove superfluous return statement

The "return;" statement at the end of device_set_realized()
does not make much sense, so let's remove it.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agohw/acpi: Remove superfluous return statement
Thomas Huth [Tue, 10 Nov 2015 20:16:09 +0000 (21:16 +0100)]
hw/acpi: Remove superfluous return statement

The "return;" statement at the end of acpi_memory_plug_cb()
does not make much sense, so let's remove it.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agohw/ide: Remove superfluous return statements
Thomas Huth [Tue, 10 Nov 2015 20:16:08 +0000 (21:16 +0100)]
hw/ide: Remove superfluous return statements

The "return;" statements at the end of functions do not make
much sense, so let's remove them.

Cc: qemu-block@nongnu.org
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoosdep.h: Include glib-compat.h in osdep.h rather than qemu-common.h
Peter Maydell [Fri, 4 Dec 2015 17:34:20 +0000 (17:34 +0000)]
osdep.h: Include glib-compat.h in osdep.h rather than qemu-common.h

Our use of glib is now pervasive across QEMU. Move the include of glib-compat.h
from qemu-common.h to osdep.h so that it is more widely accessible and doesn't
get forgotten by accident. (Failure to include it will result in build failure
on old versions of glib which is likely to be unnoticed by most developers.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoscripts/checkpatch.pl: Don't allow special cases of unspaced operators
Peter Maydell [Fri, 18 Dec 2015 12:59:31 +0000 (12:59 +0000)]
scripts/checkpatch.pl: Don't allow special cases of unspaced operators

The checkpatch.pl script has a special case to permit the following
operators to have no spaces around them:
 <<  >>  &  ^  |  +  -  *  /  %

QEMU style prefers all operators to consistently have spacing around
them, so remove this special case handling. This avoids reviewers
having to manually note it during code review.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoPCI Bonito: QOMify and cleanup
Cao jin [Tue, 5 Jan 2016 10:57:49 +0000 (18:57 +0800)]
PCI Bonito: QOMify and cleanup

Also clear the code

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoSH PCI Host: convert to realize()
Cao jin [Fri, 18 Dec 2015 11:03:48 +0000 (19:03 +0800)]
SH PCI Host: convert to realize()

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agogt64120: convert to realize()
Cao jin [Fri, 18 Dec 2015 11:03:51 +0000 (19:03 +0800)]
gt64120: convert to realize()

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoAdd missing syscall nrs. according to more recent Linux kernels
Johan Ouwerkerk [Thu, 24 Dec 2015 22:31:26 +0000 (23:31 +0100)]
Add missing syscall nrs. according to more recent Linux kernels

This change covers arm, aarch64, mips. Others to follow?

The change was prompted by QEMU warning about a syscall 384 (get_random())
with Debian armhf binaries (ARMv7).

Signed-off-by: Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agohw/misc/edu: Convert to realize()
Cao jin [Fri, 18 Dec 2015 08:55:35 +0000 (16:55 +0800)]
hw/misc/edu: Convert to realize()

for educational PCI device

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoconfigure: fix trace backend check
Marc-André Lureau [Thu, 10 Dec 2015 00:47:46 +0000 (01:47 +0100)]
configure: fix trace backend check

Found thanks to shellcheck!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoxen/Makefile.objs: simplify
Cao jin [Tue, 29 Dec 2015 12:39:56 +0000 (20:39 +0800)]
xen/Makefile.objs: simplify

merge last two lines, keep alphabetic order.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agocrypto: Fix typo in example
Eric Blake [Mon, 21 Dec 2015 15:54:17 +0000 (08:54 -0700)]
crypto: Fix typo in example

The example code wouldn't even compile, since it did not use
a consistent spelling for the Error ** parameter.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoMAINTAINERS: Add the correct device_tree.h file
Thomas Huth [Thu, 17 Dec 2015 14:25:12 +0000 (15:25 +0100)]
MAINTAINERS: Add the correct device_tree.h file

device_tree.h is not in the main directory, but under
include/sysemu/ nowadays.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoiscsi: fix readcapacity error message
Zhu Lingshan [Wed, 16 Dec 2015 04:40:40 +0000 (12:40 +0800)]
iscsi: fix readcapacity error message

fix:The error message for readcapacity 16 incorrectly mentioned
a readcapacity 10 failure, fixed the error message.

Signed-off-by: Zhu Lingshan <lszhu@suse.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agonet: convert qemu_log to error_report, fix message
Paolo Bonzini [Fri, 4 Dec 2015 12:38:46 +0000 (13:38 +0100)]
net: convert qemu_log to error_report, fix message

Ensure that the error is printed with the proper timestamp.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agolinux-user: enable sigaltstack for all architectures
Michael Tokarev [Tue, 29 Dec 2015 09:45:25 +0000 (12:45 +0300)]
linux-user: enable sigaltstack for all architectures

There is no reason to limit sigaltstack syscall to just a few
architectures and pretend it is not implemented for others.

If some architecture is not ready for this, that architecture
should be fixed instead.

This fixes LP#1516408.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/ppc/spapr: fix spapr->kvm_type leak
David Gibson [Mon, 28 Dec 2015 06:38:26 +0000 (17:38 +1100)]
hw/ppc/spapr: fix spapr->kvm_type leak

Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
[fixed return type of spapr_machine_finalizefn()]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agospapr vio: fix to incomplete QOMify
Cao jin [Wed, 23 Dec 2015 11:30:12 +0000 (19:30 +0800)]
spapr vio: fix to incomplete QOMify

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agohw/ppc/spapr: Use XHCI as host controller for new spapr machines
Thomas Huth [Wed, 9 Dec 2015 12:34:13 +0000 (13:34 +0100)]
hw/ppc/spapr: Use XHCI as host controller for new spapr machines

The OHCI has some bugs and performance issues, so for
newer machines it's preferable to use XHCI instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agopseries: Add pseries-2.6 machine type
David Gibson [Mon, 7 Dec 2015 03:28:15 +0000 (14:28 +1100)]
pseries: Add pseries-2.6 machine type

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Improve setting of default machine version
David Gibson [Mon, 7 Dec 2015 03:25:50 +0000 (14:25 +1100)]
pseries: Improve setting of default machine version

This tweaks the way the default machine version is controlled, so that
there will be a bit less churn when each new version is introduced.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Restructure class_options functions
David Gibson [Mon, 7 Dec 2015 03:27:21 +0000 (14:27 +1100)]
pseries: Restructure class_options functions

Currently each of the *_class_options() functions for the pseries-2.1 ..
pseries-2.5 machine types are standalone.  This will become harder to
maintain as new versions are added.

This patch restructures them similarly to x86 where each function calls
the one from the next version, then overrides anything necessary for
compatibility with the specific version and older.

The default behaviour - that for the most recent machine are set up in
the base class initializer spapr_machine_class_init().  Previously it had
some things set up to default to older behaviour with the more recent
machines overriding it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: DEFINE_SPAPR_MACHINE
David Gibson [Mon, 7 Dec 2015 03:23:20 +0000 (14:23 +1100)]
pseries: DEFINE_SPAPR_MACHINE

At the moment all the class_init functions and TypeInfo structures for the
various versioned pseries machine types are open-coded.  As more versions
are created this is getting increasingly clumsy.

This patch borrows the approach used in PC, using a DEFINE_SPAPR_MACHINE()
macro to construct most of the boilerplate from simpler 'class_options' and
'instance_options' functions.

This patch makes a small semantic change - the versioned machine types are
now registered through machine_init() instead of type_init().  Since the
new way is how PC already did it, I'm assuming that's correct.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Use SET_MACHINE_COMPAT
David Gibson [Thu, 3 Dec 2015 06:47:22 +0000 (17:47 +1100)]
pseries: Use SET_MACHINE_COMPAT

To make the spapr_machine_*_class_init() functions a little less bulky.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agoMove SET_MACHINE_COMPAT macro to boards.h
David Gibson [Thu, 3 Dec 2015 06:34:38 +0000 (17:34 +1100)]
Move SET_MACHINE_COMPAT macro to boards.h

pc.h defines a SET_MACHINE_COMPAT macro to make setting up compat_props
for the various PC machine versions less verbose.  There's nothing
inherently PC specific about it, though, so move it to boards.h where other
versioned machine types (like pseries-*) can use it.

While we're doing that, change it's indentation to be a bit more regular.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Remove versions from mc->desc
David Gibson [Mon, 7 Dec 2015 03:29:35 +0000 (14:29 +1100)]
pseries: Remove versions from mc->desc

Currently, the versioned spapr machine types put the machine type version
into the description string.  PC does not do this, using just the name
itself to distinguish.  Doing the same lets us move setting the description
into the common base class, simplifying the code slightly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Remove redundant calls to spapr_machine_initfn()
David Gibson [Thu, 3 Dec 2015 06:34:20 +0000 (17:34 +1100)]
pseries: Remove redundant calls to spapr_machine_initfn()

The instance_init() functions for several of the pseries-x.y versioned
machine types explicitly call spapr_machine_initfn().  But that's the
instance_init function for the common parent of all those machine types,
so will already have been called beforehand by the QOM infrastructure.

Remove the redundant calls.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Rearrange versioned machine type code
David Gibson [Thu, 3 Dec 2015 06:34:10 +0000 (17:34 +1100)]
pseries: Rearrange versioned machine type code

hw/ppc/spapr.c has a number of definitions related to the various versioned
machine types ("pseries-2.1" .. "pseries-2.5") it defines.  These are
mostly arranged by type of function first, then machine version second, and
it's not consistent about whether it goes in increasing or decreasing
version order.

This rearranges the code to keep all the definitions for a particular
machine version together, and arrange then consistently in order most
recent to least recent.

This brings us closer to matching the way PC does things, and makes later
cleanups easier to follow.

Apart from adding some comments marking each section, this is a pure
mechanical rearrangement with no semantic changes.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Remove redundant setting of mc->name for pseries-2.5 machine
David Gibson [Mon, 30 Nov 2015 05:36:49 +0000 (16:36 +1100)]
pseries: Remove redundant setting of mc->name for pseries-2.5 machine

98cec76 "machine: Set MachineClass::name automatically" removed the setting
of mc->name for the pseries machine types, since it can be derived
automatically from the type names constructed with MACHINE_TYPE_NAME().

Unfortunately fb0fc8f "spapr: Create pseries-2.5 machine" went in later and
brought one of them back.

This removes it again.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agospapr: Add /system-id
Alexey Kardashevskiy [Mon, 9 Nov 2015 06:47:17 +0000 (17:47 +1100)]
spapr: Add /system-id

Section B.6.2.1 Root Node Properties of PAPR specification defines
a set of properties which shall be present in the device tree root,
one of these properties is "system-id" which "should be unique across
all systems and all manufacturers". Since UUID is meant to be unique,
it makes sense to use it as "system-id".

This adds "system-id" property to the device tree root when not empty.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: Define kvmppc_read_int_dt()
Sukadev Bhattiprolu [Sat, 14 Nov 2015 02:13:07 +0000 (18:13 -0800)]
target-ppc: Define kvmppc_read_int_dt()

Extract code from the function kvmppc_read_int_cpu_dt() that actually
reads the file into a separate function, so it can be called from
other places.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoether/slirp: Avoid redefinition of the same constants
Dr. David Alan Gilbert [Fri, 8 Jan 2016 14:41:28 +0000 (14:41 +0000)]
ether/slirp: Avoid redefinition of the same constants

eth.h and slirp.h both define ETH_ALEN and ETH_P_IP
rtl8139.c and eth.h both define ETH_HLEN

Move the related constant (ETH_P_ARP) from slirp.h to eth.h, and
remove the duplicates; make slirp.h include eth.h

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agol2tpv3: fix cookie decoding
Alexis Dambricourt [Mon, 4 Jan 2016 23:26:07 +0000 (00:26 +0100)]
l2tpv3: fix cookie decoding

If a 32 bits l2tpv3 frame cookie MSB if set to 1, the cast to uint64_t
cookie will spread 1 to the four most significant bytes.
Then the condition (cookie != s->rx_cookie) becomes false.

Signed-off-by: Alexis Dambricourt <alexis.dambricourt@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet: ne2000: fix bounds check in ioport operations
Prasad J Pandit [Thu, 31 Dec 2015 11:35:27 +0000 (17:05 +0530)]
net: ne2000: fix bounds check in ioport operations

While doing ioport r/w operations, ne2000 device emulation suffers
from OOB r/w errors. Update respective array bounds check to avoid
OOB access.

Reported-by: Ling Liu <liuling-it@360.cn>
Cc: qemu-stable@nongnu.org
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet: rocker: fix an incorrect array bounds check
Prasad J Pandit [Mon, 28 Dec 2015 10:54:08 +0000 (16:24 +0530)]
net: rocker: fix an incorrect array bounds check

While processing transmit(tx) descriptors in 'tx_consume' routine
the switch emulator suffers from an off-by-one error, if a
descriptor was to have more than allowed(ROCKER_TX_FRAGS_MAX=16)
fragments. Fix an incorrect bounds check to avoid it.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: Introduce 'x-disable-pcie' back-compat property
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:40 +0000 (09:17 +0200)]
vmxnet3: Introduce 'x-disable-pcie' back-compat property

Following the previous patch which changed vmxnet3 to be a pci express
device, this patch introduces a boolean property 'x-disable-pcie' whose
default is false.

Setting 'x-disable-pcie' to 'on' preserves the old 'pci device' (non
express) behavior. This allows migration to older versions.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: Report the Device Serial Number capability
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:41 +0000 (09:17 +0200)]
vmxnet3: Report the Device Serial Number capability

Report the DSN extended PCI capability at 0x100.
DSN value is a transformation of device MAC address, as calculated
by VMware virtual hardware.

DSN is reported only if device is pcie.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: The vmxnet3 device is a PCIE endpoint
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:39 +0000 (09:17 +0200)]
vmxnet3: The vmxnet3 device is a PCIE endpoint

Report the 'express endpoint' capability if on a PCIE bus.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: coding: Introduce VMXNET3Class
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:38 +0000 (09:17 +0200)]
vmxnet3: coding: Introduce VMXNET3Class

Introduce a class type for vmxnet3, and the usual
DEVICE_CLASS/DEVICE_GET_CLASS macros.

No semantic change.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: Introduce 'x-old-msi-offsets' back-compat property
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:37 +0000 (09:17 +0200)]
vmxnet3: Introduce 'x-old-msi-offsets' back-compat property

Following the previous patches, where vmxnet3's pci's msi/msix
capability offsets and msix's PBA table offsets have been changed, this
patch introduces a boolean property 'x-old-msi-offsets' to vmxnet3,
whose default is false.

Setting 'x-old-msi-offsets' to 'on' preserves the old offsets behavior,
which allows migration to older versions.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: Change the offset of the MSIX PBA table
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:36 +0000 (09:17 +0200)]
vmxnet3: Change the offset of the MSIX PBA table

Place the PBA table at 0x1000, as placed by VMware virtual hardware.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agovmxnet3: Change offsets of msi/msix pci capabilities
Shmulik Ladkani [Thu, 24 Dec 2015 07:17:35 +0000 (09:17 +0200)]
vmxnet3: Change offsets of msi/msix pci capabilities

Place device reported PCI capabilities at the same offsets as placed by
the VMware virtual hardware: MSI at [84], MSI-X at [9c].

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/filter: fix nf->netdev_id leak
Li Zhijian [Wed, 23 Dec 2015 07:43:18 +0000 (15:43 +0800)]
net/filter: fix nf->netdev_id leak

Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/dump: fix nfds->filename leak
Li Zhijian [Wed, 23 Dec 2015 07:43:19 +0000 (15:43 +0800)]
net/dump: fix nfds->filename leak

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION
Miao Yan [Wed, 23 Dec 2015 06:06:11 +0000 (22:06 -0800)]
net/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION

VMXNET3_DEVICE_VERSION is used as return value for accessing
UPT Revision Report and Selection register. So rename it
to VMXNET3_UPT_REVISION.

Signed-off-by: Miao Yan <yanmiaoebest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: return 0 on unknown command
Miao Yan [Wed, 23 Dec 2015 06:06:10 +0000 (22:06 -0800)]
net/vmxnet3: return 0 on unknown command

Return 0 on unknown command, this is what esxi (5.x+) behaves.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO
Miao Yan [Wed, 23 Dec 2015 06:06:09 +0000 (22:06 -0800)]
net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO

VMXNET3_CMD_GET_DEV_EXTRA_INFO should return 0 for emulation
mode

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server (5.x+)
2) modify vmxnet3 Linux driver to read the register:

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DEV_EXTRA_INFO);
  ret =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
  pr_info("vmxnet3 dev_info: 0x%x\n", ret);

The kernel log will have some like the following message:

  [ 7005.111170] vmxnet3 dev_info: 0x0

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command
Miao Yan [Wed, 23 Dec 2015 06:06:08 +0000 (22:06 -0800)]
net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command

VMXNET3_CMD_GET_DID_LO should return PCI ID of the device
and VMXNET3_CMD_GET_DID_HI should return vmxnet3 revision ID.

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server (5.x+)
2) modify vmxnet3 Linux driver to read DID_HI and DID_LO:

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_LO);
  lo =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_HI);
  high =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
  pr_info("vmxnet3 DID lo: 0x%x, high: 0x%x\n", lo, high);

The kernel log will have something like the following message:

  [ 7005.111170] vmxnet3 DID lo: 0x7b0, high: 0x1

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: return 1 on device activation failure
Miao Yan [Wed, 23 Dec 2015 06:06:07 +0000 (22:06 -0800)]
net/vmxnet3: return 1 on device activation failure

When reading device status, 0 means device is successfully
activated and 1 means error.

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server (5.5+)
2) modify vmxnet3 Linux driver to give it an invalid
   address to 'adapter->shared_pa' which is the
   shared memory for guest/host communication

This will trigger device activation failure and kernel
log will have the following message:

   [ 7138.403256] vmxnet3 0000:03:00.0 eth1: Failed to activate dev: error 1

So return 1 on device activation failure instead of -1;

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agoMAINTAINERS: Add an entry for the net/slirp.c file
Thomas Huth [Tue, 15 Dec 2015 08:48:15 +0000 (09:48 +0100)]
MAINTAINERS: Add an entry for the net/slirp.c file

The file net/slirp.c should be listed in the SLIRP section, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet: vmxnet3: avoid memory leakage in activate_device
P J P [Tue, 15 Dec 2015 06:57:54 +0000 (12:27 +0530)]
net: vmxnet3: avoid memory leakage in activate_device

Vmxnet3 device emulator does not check if the device is active
before activating it, also it did not free the transmit & receive
buffers while deactivating the device, thus resulting in memory
leakage on the host. This patch fixes both these issues to avoid
host memory leakage.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: remove redundant VMW_SHPRN(...) definition
Miao Yan [Tue, 8 Dec 2015 05:28:33 +0000 (21:28 -0800)]
net/vmxnet3: remove redundant VMW_SHPRN(...) definition

Macro VMW_SHPRN(...) is already defined vmxnet3_debug.h,
so remove the duplication

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: fix debug macro pattern for vmxnet3
Miao Yan [Tue, 8 Dec 2015 05:28:32 +0000 (21:28 -0800)]
net/vmxnet3: fix debug macro pattern for vmxnet3

Vmxnet3 uses the following debug macro style:

 #ifdef SOME_DEBUG
 #  define debug(...) do{ printf(...); } while (0)
 # else
 #  define debug(...) do{ } while (0)
 #endif

If SOME_DEBUG is undefined, then format string inside the
debug macro will never be checked by compiler. Code is
likely to break in the future when SOME_DEBUG is enabled
 because of lack of testing. This patch changes this
to the following:

 #define debug(...) \
  do { if (SOME_DEBUG_ENABLED) printf(...); } while (0)

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: use %zu for size_t in printf
Miao Yan [Tue, 8 Dec 2015 05:28:31 +0000 (21:28 -0800)]
net/vmxnet3: use %zu for size_t in printf

Use %zu specifier for size_t in printf, otherwise build would fail
on platforms where size_t is not unsigned long

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agonet/vmxnet3: fix a build error when enabling debug output
Miao Yan [Tue, 8 Dec 2015 05:28:30 +0000 (21:28 -0800)]
net/vmxnet3: fix a build error when enabling debug output

Macro MAC_FMT and MAC_ARG are not defined, but used in vmxnet3_net_init().
This will cause build error when debug level is raised in
vmxnet3_debug.h (enable all VMXNET3_DEBUG_xxx).

Use VMXNET_MF and VXMNET_MA instead.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
8 years agohw/ppc/spapr_rtc: Remove bad class_size value
Thomas Huth [Fri, 18 Dec 2015 09:06:14 +0000 (10:06 +0100)]
hw/ppc/spapr_rtc: Remove bad class_size value

class_size = sizeof(XICSStateClass) does not make much sense
in the RTC code and likely was just a copy-n-paste error.
Let's simply remove it.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agounicore32: convert get_sp_from_cpustate from macro to inline
Michael Tokarev [Tue, 29 Dec 2015 09:39:44 +0000 (12:39 +0300)]
unicore32: convert get_sp_from_cpustate from macro to inline

All other architectures define get_sp_from_cpustate as an inline function,
only unicore32 uses a #define.  With this, some usages are impossible, for
example, enabling sigaltstack in linux-user/syscall.c results in

linux-user/syscall.c: In function ‘do_syscall’:
linux-user/syscall.c:8299:39: error: dereferencing ‘void *’ pointer [-Werror]
  get_sp_from_cpustate(arg1, arg2, get_sp_from_cpustate((CPUArchState *)cpu_env));
                                       ^
linux-user/syscall.c:8299:39: error: request for member ‘regs’ in something not a structure or union

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8 years agovirtio: fix error message for number of queues
Cornelia Huck [Fri, 8 Jan 2016 10:00:00 +0000 (11:00 +0100)]
virtio: fix error message for number of queues

There's no such thing as "PCI queues" in the virtio core.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agoivshmem: Store file descriptor for vhost-user negotiation
Tetsuya Mukawa [Mon, 21 Dec 2015 03:47:34 +0000 (12:47 +0900)]
ivshmem: Store file descriptor for vhost-user negotiation

If virtio-net driver allocates memory in ivshmem shared memory,
vhost-net will work correctly, but vhost-user will not work because
a fd of shared memory will not be sent to vhost-user backend.
This patch fixes ivshmem to store file descriptor of shared memory.
It will be used when vhost-user negotiates vhost-user backend.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agomigration/virtio: Remove simple .get/.put use
Dr. David Alan Gilbert [Wed, 6 Jan 2016 12:23:39 +0000 (12:23 +0000)]
migration/virtio: Remove simple .get/.put use

The 'virtqueue_state' and 'ringsize' can be saved using VMSTATE
macros rather than hand coded .get/.put

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
8 years agoAdd VMSTATE_STRUCT_VARRAY_KNOWN
Dr. David Alan Gilbert [Wed, 6 Jan 2016 12:23:38 +0000 (12:23 +0000)]
Add VMSTATE_STRUCT_VARRAY_KNOWN

At the moment we have VMSTATE_STRUCT_ARRAY that requires
the field is declared as an array of fixed size.
We also have VMSTATE_STRUCT_VARRAY_UINT* that allows
a field declared as a pointer, but requires that the length
is a field member in the structure being loaded/saved.

VMSTATE_STRUCT_VARRAY_KNOWN is for arrays defined as pointers
yet we somehow know the length of.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
8 years agoi386/pc: expose identifying the floppy controller
Roman Kagan [Wed, 30 Dec 2015 20:11:51 +0000 (23:11 +0300)]
i386/pc: expose identifying the floppy controller

Factor out and expose the function to locate the floppy controller in
the system.
It will allow to dynamically populate the relevant objects in the ACPI
tables.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: qemu-block@nongnu.org
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
8 years agopc: acpi: remove unused ASL templates and related blobs/utils
Igor Mammedov [Mon, 28 Dec 2015 17:02:58 +0000 (18:02 +0100)]
pc: acpi: remove unused ASL templates and related blobs/utils

QEMU now uses internally composed DSDT so drop now
empty *.dsl templates and related *.generated
binary blobs.

Also since templates are not used anymore/obolete
remove utility scripts used for extracting/patching
AML blobs compiled by IASL and for updating them
in git tree.

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>
8 years agopc: acpi: switch to AML API composed DSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:57 +0000 (18:02 +0100)]
pc: acpi: switch to AML API composed DSDT

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>
8 years agopc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
Igor Mammedov [Mon, 28 Dec 2015 17:02:56 +0000 (18:02 +0100)]
pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT

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>