OSDN Git Service

qmiga/qemu.git
7 years agowin32: don't run subprocess tests on Mingw32 platform
Eduardo Habkost [Tue, 14 Jun 2016 16:00:23 +0000 (13:00 -0300)]
win32: don't run subprocess tests on Mingw32 platform

On Tue, Jun 14, 2016 at 04:44:57PM +0100, Daniel P. Berrange wrote:
> The g_test_trap_subprocess() method does not work on the
> Mingw32 platform, causing the test-qdev-global-props
> test case to abort
>
> (test-logging.exe:230): GLib-ERROR **: g_test_trap_subprocess()
> failed: Failed to execute helper program (No such file or directory)
>
> This failure was introduced a while ago in
>
>   commit 2177801a4899bf29108b3d471417a5b4d701ec29
>   Author: Eduardo Habkost <ehabkost@redhat.com>
>   Date:   Fri Aug 8 16:03:27 2014 -0300
>
>     test-qdev-global-props: Run tests on subprocess
>
> Modify the configure time check to avoid enabling this feature
> on Mingw, rather than trying to rewrite the test to avoid this
> feature.

I would do the following instead, just in case we have extra code
looking at $glib_subprocess one day.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agosheepdog: remove useless casts
Laurent Vivier [Wed, 15 Jun 2016 16:14:37 +0000 (18:14 +0200)]
sheepdog: remove useless casts

This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci

CC: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
CC: qemu-block@nongnu.org
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agofw_cfg: remove useless casts
Laurent Vivier [Wed, 15 Jun 2016 16:14:35 +0000 (18:14 +0200)]
fw_cfg: remove useless casts

This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci

CC: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotricore: remove useless cast
Laurent Vivier [Wed, 15 Jun 2016 16:14:34 +0000 (18:14 +0200)]
tricore: remove useless cast

This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci

CC: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agos390x: remove useless cast
Laurent Vivier [Wed, 15 Jun 2016 16:14:33 +0000 (18:14 +0200)]
s390x: remove useless cast

This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci

CC: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agolinux-user,s390x: remove useless cast
Laurent Vivier [Wed, 15 Jun 2016 16:14:32 +0000 (18:14 +0200)]
linux-user,s390x: remove useless cast

This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci

CC: Riku Voipio <riku.voipio@iki.fi>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agococcinelle: add a script to remove useless casts
Laurent Vivier [Wed, 15 Jun 2016 16:14:31 +0000 (18:14 +0200)]
coccinelle: add a script to remove useless casts

Script from LKML.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agocurl: Operate on zero-length file
Tomáš Golembiovský [Fri, 8 Jul 2016 11:18:09 +0000 (13:18 +0200)]
curl: Operate on zero-length file

Another attempt to fix the bug 1596870.

When creating new disk backed by remote file accessed via HTTPS and the
backing file has zero length, qemu-img terminates with uniformative
error message:

    qemu-img: disk.qcow2: CURL: Error opening file:

While it may not make much sense to operate on empty file, other block
backends (e.g. raw backend for regular files) seem to allow it. This
patch fixes it for the curl backend and improves the reported error.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoRemove unused function declarations
Ladi Prosek [Mon, 13 Jun 2016 14:20:48 +0000 (16:20 +0200)]
Remove unused function declarations

Unused function declarations were found using a simple gcc plugin and
manually verified by grepping the sources.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoivshmem: Delete duplicate debug message
Stefano Dong (董兴水) [Tue, 9 Aug 2016 22:38:34 +0000 (06:38 +0800)]
ivshmem: Delete duplicate debug message

Duplicated in commit ca0b756.  Delete it.

Signed-off-by: Stefano Dong (董兴水) <opensource.dxs@aliyun.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agosh4: fix broken link to documentation
Reda Sallahi [Wed, 31 Aug 2016 16:31:04 +0000 (18:31 +0200)]
sh4: fix broken link to documentation

The page that was previously linked in the source code and the README file is
no longer available so it now returns a 404 error message.

This puts a previous snapshot from archive.org instead.

Signed-off-by: Reda Sallahi <fullmanet@gmail.com>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: Fix up F: entry bit rot
Markus Armbruster [Mon, 5 Sep 2016 12:28:52 +0000 (14:28 +0200)]
MAINTAINERS: Fix up F: entry bit rot

include/hw/xilinx.h is gone since commit d5001cf, drop.

include/hw/*/xlnx*.c is a typo, change .c to .h.

include/hw/acpi/piix.h is a typo, change piix.h to piix4.h.

hw/i386/*dsl and scripts/acpi*py are gone since since commit 9fc6502,
drop.

hw/virtio/dataplane/* are gone since commit fee089e, drop.

ICC Bus is gone since commit dfeb867, drop.

block/raw-aio.h was moved to include/block/raw-aio.h in commit
0187f5c, update.

Tracked down with

    for i in `grep "^[FX]: " MAINTAINERS | sed "s/^.: //"`
    do if [ ! -e "$i" ]; then echo "$i"; fi
    done

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: Add include/sysemu/cpus.h
Thomas Huth [Fri, 9 Sep 2016 21:15:04 +0000 (23:15 +0200)]
MAINTAINERS: Add include/sysemu/cpus.h

This header seems to belong to the guest CPU section since it
contains prototypes for cpus.c.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: Add include/hw/sh4/ to SH4 section
Thomas Huth [Fri, 9 Sep 2016 21:18:21 +0000 (23:18 +0200)]
MAINTAINERS: Add include/hw/sh4/ to SH4 section

get_maintainer.pl now properly recognizes that the files in
include/hw/sh4/ belong to SH4.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: Add include/hw/tricore/ to TriCore section
Thomas Huth [Fri, 9 Sep 2016 21:17:09 +0000 (23:17 +0200)]
MAINTAINERS: Add include/hw/tricore/ to TriCore section

get_maintainer.pl now properly recognizes that the file in
include/hw/tricore/ belongs to TriCore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: Add include/hw/unicore32/ to UniCore32 section
Thomas Huth [Fri, 9 Sep 2016 21:16:03 +0000 (23:16 +0200)]
MAINTAINERS: Add include/hw/unicore32/ to UniCore32 section

get_maintainer.pl now properly recognizes that the file in
include/hw/unicore32/ belongs to UniCore32.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoui/console: Fix non-working backspace key in monitor of gtk UI
Thomas Huth [Thu, 11 Aug 2016 07:21:00 +0000 (09:21 +0200)]
ui/console: Fix non-working backspace key in monitor of gtk UI

In the QEMU monitor pane of the gtk user interface, the backspace
key is not working at all. This happens because of a missing mapping
of the key in the qcode_to_keysym[] table. Thus let's add an entry
there to get the backspace key working again.

Buglink: https://bugs.launchpad.net/qemu/+bug/1611979
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotcg: Remove duplicate header includes
Thomas Huth [Tue, 13 Sep 2016 13:45:39 +0000 (15:45 +0200)]
tcg: Remove duplicate header includes

host-utils.h and timer.h are included twice in tcg.c.
One time should be enough.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoRemove remainders of HPPA backend
Thomas Huth [Tue, 13 Sep 2016 14:25:52 +0000 (16:25 +0200)]
Remove remainders of HPPA backend

The HPPA backend has been removed by the following commit:

    802b5081233a6b643a8b135a5facaf14bafaa77d
    tcg-hppa: Remove tcg backend

But some small pieces of the HPPA backend still survived until
today. Since we also do not have support for a HPPA target in
QEMU, we can nowadays safely remove the remaining HPPA parts
(like the disassembler code, or the detection of HPPA in the
configure script).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoui/cocoa.m: Make a better about dialog
Programmingkid [Tue, 16 Aug 2016 02:11:06 +0000 (22:11 -0400)]
ui/cocoa.m: Make a better about dialog

The about dialog in QEMU on Mac OS X is very plain and unhelpful. This patch
makes the about dialog look a lot better and have some descriptive information
on what version of QEMU the user is running.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: ED59936E-3EB2-46AB-9E33-AB26E382B884@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Thu, 15 Sep 2016 09:24:22 +0000 (10:24 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* minor patches here and there
* MTTCG: lock-free TB lookup
* SCSI: bugfixes for MPTSAS, MegaSAS, LSI53c, vmw_pvscsi
* buffer_is_zero rewrite (except for one patch)
* chardev: qemu_chr_fe_write checks
* checkpatch improvement for markdown preformatted text
* default-configs cleanups
* atomics cleanups

# gpg: Signature made Tue 13 Sep 2016 18:14:30 BST
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# 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: (58 commits)
  cutils: Add generic prefetch
  cutils: Add SSE4 version
  cutils: Add test for buffer_is_zero
  cutils: Remove ppc buffer zero checking
  cutils: Remove aarch64 buffer zero checking
  cutils: Rearrange buffer_is_zero acceleration
  cutils: Export only buffer_is_zero
  cutils: Remove SPLAT macro
  cutils: Move buffer_is_zero and subroutines to a new file
  ppc: do not redefine CPUPPCState
  x86/lapic: Load LAPIC state at post_load
  optionrom: do not rely on compiler's bswap optimization
  checkpatch: Fix whitespace checks for documentation code blocks
  atomics: Use __atomic_*_n() variant primitives
  atomics: Remove redundant barrier()'s
  kvm-all: drop kvm_setup_guest_memory
  i8257: Make device "i8257" unavailable with -device
  Revert "megasas: remove useless check for cmd->frame"
  char: convert qemu_chr_fe_write to qemu_chr_fe_write_all
  hw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_all
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
 Conflicts:
cpus.c
tests/Makefile.include

7 years agocutils: Add generic prefetch
Richard Henderson [Mon, 29 Aug 2016 18:46:17 +0000 (11:46 -0700)]
cutils: Add generic prefetch

There's no real knowledge of the cacheline size,
just prefetching one loop ahead.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1472496380-19706-7-git-send-email-rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Add SSE4 version
Paolo Bonzini [Tue, 13 Sep 2016 15:04:52 +0000 (17:04 +0200)]
cutils: Add SSE4 version

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Add test for buffer_is_zero
Richard Henderson [Mon, 29 Aug 2016 18:46:16 +0000 (11:46 -0700)]
cutils: Add test for buffer_is_zero

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1472496380-19706-6-git-send-email-rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Remove ppc buffer zero checking
Richard Henderson [Mon, 29 Aug 2016 18:46:20 +0000 (11:46 -0700)]
cutils: Remove ppc buffer zero checking

For ppc64le, gcc6 does extremely poorly with the Altivec code.
Moreover, on POWER7 and POWER8, a hand-optimized Altivec version
turns out to be no faster than the revised integer version, and
therefore not worth the effort.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Remove aarch64 buffer zero checking
Richard Henderson [Mon, 29 Aug 2016 18:46:19 +0000 (11:46 -0700)]
cutils: Remove aarch64 buffer zero checking

The revised integer version is 4 times faster than the neon version
on an AppliedMicro Mustang.  Even with hand scheduling and additional
unrolling I cannot make any neon version run as fast as the integer.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Rearrange buffer_is_zero acceleration
Richard Henderson [Mon, 29 Aug 2016 18:46:15 +0000 (11:46 -0700)]
cutils: Rearrange buffer_is_zero acceleration

Allow selection of several acceleration functions
based on the size and alignment of the buffer.
Do not require ifunc support for AVX2 acceleration.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1472496380-19706-5-git-send-email-rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Export only buffer_is_zero
Richard Henderson [Mon, 29 Aug 2016 18:46:14 +0000 (11:46 -0700)]
cutils: Export only buffer_is_zero

Since the two users don't make use of the returned offset,
beyond ensuring that the entire buffer is zero, consider the
can_use_buffer_find_nonzero_offset and buffer_find_nonzero_offset
functions internal.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1472496380-19706-4-git-send-email-rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Remove SPLAT macro
Richard Henderson [Mon, 29 Aug 2016 18:46:13 +0000 (11:46 -0700)]
cutils: Remove SPLAT macro

This is unused and complicates the vector interface.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1472496380-19706-3-git-send-email-rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocutils: Move buffer_is_zero and subroutines to a new file
Richard Henderson [Mon, 29 Aug 2016 18:46:12 +0000 (11:46 -0700)]
cutils: Move buffer_is_zero and subroutines to a new file

Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1472496380-19706-2-git-send-email-rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoppc: do not redefine CPUPPCState
Paolo Bonzini [Tue, 13 Sep 2016 16:42:38 +0000 (18:42 +0200)]
ppc: do not redefine CPUPPCState

Just include the file that is supposed to bring it in.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agox86/lapic: Load LAPIC state at post_load
Dr. David Alan Gilbert [Mon, 12 Sep 2016 17:18:35 +0000 (18:18 +0100)]
x86/lapic: Load LAPIC state at post_load

Load the LAPIC state during post_load (rather than when the CPU
starts).

This allows an interrupt to be delivered from the ioapic to
the lapic prior to cpu loading, in particular the RTC that starts
ticking as soon as we load it's state.

Fixes a case where Windows hangs after migration due to RTC interrupts
disappearing.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agooptionrom: do not rely on compiler's bswap optimization
Paolo Bonzini [Fri, 2 Sep 2016 15:36:23 +0000 (17:36 +0200)]
optionrom: do not rely on compiler's bswap optimization

Recent compilers can detect and inline manually-written bswap code,
but GCC 4.2.1 (the last GPLv2 version) cannot and generates really
awful code.  Depending on how the compiler is configured, it might
also not want to generate bswap because it was not in i386.  Using
asm is fine because TCG knows about bswap and all processors with
virtualization extensions also do.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocheckpatch: Fix whitespace checks for documentation code blocks
Lluís Vilanova [Wed, 7 Sep 2016 12:49:04 +0000 (14:49 +0200)]
checkpatch: Fix whitespace checks for documentation code blocks

Prevent blank lines in documentation code blocks to be signalled as
incorrect trailing whitespace.

Code blocks in documentation are 4-column aligned, and blank lines in
them should have exactly 4 columns of trailing whitespace to prevent
QEMU's wiki to render them as separate code blocks.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-Id: <147325254382.22644.5531276787733455773.stgit@fimbulvetr.bsc.es>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
7 years agoatomics: Use __atomic_*_n() variant primitives
Pranith Kumar [Mon, 29 Aug 2016 17:17:01 +0000 (13:17 -0400)]
atomics: Use __atomic_*_n() variant primitives

Use the __atomic_*_n() primitives which take the value as argument. It
is not necessary to store the value locally before calling the
primitive, hence saving us a stack store and load.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Message-Id: <20160829171701.14025-1-bobby.prani@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoatomics: Remove redundant barrier()'s
Pranith Kumar [Wed, 24 Aug 2016 20:44:23 +0000 (16:44 -0400)]
atomics: Remove redundant barrier()'s

Remove the redundant barrier() after the fence as agreed in previous
discussion here:
https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg00489.html

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Message-Id: <20160824204424.14041-3-bobby.prani@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agokvm-all: drop kvm_setup_guest_memory
Cao jin [Mon, 12 Sep 2016 06:34:56 +0000 (14:34 +0800)]
kvm-all: drop kvm_setup_guest_memory

kvm_setup_guest_memory only does "madvise to QEMU_MADV_DONTFORK" and
is only called by ram_block_add, which actually is duplicate code.
Bonus: add simple comment for kvm_has_sync_mmu to make life easier.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1473662096-32598-1-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoi8257: Make device "i8257" unavailable with -device
Markus Armbruster [Wed, 31 Aug 2016 16:15:51 +0000 (18:15 +0200)]
i8257: Make device "i8257" unavailable with -device

The ISA DMA controller needs to be wired up to the ISA bus by
isa_bus_dma() to actually work.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1472660151-19517-1-git-send-email-armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoRevert "megasas: remove useless check for cmd->frame"
Paolo Bonzini [Thu, 8 Sep 2016 15:42:53 +0000 (17:42 +0200)]
Revert "megasas: remove useless check for cmd->frame"

This reverts commit 8cc46787b5b58f01a11c919c7ff939ed009e27fc.
It turns out that cmd->frame can be NULL and thus the commit
can cause a SIGSEGV

Reported-by: Holger Schranz <holger@fam-schranz.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agochar: convert qemu_chr_fe_write to qemu_chr_fe_write_all
Daniel P. Berrange [Tue, 6 Sep 2016 13:56:05 +0000 (14:56 +0100)]
char: convert qemu_chr_fe_write to qemu_chr_fe_write_all

The mux chardev was not checking the return value of any
qemu_chr_fe_write() call so would silently loose data
on EAGAIN.

Similarly the qemu_chr_fe_printf method would not check
errors and was not in a position to retry even if it
could check.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473170165-540-5-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agohw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_all
Daniel P. Berrange [Tue, 6 Sep 2016 13:56:04 +0000 (14:56 +0100)]
hw: replace most use of qemu_chr_fe_write with qemu_chr_fe_write_all

The qemu_chr_fe_write method will return -1 on EAGAIN if the
chardev backend write would block. Almost no callers of the
qemu_chr_fe_write() method check the return value, instead
blindly assuming data was successfully sent. In most cases
this will lead to silent data loss on interactive consoles,
but in some cases (eg RNG EGD) it'll just cause corruption
of the protocol being spoken.

We unfortunately can't fix the virtio-console code, due to
a bug in the Linux guest drivers, which would cause the
entire Linux kernel to hang if we delay processing of the
incoming data in any way. Fixing this requires first fixing
the guest driver to not hold spinlocks while writing to the
hvc device backend.

Fixes bug: https://bugs.launchpad.net/qemu/+bug/1586756

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473170165-540-4-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agosclpconsolelm: remove bogus check for -EAGAIN
Daniel P. Berrange [Tue, 6 Sep 2016 13:56:03 +0000 (14:56 +0100)]
sclpconsolelm: remove bogus check for -EAGAIN

The write_console_data() method in sclpconsole-lm.c checks
whether the return value of qemu_chr_fe_write() has the
value of -EAGAIN and if so then increments the buffer offset
by the value of EAGAIN. Fortunately qemu_chr_fe_write() will
never return EAGAIN directly, rather it returns -1 with
errno set to EAGAIN, so this broken code path was not
reachable. The behaviour on EAGAIN was stil bad though,
causing the write_console_data() to busy_wait repeatedly
calling qemu_chr_fe_write() with no sleep between iters.

Just remove all this loop logic and replace with a call
to qemu_chr_fe_write_all().

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473170165-540-3-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoipmi: check return of qemu_chr_fe_write() for errors
Daniel P. Berrange [Tue, 6 Sep 2016 13:56:02 +0000 (14:56 +0100)]
ipmi: check return of qemu_chr_fe_write() for errors

The continue_send() method in ipmi_bmc_extern.c directly
assigns the return value of qemu_chr_fe_write() to the
variable tracking the I/O buffer offset. This ignores the
possibility that the return value could be -1 and so will
cause I/O go backwards on EAGAIN. Fortunately 'outpos' is
unsigned, so can't go negative - it will become MAX_INT
which will cause the loop to stop, and avoid an accidental
out of bounds array access.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473170165-540-2-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agodefault-configs: remove CONFIG_PIIX_PCI
Daniel P. Berrange [Mon, 5 Sep 2016 17:25:20 +0000 (18:25 +0100)]
default-configs: remove CONFIG_PIIX_PCI

The CONFIG_PIIX_PCI=y setting was added in

  commit 70615c38ded2a20ad8282b7dcde95482fc0a7744
  Author: Blue Swirl <blauwirbel@gmail.com>
  Date:   Mon Mar 22 20:18:40 2010 +0000

    Compile sound devices only once

but nothing in that commit, nor anything pre-existing,
ever referenced CONFIG_PIIX_PCI.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473096320-1638-4-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agodefault-configs: removed obsolete CONFIG_ISA_MMIO
Daniel P. Berrange [Mon, 5 Sep 2016 17:25:19 +0000 (18:25 +0100)]
default-configs: removed obsolete CONFIG_ISA_MMIO

The use of the CONFIG_ISA_MMIO setting was removed in

  commit 61fcb628627ea464dc1954f615ae13edfefd284f
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   Mon Jul 22 15:54:24 2013 +0200

    isa_mmio: delete

but this commit only removed it from some of the default
config files.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473096320-1638-3-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agodefault-configs: remove CONFIG_PAM
Daniel P. Berrange [Mon, 5 Sep 2016 17:25:18 +0000 (18:25 +0100)]
default-configs: remove CONFIG_PAM

The CONFIG_PAM=y setting was added in

  commit c0907c9e6417cb959dfd9ef6873221536ec91351
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   Tue Feb 5 15:06:20 2013 +0100

    hw: move PCI bridges to hw/pci-* or hw/ARCH

but nothing in that commit, nor anything pre-existing,
ever referenced CONFIG_PAM.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1473096320-1638-2-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi: pvscsi: limit loop to fetch SG list
Prasad J Pandit [Mon, 5 Sep 2016 20:50:43 +0000 (02:20 +0530)]
scsi: pvscsi: limit loop to fetch SG list

In PVSCSI paravirtual SCSI bus, pvscsi_convert_sglist can take a very
long time or go into an infinite loop due to two different bugs:

1) the request descriptor data length is defined to be 64 bit. While
building SG list from a request descriptor, it gets truncated to 32bit
in routine 'pvscsi_convert_sglist'. This could lead to an infinite loop
situation large 'dataLen' values when data_length is cast to uint32_t and
chunk_size becomes always zero.  Fix this by removing the incorrect cast.

2) pvscsi_get_next_sg_elem can be called arbitrarily many times if the
element has a zero length.  Get out of the loop early when this happens,
by introducing an upper limit on the number of SG list elements.

Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <1473108643-12983-1-git-send-email-ppandit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoMAINTAINERS: Add some header files to the PC chipset section
Thomas Huth [Mon, 5 Sep 2016 21:31:15 +0000 (23:31 +0200)]
MAINTAINERS: Add some header files to the PC chipset section

These header files obviously belong to the PC chipset (since
their names match the other .c files in this section).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1473111075-25311-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoMAINTAINERS: Fix wildcard for scsi headers
Thomas Huth [Mon, 5 Sep 2016 20:11:41 +0000 (22:11 +0200)]
MAINTAINERS: Fix wildcard for scsi headers

get_maintainer.pl currently thinks that the scsi headers are
currrently unmaintained. So let's fix the corresponding wildcard
expression.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1473106301-23102-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agochardev: Add 'help' option to print all available chardev backend types
Lin Ma [Tue, 16 Aug 2016 17:13:52 +0000 (01:13 +0800)]
chardev: Add 'help' option to print all available chardev backend types

Signed-off-by: Lin Ma <lma@suse.com>
Message-Id: <20160816171352.17021-1-lma@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agodoc/rcu: fix typo
Cao jin [Thu, 1 Sep 2016 02:21:19 +0000 (10:21 +0800)]
doc/rcu: fix typo

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1472696479-3619-1-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agovmxcap: Add TSC scaling bit
Eduardo Habkost [Fri, 26 Aug 2016 03:10:25 +0000 (23:10 -0400)]
vmxcap: Add TSC scaling bit

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1472181025-10889-3-git-send-email-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agovmxcap: Show raw MSR value
Eduardo Habkost [Fri, 26 Aug 2016 03:10:24 +0000 (23:10 -0400)]
vmxcap: Show raw MSR value

This will be helpful to allow checking of bits that are not in
the 'bits' table yet.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1472181025-10889-2-git-send-email-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK
Paolo Bonzini [Mon, 29 Aug 2016 09:35:37 +0000 (11:35 +0200)]
scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK

These issues cause respectively a QEMU crash and a leak of 2 bytes of
stack.  They were discovered by VictorV of 360 Marvel Team.

Reported-by: Tom Victor <i-tangtianwen@360.cm>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi: mptconfig: fix an assert expression
Prasad J Pandit [Wed, 31 Aug 2016 12:06:07 +0000 (17:36 +0530)]
scsi: mptconfig: fix an assert expression

When LSI SAS1068 Host Bus emulator builds configuration page
headers, mptsas_config_pack() should assert that the size
fits in a byte.  However, the size is expressed in 32-bit
units, so up to 1020 bytes fit.  The assertion was only
allowing replies up to 252 bytes, so fix it.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <1472645167-30765-2-git-send-email-ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agovmw_pvscsi: check page count while initialising descriptor rings
Prasad J Pandit [Wed, 31 Aug 2016 06:49:29 +0000 (12:19 +0530)]
vmw_pvscsi: check page count while initialising descriptor rings

Vmware Paravirtual SCSI emulation uses command descriptors to
process SCSI commands. These descriptors come with their ring
buffers. A guest could set the page count for these rings to
an arbitrary value, leading to infinite loop or OOB access.
Add check to avoid it.

Reported-by: Tom Victor <vv474172261@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <1472626169-12989-1-git-send-email-ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi-disk: change disk serial length from 20 to 36
Rony Weng [Mon, 29 Aug 2016 07:52:18 +0000 (15:52 +0800)]
scsi-disk: change disk serial length from 20 to 36

Openstack Cinder assigns volume a 36 characters uuid as serial.
QEMU will shrinks the uuid to 20 characters, which does not match
the original uuid.

Note that there is no limit to the length of the serial number in
the SCSI spec.  20 was copy-pasted from virtio-blk which in turn was
copy-pasted from ATA; 36 is even more arbitrary.  However, bumping it
up too much might cause issues (e.g. 252 seems to make sense because
then the maximum amount of returned data is 256; but who knows there's
no off-by-one somewhere for such a nicely rounded number).

Signed-off-by: Rony Weng <ronyweng@synology.com>
Message-Id: <1472457138-23386-1-git-send-email-ronyweng@synology.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoMAINTAINERS: add myself as stubs maintainers
Paolo Bonzini [Wed, 24 Aug 2016 14:04:56 +0000 (16:04 +0200)]
MAINTAINERS: add myself as stubs maintainers

Let's just remove some files from the pool of unmaintained files.
I am obviously not going to send pull requests only for stubs/, but
I will ack them if maintainers want that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agolsi: never set DMA FIFO Empty (DFE) bit in DSTAT register
Hervé Poussineau [Thu, 18 Aug 2016 07:31:29 +0000 (09:31 +0200)]
lsi: never set DMA FIFO Empty (DFE) bit in DSTAT register

53C895A datasheet says:
"This bit (DFE) is a pure status bit and will not cause an interrupt"

This bit is already auto-generated in lsi_read_reg when reading the DSTAT register.

This fixes IBM RS/6000 7020 firmware, which is:
- resetting the adapter
- enabling all interrupt sources (including DIP, ie interrupts from DSTAT)
- waiting for ISTAT0 to become 0 (including DIP=0, ie no interrupt coming from DSTAT)

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <1471505489-1221-5-git-send-email-hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
7 years agolsi: implement I/O memory space for Memory Move instructions
Hervé Poussineau [Thu, 18 Aug 2016 07:31:28 +0000 (09:31 +0200)]
lsi: implement I/O memory space for Memory Move instructions

Memory Move instructions can read/write data either from PCI memory or from PCI I/O.
Implement second case.

Windows 98 now works with LSI 53C810A adapter.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <1471505489-1221-4-git-send-email-hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
7 years agolsi: do not exit QEMU if reading invalid register
Hervé Poussineau [Thu, 18 Aug 2016 07:31:27 +0000 (09:31 +0200)]
lsi: do not exit QEMU if reading invalid register

When guest accesses invalid register, return 0xff instead of exiting.
Also add a log when reading or writing invalid registers.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <1471505489-1221-3-git-send-email-hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
7 years agolsi: print register names in debug prints
Hervé Poussineau [Thu, 18 Aug 2016 07:31:26 +0000 (09:31 +0200)]
lsi: print register names in debug prints

Modify lsi_reg_readb function to have a single exit point. Debug print can now
contain the returned value.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <1471505489-1221-2-git-send-email-hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
7 years agohelp: Update help to remove misleading display information
Colin Lord [Fri, 12 Aug 2016 19:30:48 +0000 (15:30 -0400)]
help: Update help to remove misleading display information

Updates the help messages to remove misleading information about SDL
being the normal display used.

Signed-off-by: Colin Lord <cdlord2@illinois.edu>
Message-Id: <1471030248-21637-1-git-send-email-cdlord2@illinois.edu>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus: update comments
Cao jin [Fri, 29 Jul 2016 11:05:38 +0000 (19:05 +0800)]
cpus: update comments

The returned value of cpu_get_clock() is plused with the offset,
so it is the time elapsed in virtual machine when vm is active.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1469790338-28990-4-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus: rename local variable to meaningful one
Cao jin [Fri, 29 Jul 2016 11:05:37 +0000 (19:05 +0800)]
cpus: rename local variable to meaningful one

The function actually returns monotonic time value in nanosecond,
the "ticks" is not suitable.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc  Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1469790338-28990-3-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotimer: update comments
Cao jin [Fri, 29 Jul 2016 11:05:36 +0000 (19:05 +0800)]
timer: update comments

The comments is outdated. The patch has following changes:
1. tense correction.
2. all clock time value is returned in nanoseconds, so, they are same in
precision.
3. virtual clock doesn't use cpu cycles.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1469790338-28990-2-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agorules.mak: Don't extract libs from .mo-libs in link command
Fam Zheng [Wed, 27 Jul 2016 06:26:15 +0000 (14:26 +0800)]
rules.mak: Don't extract libs from .mo-libs in link command

For module build, .mo objects are passed to LINK and consumed in
process-archive-undefs. The reason behind that is documented in the
comment above process-archive-undefs.

Similarly, extract-libs should be called with .mo filtered out too.
Otherwise, the .mo-libs are added to the link command incorrectly,
spoiling the purpose of modularization.

Currently we don't have any .mo-libs usage, but it will be used soon
when we modularize more multi-source objects, like sdl and gtk.

Reported-by: Colin Lord <clord@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1469600777-30413-2-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: rename tb_find_physical()
Sergey Fedorov [Fri, 15 Jul 2016 17:58:52 +0000 (20:58 +0300)]
tcg: rename tb_find_physical()

In fact, this function does not exactly perform a lookup by physical
address as it is descibed for comment on get_page_addr_code(). Thus
it may be a bit confusing to have "physical" in it's name. So rename it
to tb_htable_lookup() to better reflect its actual functionality.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <20160715175852.30749-13-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Merge tb_find_slow() and tb_find_fast()
Sergey Fedorov [Fri, 15 Jul 2016 17:58:51 +0000 (20:58 +0300)]
tcg: Merge tb_find_slow() and tb_find_fast()

These functions are not too big and can be merged together. This makes
locking scheme more clear and easier to follow.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20160715175852.30749-12-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Avoid bouncing tb_lock between tb_gen_code() and tb_add_jump()
Sergey Fedorov [Fri, 15 Jul 2016 17:58:50 +0000 (20:58 +0300)]
tcg: Avoid bouncing tb_lock between tb_gen_code() and tb_add_jump()

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20160715175852.30749-11-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: cpu-exec: remove tb_lock from the hot-path
Alex Bennée [Fri, 15 Jul 2016 17:58:49 +0000 (20:58 +0300)]
tcg: cpu-exec: remove tb_lock from the hot-path

Lock contention in the hot path of moving between existing patched
TranslationBlocks is the main drag in multithreaded performance. This
patch pushes the tb_lock() usage down to the two places that really need
it:

  - code generation (tb_gen_code)
  - jump patching (tb_add_jump)

The rest of the code doesn't really need to hold a lock as it is either
using per-CPU structures, atomically updated or designed to be used in
concurrent read situations (qht_lookup).

To keep things simple I removed the #ifdef CONFIG_USER_ONLY stuff as the
locks become NOPs anyway until the MTTCG work is completed.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <20160715175852.30749-10-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: set up tb->page_addr before insertion
Alex Bennée [Fri, 15 Jul 2016 17:58:48 +0000 (20:58 +0300)]
tcg: set up tb->page_addr before insertion

This ensures that if we find the TB on the slow path that tb->page_addr
is correctly set before being tested.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <20160715175852.30749-9-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Prepare TB invalidation for lockless TB lookup
Paolo Bonzini [Tue, 19 Jul 2016 06:36:18 +0000 (08:36 +0200)]
tcg: Prepare TB invalidation for lockless TB lookup

When invalidating a translation block, set an invalid flag into the
TranslationBlock structure first.  It is also necessary to check whether
the target TB is still valid after acquiring 'tb_lock' but before calling
tb_add_jump() since TB lookup is to be performed out of 'tb_lock' in
future. Note that we don't have to check 'last_tb'; an already invalidated
TB will not be executed anyway and it is thus safe to patch it.

Suggested-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Prepare safe access to tb_flushed out of tb_lock
Sergey Fedorov [Fri, 15 Jul 2016 17:58:44 +0000 (20:58 +0300)]
tcg: Prepare safe access to tb_flushed out of tb_lock

Ensure atomicity and ordering of CPU's 'tb_flushed' access for future
translation block lookup out of 'tb_lock'.

This field can only be touched from another thread by tb_flush() in user
mode emulation. So the only access to be sequential atomic is:
 * a single write in tb_flush();
 * reads/writes out of 'tb_lock'.

In future, before enabling MTTCG in system mode, tb_flush() must be safe
and this field becomes unnecessary.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20160715175852.30749-5-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Prepare safe tb_jmp_cache lookup out of tb_lock
Sergey Fedorov [Fri, 15 Jul 2016 17:58:43 +0000 (20:58 +0300)]
tcg: Prepare safe tb_jmp_cache lookup out of tb_lock

Ensure atomicity of CPU's 'tb_jmp_cache' access for future translation
block lookup out of 'tb_lock'.

Note that this patch does *not* make CPU's TLB invalidation safe if it
is done from some other thread while the CPU is in its execution loop.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20160715175852.30749-4-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Pass last_tb by value to tb_find_fast()
Sergey Fedorov [Fri, 15 Jul 2016 17:58:42 +0000 (20:58 +0300)]
tcg: Pass last_tb by value to tb_find_fast()

This is a small clean up. tb_find_fast() is a final consumer of this
variable so no need to pass it by reference. 'last_tb' is always updated
by subsequent cpu_loop_exec_tb() in cpu_exec().

This change also simplifies calling cpu_exec_nocache() in
cpu_handle_exception().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <20160715175852.30749-3-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoutil: fix some coding style issue
Cao jin [Thu, 28 Jul 2016 08:54:33 +0000 (16:54 +0800)]
util: fix some coding style issue

Fix some coding style issues found in removing NonBlockingConnectHandler.

Cc: Daniel P. Berrange <berrange@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reviwed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1469696074-12744-3-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoutil/qemu-sockets: revert Yoda Conditions to normal
Cao jin [Thu, 28 Jul 2016 10:50:04 +0000 (18:50 +0800)]
util/qemu-sockets: revert Yoda Conditions to normal

Follow CODING_STYLE

Cc: Daniel P. Berrange <berrange@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Message-Id: <1469703004-14800-1-git-send-email-caoj.fnst@cn.fujitsu.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoqtail: clean up direct access to tqe_prev field
Igor Mammedov [Mon, 25 Jul 2016 12:47:12 +0000 (14:47 +0200)]
qtail: clean up direct access to tqe_prev field

instead of accessing tqe_prev field dircetly outside
of queue.h use macros to check if element is in list
and make sure that afer element is removed from list
tqe_prev field could be used to do the same check.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1469450832-84343-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging
Peter Maydell [Tue, 13 Sep 2016 16:55:35 +0000 (17:55 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging

trivial patches for 2016-09-13

# gpg: Signature made Tue 13 Sep 2016 16:53:11 BST
# gpg:                using RSA key 0x701B4F6B1A693E59
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* remotes/mjt/tags/trivial-patches-fetch:
  hw/net/e1000e: Fix compiler warning
  target-m68k: fix get_mac_extf helper
  timer/cpus: fix some typos and update some comments
  timer.h: fix inconsistency between comment and function prototype
  timer.h: fix typo
  maint: Ignore generated version file
  Document that curses usually needs -k option too
  trace-event: display "%d" instead of "0x%d"
  linux-user, trivial: display "0x%x" instead of "0x%d"
  pic: fix typo in error message: KVM_GET_IRQCHIP -> KVM_SET_IRQCHIP
  sparc: Use g_memdup() instead of g_new0() + memcpy()
  vl: remove unnecessary duplicate call to tpm_cleanup
  arm: spelling fix: mismatch
  hw/dma/omap: spelling fix: endianness
  hw/bt/hci: spelling fix: endianness
  docs: Fix description of the leaky bucket algorithm in throttle.txt

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agohw/net/e1000e: Fix compiler warning
Changlong Xie [Mon, 25 Jul 2016 03:48:00 +0000 (11:48 +0800)]
hw/net/e1000e: Fix compiler warning

slave:~/.xie/qemu-colo # gcc --version
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]

slave:~/.xie/qemu-colo # make -j8
CC    hw/net/e1000e_core.o
hw/net/e1000e_core.c:56: warning: ‘e1000e_set_interrupt_cause’ declared inline after being called
hw/net/e1000e_core.c:56: warning: previous declaration of ‘e1000e_set_interrupt_cause’ was here
LINK  x86_64-softmmu/qemu-system-x86_64

Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotarget-m68k: fix get_mac_extf helper
Paolo Bonzini [Fri, 15 Jul 2016 15:29:22 +0000 (17:29 +0200)]
target-m68k: fix get_mac_extf helper

val is assigned twice; the second one should be combined with "|".
Reported by Coverity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotimer/cpus: fix some typos and update some comments
Cao jin [Fri, 8 Jul 2016 10:31:37 +0000 (18:31 +0800)]
timer/cpus: fix some typos and update some comments

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotimer.h: fix inconsistency between comment and function prototype
Cao jin [Thu, 7 Jul 2016 13:27:35 +0000 (21:27 +0800)]
timer.h: fix inconsistency between comment and function prototype

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotimer.h: fix typo
Cao jin [Thu, 7 Jul 2016 10:15:58 +0000 (18:15 +0800)]
timer.h: fix typo

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agomaint: Ignore generated version file
Eric Blake [Wed, 8 Jun 2016 20:26:59 +0000 (14:26 -0600)]
maint: Ignore generated version file

Commit 67a1de0d created a generated version file, and, in some
circumstances, also a temporary file.  Make sure 'git add .'
won't check them into the repository.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoDocument that curses usually needs -k option too
Samuel Thibault [Wed, 22 Jun 2016 15:48:31 +0000 (17:48 +0200)]
Document that curses usually needs -k option too

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotrace-event: display "%d" instead of "0x%d"
Laurent Vivier [Wed, 22 Jun 2016 15:34:02 +0000 (17:34 +0200)]
trace-event: display "%d" instead of "0x%d"

Display the slot number of mhp_pc_dimm_assigned_slot()
using "%d" without the "0x".

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agolinux-user, trivial: display "0x%x" instead of "0x%d"
Laurent Vivier [Mon, 20 Jun 2016 09:51:32 +0000 (11:51 +0200)]
linux-user, trivial: display "0x%x" instead of "0x%d"

Display an exception number, generally defined as an hexadecimal
number (for instance, EXCP_HLT is 0x10001).

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agopic: fix typo in error message: KVM_GET_IRQCHIP -> KVM_SET_IRQCHIP
Bruce Rogers [Fri, 17 Jun 2016 15:08:16 +0000 (09:08 -0600)]
pic: fix typo in error message: KVM_GET_IRQCHIP -> KVM_SET_IRQCHIP

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agosparc: Use g_memdup() instead of g_new0() + memcpy()
Thomas Huth [Thu, 16 Jun 2016 17:33:38 +0000 (19:33 +0200)]
sparc: Use g_memdup() instead of g_new0() + memcpy()

There is no need to make sure that the memory is zeroed after the
allocation if we also immediatly fill the whole buffer afterwards
with memcpy(). Thus g_new0 should be g_new instead. But since we
are also doing a memcpy() here, we can also simply replace both
with g_memdup() instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-By: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agovl: remove unnecessary duplicate call to tpm_cleanup
Paolo Bonzini [Thu, 16 Jun 2016 12:25:04 +0000 (14:25 +0200)]
vl: remove unnecessary duplicate call to tpm_cleanup

tpm_cleanup is called from main() and also registered with atexit from
tpm_init.  The function only visits the tpm_backends linked list, and the
atexit registration happens right after tpm_init fills in the list from
-tpmdev options.  Therefore, the direct call is unnecessary.  Remove it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoarm: spelling fix: mismatch
Michael Tokarev [Mon, 13 Jun 2016 09:55:57 +0000 (12:55 +0300)]
arm: spelling fix: mismatch

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agohw/dma/omap: spelling fix: endianness
Michael Tokarev [Mon, 13 Jun 2016 09:40:25 +0000 (12:40 +0300)]
hw/dma/omap: spelling fix: endianness

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agohw/bt/hci: spelling fix: endianness
Michael Tokarev [Mon, 13 Jun 2016 09:42:27 +0000 (12:42 +0300)]
hw/bt/hci: spelling fix: endianness

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agodocs: Fix description of the leaky bucket algorithm in throttle.txt
Alberto Garcia [Wed, 8 Jun 2016 10:54:48 +0000 (13:54 +0300)]
docs: Fix description of the leaky bucket algorithm in throttle.txt

Commit 0bab0ebb17759c926bd48fd396bd8cbb2c8e4a3e was supposed to fix
a mistake in the description of the leaky bucket algorithm, but the
version that finally landed after the review process was incorrect.

This patch solves that problem and hopefully clarifies the description
a bit better.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoconfigure: Always compile with -fwrapv
Peter Maydell [Mon, 12 Sep 2016 13:10:08 +0000 (14:10 +0100)]
configure: Always compile with -fwrapv

QEMU's code relies on left shifts of signed integers always
being defined behaviour with the obvious 2s-complement
semantics. The only way to tell the compiler (and any
associated undefined-behaviour sanitizer) that we require a
C dialect with these semantics is to use the -fwrapv option.
This is a bit of a heavy hammer for the job as it also gives
us guaranteed semantics on integer arithmetic overflow which
in theory we don't require.

In an ideal world this would allow us to drop the warning
flag -Wno-shift-negative-value, but we must retain this to
avoid spurious warnings on clang versions predating the
fix to https://llvm.org/bugs/show_bug.cgi?id=25552.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1473685808-9629-1-git-send-email-peter.maydell@linaro.org

7 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Tue, 13 Sep 2016 13:31:18 +0000 (14:31 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

v2:
 * Fixed qcow2 sanitizer warnings [Peter]
 * Renamed get_error test cases to get_error_all to avoid tripping "error:"
   grep scripts [Peter]
 * Added Fam's iothread stop patch

# gpg: Signature made Tue 13 Sep 2016 11:02:30 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  iothread: Stop threads before main() quits
  tests: fix qvirtqueue_kick
  MAINTAINERS: add maintainer for replication
  support replication driver in blockdev-add
  tests: add unit test case for replication
  replication: Implement new driver for block replication
  replication: Introduce new APIs to do replication operation
  configure: support replication
  mirror: auto complete active commit
  docs: block replication's description
  block: Link backup into block core
  Backup: export interfaces for extra serialization
  Backup: clear all bitmap when doing block checkpoint
  block: unblock backup operations in backing file
  virtio-blk: rename virtio_device_info to virtio_blk_info
  linux-aio: process completions from ioq_submit()
  linux-aio: split processing events function
  linux-aio: consume events in userspace instead of calling io_getevents
  qcow2: avoid memcpy(dst, NULL, len)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20160913-1' into staging
Peter Maydell [Tue, 13 Sep 2016 12:56:35 +0000 (13:56 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20160913-1' into staging

virtio-gpu and vmsvga fixes.

# gpg: Signature made Tue 13 Sep 2016 09:14:44 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/pull-vga-20160913-1:
  virtio-vga: adapt to page-per-vq=off
  virtio-gpu-pci: tag as not hotpluggable
  vmsvga: correct bitmap and pixmap size checks

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160913-1' into staging
Peter Maydell [Tue, 13 Sep 2016 11:59:36 +0000 (12:59 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160913-1' into staging

ui: misc small fixes for vnc, spice and curses.

# gpg: Signature made Tue 13 Sep 2016 08:04:46 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/pull-ui-20160913-1:
  vnc: fix qemu crash because of SIGSEGV
  qemu-options.hx: correct spice options streaming-video default document value to 'off'
  ui/curses.c: Clean up nextchr logic
  ui/curses.c: Ensure we don't read off the end of curses2qemu array

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>